Skip to content

Commit

Permalink
ife
Browse files Browse the repository at this point in the history
  • Loading branch information
leaddevops committed Oct 10, 2023
1 parent 0bcd33a commit cbaa334
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
8 changes: 8 additions & 0 deletions 05-create-helm-charts/07-flow-control/iechart1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# place the below content inside the Chart.yaml
apiVersion: v2
type: application
name: iec1
version: "0.1.0" # recomended to follow version as "MAJOR-Version.MINOR-Version.PATCH-Version" always
description: "A Helm chart to deploy all required kubernetes resources"
appVersion: "1.0.0" # your application version / release version
# save the file with the above data
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-app
spec:
{{- if eq .Values.iecapp.env "prod" }}
replicas: 4
{{- else if eq .Values.iecapp.env "qa" }}
replicas: 2
{{- else }}
replicas: 1
{{- end }}
selector:
matchLabels:
app: iec
template:
metadata:
labels:
app: iec
spec:
containers:
- name: sampleapp
image: {{ .Values.image.repo }}:{{ .Values.image.tag }}
ports:
- containerPort: 8080
5 changes: 5 additions & 0 deletions 05-create-helm-charts/07-flow-control/iechart1/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
iecapp:
env: qa
image:
repo: docker.io/lerndevops/samples
tag: pyapp-v2
30 changes: 29 additions & 1 deletion 05-create-helm-charts/07-flow-control/if-else.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,32 @@
{{ else }}
# Default case
{{ end }}
```
```

#### examin the ntchart1 from [github repo](https://github.com/lerndevops/helm-charts/tree/main/05-create-helm-charts/06-named-templates/ntchart1)

```sh
# get the chart to local
cd $HOME ; git clone https://github.com/lerndevops/helm-charts
cd $HOME/helm-charts/05-create-helm-charts/07-flow-control/iechart1
cat templates/deployment.yaml
```
```yaml
{{/* define template for common Labels */}}
{{- define "nt.labels"}}
app: sapp
{{- end }}

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-app
labels:
{{- template "nt.labels" }}
```
```sh
# dry run the chart and observe the output rendered properly

cd $HOME/helm-charts/05-create-helm-charts/06-named-templates/ntchart1
helm install ntchart1-rel . --dry-run
```

0 comments on commit cbaa334

Please sign in to comment.