├── .gitignore
├── release-rollback
├── values.yaml
├── sentence-app
│ ├── templates
│ │ ├── _helpers.tpl
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── NOTES.txt
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ ├── values.yaml
│ ├── .helmignore
│ └── Chart.yaml
└── extra
│ └── sentences-age-deployment.yaml
├── external-charts
├── done
│ └── todo
│ │ ├── README.md
│ │ ├── charts
│ │ └── mysql-8.5.10.tgz
│ │ ├── Chart.lock
│ │ ├── Chart.yaml
│ │ ├── templates
│ │ ├── todo-app-service.yaml
│ │ └── todo-app-deployment.yaml
│ │ └── values.yaml
└── start
│ └── todo
│ ├── README.md
│ ├── Chart.yaml
│ ├── values.yaml
│ └── templates
│ ├── todo-app-service.yaml
│ ├── mysql-service.yaml
│ ├── todo-app-deployment.yaml
│ └── mysql-deployment.yaml
├── test-helm-deployments
├── sentence-regex-test
│ ├── go.mod
│ ├── Dockerfile
│ └── sentence_regex.go
├── start
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
└── done
│ └── sentence-app
│ ├── values.yaml
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── tests
│ │ ├── sentence-regex-test.yaml
│ │ └── sentence-svc-test.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── trainer
├── examples
│ ├── templating
│ │ ├── template-example
│ │ │ ├── templates
│ │ │ │ ├── NOTES.txt
│ │ │ │ ├── basic-if.yaml
│ │ │ │ ├── functions.yaml
│ │ │ │ ├── whitespace-handling-functions.yaml
│ │ │ │ ├── functions-pipelines.yaml
│ │ │ │ ├── named-template.yaml
│ │ │ │ ├── whitespace-handling.yaml
│ │ │ │ ├── range.yaml
│ │ │ │ ├── named-template-pipeline.yaml
│ │ │ │ ├── variables.yaml
│ │ │ │ ├── equality-operators.yaml
│ │ │ │ ├── if-elseif-else.yaml
│ │ │ │ └── named-template-context.yaml
│ │ │ ├── values.yaml
│ │ │ ├── .helmignore
│ │ │ └── Chart.yaml
│ │ └── readme.md
│ ├── templating.md
│ └── test
│ │ └── svc-test-as-job.yaml
└── example-renderer
│ ├── templates
│ └── NOTES.txt
│ ├── values.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── helm-chart-with-parameters
├── done
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
├── done-extras
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
└── start
│ └── sentence-app
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── examples
└── apps
│ ├── cron-job
│ ├── Chart.yaml
│ ├── values.yaml
│ ├── example-values.yaml
│ └── templates
│ │ ├── _helpers.tpl
│ │ └── cronjob.yaml
│ ├── http-server
│ ├── Chart.yaml
│ ├── values.yaml
│ ├── example-values.yaml
│ └── templates
│ │ ├── service.yaml
│ │ ├── _helpers.tpl
│ │ ├── deployment.yaml
│ │ └── ingress.yaml
│ └── external-charts
│ └── todo
│ ├── Chart.yaml
│ ├── templates
│ ├── todo-app-service.yaml
│ └── todo-app-deployment.yaml
│ └── values.yaml
├── helm-chart-whitespace-pipelines-functions
├── start
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
└── done
│ └── sentence-app
│ ├── values.yaml
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── helm-lint
└── start
│ └── sentence-app
│ ├── values.yaml
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── helm-chart-conditionals
├── start
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
└── done
│ └── sentence-app
│ ├── values.yaml
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── sentences-app
├── deploy
│ ├── hpa.yaml
│ ├── docker-compose.yaml
│ ├── kubernetes
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ ├── hpa_v2beta1.yaml
│ ├── hpa_v2beta2.yaml
│ ├── hpa_v2beta2-custom.yaml
│ ├── vpa.yaml
│ └── helmsman
│ │ └── helmsman.yaml
└── dashboard.json
├── sharing-charts
└── sentence-app
│ ├── values.yaml
│ ├── templates
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── tests
│ │ ├── sentence-regex-test.yaml
│ │ └── sentence-svc-test.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ └── Chart.yaml
├── helm-chart-named-templates
├── done
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── _helpers.tpl
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
├── start
│ └── sentence-app
│ │ ├── values.yaml
│ │ ├── templates
│ │ ├── sentences-age-svc.yaml
│ │ ├── sentences-name-svc.yaml
│ │ ├── sentences-svc.yaml
│ │ ├── sentences-age-deployment.yaml
│ │ ├── sentences-name-deployment.yaml
│ │ └── sentences-deployment.yaml
│ │ ├── .helmignore
│ │ └── Chart.yaml
└── done-extras
│ └── sentence-app
│ ├── templates
│ ├── _helpers.tpl
│ ├── sentences-age-svc.yaml
│ ├── sentences-name-svc.yaml
│ ├── sentences-svc.yaml
│ ├── sentences-age-deployment.yaml
│ ├── sentences-name-deployment.yaml
│ └── sentences-deployment.yaml
│ ├── .helmignore
│ ├── values.yaml
│ └── Chart.yaml
├── TRAINER.md
├── CONTRIBUTION.md
├── exercise-template.md
├── LICENSE
├── README.md
├── helm-lint-kubeconform.md
├── hello-sentences-app.md
├── cheat-sheet.md
├── helm-and-helmsman.md
├── intro-to-kubernetes-package-manager.md
├── sharing-charts.md
├── create-a-helm-chart.md
└── helm-chart-conditionals.md
/.gitignore:
--------------------------------------------------------------------------------
1 | helm-chart/
2 |
--------------------------------------------------------------------------------
/release-rollback/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 3
--------------------------------------------------------------------------------
/external-charts/done/todo/README.md:
--------------------------------------------------------------------------------
1 | This chart was created by Kompose
2 |
--------------------------------------------------------------------------------
/external-charts/start/todo/README.md:
--------------------------------------------------------------------------------
1 | This chart was created by Kompose
2 |
--------------------------------------------------------------------------------
/test-helm-deployments/sentence-regex-test/go.mod:
--------------------------------------------------------------------------------
1 | module sentence-regex
2 |
3 | go 1.16
4 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | The NOTES.txt can also contain templating.
2 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 |
--------------------------------------------------------------------------------
/examples/apps/cron-job/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: cron-job
3 | description: A basic cron-job chart
4 | type: application
5 | version: 1.0.0
6 |
--------------------------------------------------------------------------------
/external-charts/done/todo/charts/mysql-8.5.10.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eficode-academy/helm-katas/HEAD/external-charts/done/todo/charts/mysql-8.5.10.tgz
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 |
--------------------------------------------------------------------------------
/examples/apps/http-server/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: http-server
3 | description: A template for a basic http server
4 | type: application
5 | version: 1.0.0
6 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/basic-if.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | myValue: foo
3 | {{- if .Values.k8sIsAwesome }}
4 | myOtherValue: bar
5 | {{- end }}
6 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/functions.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | k8s: {{ lower "IS-AWESOME" }}
3 | myValue: foo
4 | myOtherValue: {{ quote .Values.myOtherValue }}
5 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/whitespace-handling-functions.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | myValue: foo
3 | myMap:
4 |
5 | {{- .Values.myMap | toYaml | nindent 4 }}
6 |
--------------------------------------------------------------------------------
/external-charts/start/todo/Chart.yaml:
--------------------------------------------------------------------------------
1 | name: todo
2 | description: A generated Helm Chart for todo from Skippbox Kompose
3 | version: 0.0.1
4 | apiVersion: v2
5 | keywords:
6 | - todo
7 | sources:
8 | home:
9 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/functions-pipelines.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | k8s: {{ "IS-AWESOME" | lower }}
3 | myValue: foo
4 | myOtherValue: {{ .Values.myOtherValue | upper | quote }}
5 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/named-template.yaml:
--------------------------------------------------------------------------------
1 | {{- define "myTemplate" }}
2 | helmIsCool: true
3 | {{- end }}
4 |
5 | myYaml:
6 | foo: bar
7 | {{ template "myTemplate" }}
8 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/whitespace-handling.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | k8s: {{ "is-awesome" -}}
3 | myValue: foo
4 | myOtherValue:
5 |
6 |
7 | {{- .Values.myOtherValue }}
8 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/range.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | bars:
3 | {{- range .Values.mySlice }}
4 | {{- if contains "bar" . }}
5 | {{ . }}ContainsBar: true
6 | {{- end }}
7 | {{- end }}
8 |
--------------------------------------------------------------------------------
/trainer/example-renderer/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | The NOTES.txt can also contain templating.
2 |
3 | ------------------------------------------
4 |
5 |
6 | < Add example to be rendered here >
7 |
8 |
9 | ------------------------------------------
10 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/named-template-pipeline.yaml:
--------------------------------------------------------------------------------
1 | {{- define "myTemplate3" -}}
2 | k8sIsAwesome: true
3 | helmIsCool: true
4 | {{- end }}
5 |
6 | myYaml:
7 | foo: bar
8 | {{- include "myTemplate3" . | nindent 4 }}
9 |
--------------------------------------------------------------------------------
/examples/apps/http-server/values.yaml:
--------------------------------------------------------------------------------
1 |
2 | app: the-website
3 | replicas: 2
4 | containerPort: 80
5 | image:
6 | repository: nginx
7 | tag: 1.25
8 | defaultIngressHostSuffix: eficode.academy
9 | prefix: test
10 | #customHost: hello.world.eficode.academy
11 |
--------------------------------------------------------------------------------
/external-charts/done/todo/Chart.lock:
--------------------------------------------------------------------------------
1 | dependencies:
2 | - name: mysql
3 | repository: https://charts.bitnami.com/bitnami
4 | version: 8.5.10
5 | digest: sha256:1efe7c1cfd5b20e9561db0e2fbff2b2097573d38b460db850db9cc05c3977dda
6 | generated: "2021-05-30T14:23:52.347768411+02:00"
7 |
--------------------------------------------------------------------------------
/trainer/example-renderer/values.yaml:
--------------------------------------------------------------------------------
1 | k8sIsAwesome: true
2 |
3 | myValue: foo
4 | myOtherValue: bar
5 |
6 | myMap:
7 | outerKey:
8 | innerKey: "someValue"
9 |
10 | mySlice:
11 | - "foo"
12 | - "bar"
13 | - "fubar"
14 |
15 | myApp:
16 | appName: myAwesomeApp
17 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 1
3 | image:
4 | repository: releasepraqma/sentence
5 | tag: latest
6 | service:
7 | type: NodePort
8 | resources:
9 | requests:
10 | cpu: 0.25
11 | limits:
12 | cpu: 0.25
13 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/variables.yaml:
--------------------------------------------------------------------------------
1 | {{- $containsBar := false }}
2 | {{- range .Values.mySlice }}
3 | {{- if contains "bar" . }}
4 | {{- $containsBar = true }}
5 | {{- end }}
6 | {{- end }}
7 |
8 | myYaml:
9 | containsBar: {{ $containsBar }}
10 |
--------------------------------------------------------------------------------
/examples/apps/cron-job/values.yaml:
--------------------------------------------------------------------------------
1 |
2 | app: my-cronjob
3 | image:
4 | repository: hello-world
5 | tag: latest
6 | resources:
7 | requests:
8 | cpu: 0.25
9 | memory: "100Mi"
10 | limits:
11 | cpu: 0.50
12 | memory: "500Mi"
13 | schedule: "*/1 * * * *" # every minute
--------------------------------------------------------------------------------
/test-helm-deployments/sentence-regex-test/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:1.16 AS builder
2 | COPY . /build
3 | WORKDIR /build
4 | RUN CGO_ENABLED=0 go build -a -o sentence-regex .
5 |
6 | FROM scratch
7 | COPY --from=builder /build/sentence-regex /sentence-regex
8 | ENTRYPOINT ["./sentence-regex"]
9 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 1
3 | image:
4 | repository: releasepraqma/sentence
5 | tag: latest
6 | service:
7 | type: NodePort
8 | resources:
9 | requests:
10 | cpu: 0.25
11 | limits:
12 | cpu: 0.25
13 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/values.yaml:
--------------------------------------------------------------------------------
1 | k8sIsAwesome: true
2 |
3 | myValue: foo
4 | myOtherValue: bar
5 |
6 | myMap:
7 | outerKey:
8 | innerKey: "someValue"
9 |
10 | mySlice:
11 | - "foo"
12 | - "bar"
13 | - "fubar"
14 |
15 | myApp:
16 | appName: myAwesomeApp
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 |
--------------------------------------------------------------------------------
/examples/apps/cron-job/example-values.yaml:
--------------------------------------------------------------------------------
1 |
2 | app: my-cronjob
3 | image:
4 | repository: nginx
5 | tag: 1.19.0
6 | schedule: "*/1 * * * *"
7 | #customHost: hello.world.eficode.academy
8 | resources:
9 | requests:
10 | cpu: 0.25
11 | memory: "100Mi"
12 | limits:
13 | cpu: 0.50
14 | memory: "500Mi"
--------------------------------------------------------------------------------
/sentences-app/deploy/hpa.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: autoscaling/v1
2 | kind: HorizontalPodAutoscaler
3 | metadata:
4 | name: sentences
5 | spec:
6 | maxReplicas: 5
7 | minReplicas: 1
8 | scaleTargetRef:
9 | apiVersion: apps/v1
10 | kind: Deployment
11 | name: sentences
12 | targetCPUUtilizationPercentage: 65
13 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 1
3 | image:
4 | repository: releasepraqma/sentence
5 | tag: latest
6 | service:
7 | type: NodePort
8 | name: sentence
9 | port: 9090
10 | resources:
11 | requests:
12 | cpu: 0.25
13 | limits:
14 | cpu: 0.25
15 |
--------------------------------------------------------------------------------
/external-charts/done/todo/Chart.yaml:
--------------------------------------------------------------------------------
1 | name: todo
2 | description: A generated Helm Chart for todo from Skippbox Kompose
3 | version: 0.0.1
4 | apiVersion: v2
5 | keywords:
6 | - todo
7 | sources:
8 | home:
9 | dependencies:
10 | - repository: https://charts.bitnami.com/bitnami
11 | name: mysql
12 | version: 8.5.10
13 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/equality-operators.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | {{- if eq .Values.myValue "foo" }}
3 | myValueIsFoo: true
4 | {{- end }}
5 | {{- if and .Values.myValue (.Values.myOtherValue | lower | ne "bar") }}
6 | myValueIsPresent: true
7 | myOtherValueIsBar: false
8 | {{- end }}
9 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 1
3 | image:
4 | repository: releasepraqma/sentence
5 | tag: latest
6 | service:
7 | type: NodePort
8 | name: sentence
9 | port: 9090
10 | resources:
11 | requests:
12 | cpu: 0.25
13 | limits:
14 | cpu: 0.25
15 |
--------------------------------------------------------------------------------
/examples/apps/external-charts/todo/Chart.yaml:
--------------------------------------------------------------------------------
1 | name: todo
2 | description: A generated Helm Chart for todo from Skippbox Kompose
3 | version: 0.0.1
4 | apiVersion: v2
5 | keywords:
6 | - todo
7 | sources:
8 | home:
9 | dependencies:
10 | - repository: https://charts.bitnami.com/bitnami
11 | name: mysql
12 | version: 9.14.3
13 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{- define "resources" -}}
2 | {{ if .resources -}}
3 | resources:
4 | {{- .resources | toYaml | nindent 2 -}}
5 | {{ else }}
6 | resources:
7 | requests:
8 | cpu: 0.50
9 | memory: "500Mi"
10 | limits:
11 | cpu: 1.0
12 | memory: "1000Mi"
13 | {{- end -}}
14 | {{- end -}}
15 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 | service:
13 | type: ClusterIP
14 | nodePort: 31234
15 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 | service:
13 | type: ClusterIP
14 | nodePort: 31234
15 |
--------------------------------------------------------------------------------
/sentences-app/deploy/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | web:
5 | image: releasepraqma/sentence:latest
6 | command: --age-service http://age:8080 --name-service http://name:8080
7 | ports:
8 | - 8080:8080
9 | name:
10 | image: releasepraqma/name:latest
11 | age:
12 | image: releasepraqma/age:latest
13 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 | service:
13 | type: ClusterIP
14 | # nodePort: 31234
15 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 | service:
13 | type: ClusterIP
14 | nodePort: 31234
15 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/if-elseif-else.yaml:
--------------------------------------------------------------------------------
1 | myYaml:
2 | {{- if .Values.myValue }}
3 | myValuePresent: true
4 | {{- else if .Values.myOtherValue }}
5 | myOtherValuePresent: true
6 | {{- else }}
7 | noValuePresent: true
8 | myValuePresent: false
9 | myOtherValuePresent: false
10 | {{- end }}
11 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{- define "resources" -}}
2 | {{ if .resources -}}
3 | resources:
4 | {{- .resources | toYaml | nindent 2 -}}
5 | {{ else }}
6 | resources:
7 | requests:
8 | cpu: 0.50
9 | memory: "500Mi"
10 | limits:
11 | cpu: 1.0
12 | memory: "1000Mi"
13 | {{- end -}}
14 | {{- end -}}
15 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | global:
2 | organization: releasepraqma
3 |
4 | sentences:
5 | replicas: 2
6 | repository: sentences
7 | tag: latest
8 |
9 | sentencesAge:
10 | replicas: 1
11 | repository: age
12 | tag: latest
13 |
14 | sentencesName:
15 | replicas: 1
16 | repository: name
17 | tag: latest
18 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{- define "resources" -}}
2 | {{ if .resources -}}
3 | resources:
4 | {{- .resources | toYaml | nindent 2 -}}
5 | {{ else }}
6 | resources:
7 | requests:
8 | cpu: 0.50
9 | memory: "500Mi"
10 | limits:
11 | cpu: 1.0
12 | memory: "1000Mi"
13 | {{- end -}}
14 | {{- end -}}
15 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - pport: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/templates/named-template-context.yaml:
--------------------------------------------------------------------------------
1 | {{- define "myTemplate2" -}}
2 | appName: {{ .Values.myApp.appName }}
3 | {{- end }}
4 |
5 | {{- define "myContextualTemplate" -}}
6 | contextualAppName: {{ .appName }}
7 | {{- end }}
8 |
9 | myYaml:
10 | {{ template "myTemplate2" . }}
11 | {{ template "myContextualTemplate" .Values.myApp }}
12 |
--------------------------------------------------------------------------------
/external-charts/start/todo/values.yaml:
--------------------------------------------------------------------------------
1 | todoApp:
2 | mysqlHost: todo-mysql
3 | mysqlDB: todos
4 | mysqlUser: todos
5 | mysqlPassword: todos
6 | service:
7 | name: todo-app
8 | type: NodePort
9 |
10 | mysql:
11 | dbName: todos
12 | dbPassword: todos
13 | dbUser: todos
14 | dbRootPassword: todos
15 | service:
16 | name: todo-mysql
17 | type: ClusterIP
18 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-age-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: age
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: age
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: main
16 | type: NodePort
17 |
--------------------------------------------------------------------------------
/examples/apps/http-server/example-values.yaml:
--------------------------------------------------------------------------------
1 |
2 | app: my-website
3 | replicas: 2
4 | containerPort: 80
5 | image:
6 | repository: nginx
7 | tag: 1.19.0
8 | defaultIngressHostSuffix: eficode.academy
9 | prefix: training
10 | #customHost: hello.world.eficode.academy
11 | resources:
12 | requests:
13 | cpu: 0.25
14 | memory: "100Mi"
15 | limits:
16 | cpu: 0.50
17 | memory: "500Mi"
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-name-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: name
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | selector:
14 | app: sentences
15 | component: name
16 | type: ClusterIP
17 |
--------------------------------------------------------------------------------
/sentences-app/deploy/hpa_v2beta1.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: autoscaling/v2beta1
2 | kind: HorizontalPodAutoscaler
3 | metadata:
4 | name: sentences
5 | spec:
6 | maxReplicas: 5
7 | minReplicas: 1
8 | scaleTargetRef:
9 | apiVersion: apps/v1
10 | kind: Deployment
11 | name: sentences
12 | metrics:
13 | - type: Resource
14 | resource:
15 | name: cpu
16 | targetAverageUtilization: 65
17 |
--------------------------------------------------------------------------------
/trainer/examples/templating.md:
--------------------------------------------------------------------------------
1 | This is an example of confusing text templating in Helm.
2 |
3 | ```TEXT
4 | {{- define "anotherMyTemplate" }}
5 | {{- if and "hej" ( "foo"| upper | ne "bar" ) }}
6 | anders and
7 | {{- end }}
8 | {{ end }}
9 |
10 | {{ define "myTemplate" }}
11 | helmIsCool: true
12 | {{ template "anotherMyTemplate" . }}
13 | {{- end -}}
14 | hvor står jeg henne
15 | {{- template "myTemplate" }}
16 | ```
17 |
--------------------------------------------------------------------------------
/trainer/examples/templating/readme.md:
--------------------------------------------------------------------------------
1 | This directory contains a barebones helm chart, with nonsense .yaml files that exemplify different templating features.
2 |
3 | Each `templates/*.yaml` represents a specific slide.
4 |
5 | Use `$ helm template template-example` to render all templates
6 |
7 | or `$ helm template template-example --show-only templates/functions.yaml`
8 |
9 | To only render a specific template file.
10 |
--------------------------------------------------------------------------------
/sentences-app/deploy/hpa_v2beta2.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: autoscaling/v2beta2
2 | kind: HorizontalPodAutoscaler
3 | metadata:
4 | name: sentences
5 | spec:
6 | maxReplicas: 5
7 | minReplicas: 1
8 | scaleTargetRef:
9 | apiVersion: apps/v1
10 | kind: Deployment
11 | name: sentences
12 | metrics:
13 | - type: Resource
14 | resource:
15 | name: cpu
16 | target:
17 | type: Utilization
18 | averageUtilization: 65
19 |
--------------------------------------------------------------------------------
/examples/apps/http-server/templates/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.app }}
5 | labels:
6 | app: {{ .Values.app }}
7 | managed_by: {{ .Release.Service }}
8 | chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9 | spec:
10 | type: NodePort
11 | selector:
12 | app: {{ .Values.app }}
13 | ports:
14 | - name: server
15 | port: 80 # Service port
16 | targetPort: {{ .Values.containerPort }}
17 |
--------------------------------------------------------------------------------
/external-charts/done/todo/templates/todo-app-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: {{ .Values.todoApp.service.name }}
8 | spec:
9 | ports:
10 | - name: "3000"
11 | port: 3000
12 | targetPort: 3000
13 | selector:
14 | io.kompose.service: todo-app
15 | type: {{ .Values.todoApp.service.type }}
16 | status:
17 | loadBalancer: {}
18 |
--------------------------------------------------------------------------------
/examples/apps/cron-job/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{- define "resources" -}}
2 | {{ if .resources -}}
3 | {{- .resources | toYaml | nindent 2 -}}
4 | {{ else }}
5 | requests:
6 | cpu: 0.50
7 | memory: "500Mi"
8 | limits:
9 | cpu: 1.0
10 | memory: "1000Mi"
11 | {{- end -}}
12 | {{- end -}}
13 |
14 | {{- define "metadata" -}}
15 | app: {{ .Values.app }}
16 | managed_by: {{ .Release.Service }}
17 | chart: {{ .Chart.Name }}-{{ .Chart.Version }}
18 | {{- end -}}
--------------------------------------------------------------------------------
/external-charts/start/todo/templates/todo-app-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: {{ .Values.todoApp.service.name }}
8 | spec:
9 | ports:
10 | - name: "3000"
11 | port: 3000
12 | targetPort: 3000
13 | selector:
14 | io.kompose.service: todo-app
15 | type: {{ .Values.todoApp.service.type }}
16 | status:
17 | loadBalancer: {}
18 |
--------------------------------------------------------------------------------
/examples/apps/external-charts/todo/templates/todo-app-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: {{ .Values.todoApp.service.name }}
8 | spec:
9 | ports:
10 | - name: "3000"
11 | port: 3000
12 | targetPort: 3000
13 | selector:
14 | io.kompose.service: todo-app
15 | type: {{ .Values.todoApp.service.type }}
16 | status:
17 | loadBalancer: {}
18 |
--------------------------------------------------------------------------------
/examples/apps/http-server/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{- define "resources" -}}
2 | {{ if .resources -}}
3 | {{- .resources | toYaml | nindent 2 -}}
4 | {{ else }}
5 | requests:
6 | cpu: 0.50
7 | memory: "500Mi"
8 | limits:
9 | cpu: 1.0
10 | memory: "1000Mi"
11 | {{- end -}}
12 | {{- end -}}
13 |
14 | {{- define "metadata" -}}
15 | app: {{ .Values.app }}
16 | managed_by: {{ .Release.Service }}
17 | chart: {{ .Chart.Name }}-{{ .Chart.Version }}
18 | {{- end -}}
--------------------------------------------------------------------------------
/external-charts/start/todo/templates/mysql-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: {{ .Values.mysql.service.name }}
7 | name: {{ .Values.mysql.service.name }}
8 | spec:
9 | ports:
10 | - name: "3306"
11 | port: 3306
12 | targetPort: 3306
13 | selector:
14 | io.kompose.service: mysql
15 | type: {{ .Values.mysql.service.type }}
16 | status:
17 | loadBalancer: {}
18 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/tests/sentence-regex-test.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: "{{ .Release.Name }}-sentence-regex-test"
5 | annotations:
6 | "helm.sh/hook": test
7 | spec:
8 | restartPolicy: Never
9 | containers:
10 | - name: "{{ .Release.Name }}-sentence-regex-test"
11 | image: releasepraqma/sentence-regex-test:latest
12 | args: ["http://{{ .Values.sentences.service.name }}:{{ .Values.sentences.service.port }}"]
13 |
--------------------------------------------------------------------------------
/trainer/example-renderer/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/TRAINER.md:
--------------------------------------------------------------------------------
1 | # Trainer notes
2 |
3 | ## Setup
4 |
5 | For 12 participants, this is the recommended
6 | setup:
7 |
8 | ```
9 | bastion_count = 1
10 | instance_count = 14
11 | cluster_initial_worker_node_count = 4
12 | cluster_machine_type = "n1-standard-4"
13 | ```
14 |
15 | Remember afterwards to run the following scripts
16 | in the following order:
17 |
18 | - `./wait_bastion_ready.sh && ./create-users.sh`
19 |
20 | After this, all training instances should have
21 | kubectl configured.
22 |
--------------------------------------------------------------------------------
/sentences-app/deploy/hpa_v2beta2-custom.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: autoscaling/v2beta2
2 | kind: HorizontalPodAutoscaler
3 | metadata:
4 | name: sentences
5 | spec:
6 | maxReplicas: 5
7 | minReplicas: 1
8 | scaleTargetRef:
9 | apiVersion: apps/v1
10 | kind: Deployment
11 | name: sentences
12 | metrics:
13 | - type: Pods
14 | pods:
15 | metric:
16 | name: sentence_requests_per_second
17 | target:
18 | type: AverageValue
19 | averageValue: 25
20 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/tests/sentence-regex-test.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: "{{ .Release.Name }}-sentence-regex-test"
5 | annotations:
6 | "helm.sh/hook": test
7 | spec:
8 | restartPolicy: Never
9 | containers:
10 | - name: "{{ .Release.Name }}-sentence-regex-test"
11 | image: releasepraqma/sentence-regex-test:latest
12 | args: ["http://{{ .Values.sentences.service.name }}:{{ .Values.sentences.service.port }}"]
13 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | This info will be displayed when you either install or upgrade your release
2 | You can use actions in here like display the namespace it will be deployed to:
3 | {{ .Release.Namespace }}
4 |
5 | Or the example that helm.sh has:
6 | Thank you for installing {{ .Chart.Name }}.
7 |
8 | Your release is named {{ .Release.Name }}.
9 |
10 | To learn more about the release, try:
11 |
12 | $ helm status {{ .Release.Name }}
13 | $ helm get all {{ .Release.Name }}
14 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/sentences-app/deploy/vpa.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: "autoscaling.k8s.io/v1beta2"
2 | kind: VerticalPodAutoscaler
3 | metadata:
4 | name: sentence
5 | spec:
6 | targetRef:
7 | apiVersion: "apps/v1"
8 | kind: Deployment
9 | name: sentences
10 | resourcePolicy:
11 | containerPolicies:
12 | - containerName: "sentences"
13 | minAllowed:
14 | memory: 300Mi
15 | maxAllowed:
16 | memory: 1Gi
17 | updatePolicy:
18 | # "Auto" means both on POD creation and update of existing PODs
19 | updateMode: "Auto"
20 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/tests/sentence-svc-test.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: "{{ .Release.Name }}-sentence-svc-test"
5 | annotations:
6 | # this annotation is what makes this pod spec a helm test!
7 | "helm.sh/hook": test
8 | spec:
9 | restartPolicy: Never
10 | containers:
11 | - name: "{{ .Release.Name }}-sentence-svc-test"
12 | image: ghcr.io/eficode-academy/network-multitool:latest
13 | command: ["curl", "-s", "{{ .Values.sentences.service.name }}:{{ .Values.sentences.service.port }}"]
14 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/tests/sentence-svc-test.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: "{{ .Release.Name }}-sentence-svc-test"
5 | annotations:
6 | # this annotation is what makes this pod spec a helm test!
7 | "helm.sh/hook": test
8 | spec:
9 | restartPolicy: Never
10 | containers:
11 | - name: "{{ .Release.Name }}-sentence-svc-test"
12 | image: ghcr.io/eficode-academy/network-multitool:latest
13 | command: ["curl", "-s", "{{ .Values.sentences.service.name }}:{{ .Values.sentences.service.port }}"]
14 |
--------------------------------------------------------------------------------
/CONTRIBUTION.md:
--------------------------------------------------------------------------------
1 | # Contribution
2 |
3 | ## Best practices
4 |
5 | When ever you think there is too much text, but that it is necessary, please use the `details` tag to make the text toggleable, by clicking the arrow:
6 |
7 |
8 | A Hint
9 | It helps reducing the amount of word overload that we sometimes write
10 |
11 |
12 | The code to make this happen is the following:
13 |
14 | ```markdown
15 |
16 | Hint
17 | All markdown in here is hidden in an expandable field
18 |
19 | ```
20 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/examples/apps/external-charts/todo/values.yaml:
--------------------------------------------------------------------------------
1 | todoApp:
2 | ## the hostname of the service will be `-mysql`
3 | mysqlDB: todos
4 | mysqlUser: todos
5 | mysqlPassword: todos
6 | service:
7 | name: todo-app
8 | type: NodePort
9 |
10 | mysql:
11 | image:
12 | tag: 5.7
13 | auth:
14 | rootPassword: todos
15 | database: todos
16 | username: todos
17 | password: todos
18 | primary:
19 | resources:
20 | requests:
21 | cpu: 0.25
22 | memory: "250Mi"
23 | limits:
24 | cpu: 1.0
25 | memory: "1000Mi"
26 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentence
8 | spec:
9 | ports:
10 | - port: 8080
11 | protocol: TCP
12 | targetPort: 8080
13 | {{ if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort -}}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/external-charts/done/todo/values.yaml:
--------------------------------------------------------------------------------
1 | todoApp:
2 | ## the hostname of the service will be `-mysql`
3 | mysqlHost: my-todo-mysql
4 | mysqlDB: todos
5 | mysqlUser: todos
6 | mysqlPassword: todos
7 | service:
8 | name: todo-app
9 | type: NodePort
10 |
11 | mysql:
12 | image:
13 | tag: 5.7
14 | auth:
15 | rootPassword: todos
16 | database: todos
17 | username: todos
18 | password: todos
19 | primary:
20 | resources:
21 | requests:
22 | cpu: 0.25
23 | memory: "250Mi"
24 | limits:
25 | cpu: 1.0
26 | memory: "1000Mi"
27 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: {{ .Values.sentences.service.name }}
8 | spec:
9 | ports:
10 | - port: {{ .Values.sentences.service.port }}
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: {{ .Values.sentences.service.name }}
8 | spec:
9 | ports:
10 | - port: {{ .Values.sentences.service.port }}
11 | protocol: TCP
12 | targetPort: 8080
13 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
14 | nodePort: {{ .Values.sentences.service.nodePort }}
15 | {{- end }}
16 | selector:
17 | app: sentences
18 | component: main
19 | type: {{ .Values.sentences.service.type }}
20 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/values.yaml:
--------------------------------------------------------------------------------
1 | sentences:
2 | replicas: 2
3 | repository: releasepraqma/sentence
4 | tag: latest
5 | resources:
6 | requests:
7 | cpu: 0.25
8 | memory: "100Mi"
9 | limits:
10 | cpu: 0.50
11 | memory: "500Mi"
12 | service:
13 | type: ClusterIP
14 | # nodePort: 31234
15 |
16 | sentencesAge:
17 | resources:
18 | requests:
19 | cpu: 1.25
20 | memory: "200Mi"
21 | limits:
22 | cpu: 1.50
23 | memory: "1200Mi"
24 |
25 | sentencesName:
26 | resources:
27 | requests:
28 | cpu: 2.25
29 | memory: "500Mi"
30 | limits:
31 | cpu: 2.50
32 | memory: "2200Mi"
33 |
--------------------------------------------------------------------------------
/examples/apps/cron-job/templates/cronjob.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: batch/v1
2 | kind: CronJob
3 | metadata:
4 | name: {{ .Values.app }}
5 | labels:
6 | {{- include "metadata" . | nindent 4 }}
7 | spec:
8 | schedule: {{ .Values.schedule | quote }}
9 | concurrencyPolicy: Forbid # Don't start another job if the previous is still running
10 | jobTemplate:
11 | spec:
12 | template:
13 | spec:
14 | containers:
15 | - name: {{ .Values.app }}
16 | image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
17 | imagePullPolicy: IfNotPresent
18 | resources:
19 | {{- include "resources" .Values.sentencesName | nindent 12 }}
20 | restartPolicy: OnFailure
21 |
--------------------------------------------------------------------------------
/trainer/examples/test/svc-test-as-job.yaml:
--------------------------------------------------------------------------------
1 | ## Example of the sentence-svc-test as a Job instead of Pod.
2 | ##
3 | ---
4 | apiVersion: batch/v1
5 | kind: Job
6 | metadata:
7 | name: "{{ .Release.Name }}-sentence-svc-test"
8 | annotations:
9 | # this annotation is what makes this pod spec a helm test!
10 | "helm.sh/hook": test
11 | spec:
12 | template:
13 | metadata:
14 | name: "{{ .Release.Name }}-sentence-svc-test"
15 | spec:
16 | restartPolicy: Never
17 | containers:
18 | - name: "{{ .Release.Name }}-sentence-svc-test"
19 | image: ghcr.io/eficode-academy/network-multitool:latest
20 | command: ["curl", "-s", "{{ .Values.sentences.service.name }}:{{ .Values.sentences.service.port }}"]
21 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | {{- include "resources" .Values.sentencesAge | nindent 8 }}
29 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | {{- include "resources" .Values.sentencesName | nindent 8 }}
29 |
--------------------------------------------------------------------------------
/release-rollback/extra/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/examples/apps/http-server/templates/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: {{ .Values.app }}
5 | labels:
6 | {{ include "metadata" . | indent 4 }}
7 | spec:
8 | replicas: {{ .Values.replicas }}
9 | selector:
10 | matchLabels:
11 | app: {{ .Values.app }}
12 | template:
13 | metadata:
14 | labels:
15 | {{- include "metadata" . | nindent 8 }}
16 | spec:
17 | containers:
18 | - name: {{ .Values.app }}
19 | image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
20 | ports:
21 | - containerPort: {{ .Values.containerPort }}
22 | name: http-web
23 | protocol: TCP
24 | resources:
25 | {{- include "resources" . | indent 10 }}
26 | {{- if .Values.env }}
27 | env:
28 | {{- toYaml .Values.env | nindent 10 }}
29 | {{- end }}
30 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: age
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: age
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/age:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: name
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: name
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/name:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | resources:
29 | requests:
30 | cpu: 0.25
31 | limits:
32 | cpu: 0.25
33 |
--------------------------------------------------------------------------------
/sentences-app/deploy/kubernetes/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: main
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: main
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/sentence:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | requests:
34 | cpu: 0.25
35 | limits:
36 | cpu: 0.25
37 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | containers:
25 | - image: {{ .Values.sentences.image.repository }}:{{ .Values.sentences.image.tag }}
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | {{ toYaml .Values.sentences.resources | indent 10 }}
34 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | containers:
25 | - image: {{ .Values.sentences.image.repository }}:{{ .Values.sentences.image.tag }}
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | {{ toYaml .Values.sentences.resources | indent 10 }}
34 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | selector:
10 | matchLabels:
11 | app: sentences
12 | component: main
13 | template:
14 | metadata:
15 | labels:
16 | app: sentences
17 | component: main
18 | annotations:
19 | prometheus.io/scrape: 'true'
20 | prometheus.io/port: '8080'
21 | prometheus.io/path: '/metrics'
22 | spec:
23 | #priorityClassName: medium-priority
24 | containers:
25 | - image: releasepraqma/sentence:latest
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | requests:
34 | cpu: 0.25
35 | limits:
36 | cpu: 0.25
37 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | containers:
25 | - image: {{ .Values.sentences.image.repository }}:{{ .Values.sentences.image.tag }}
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | {{ toYaml .Values.sentences.resources | indent 10 }}
34 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | containers:
25 | - image: {{ .Values.sentences.image.repository }}:{{ .Values.sentences.image.tag }}
26 | imagePullPolicy: Always
27 | name: sentences
28 | args: [
29 | '--age-service', 'http://age:8080',
30 | '--name-service', 'http://name:8080'
31 | ]
32 | resources:
33 | {{ toYaml .Values.sentences.resources | indent 10 }}
34 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-age-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: age
7 | name: sentence-age
8 | spec:
9 | replicas: {{ .Values.sentencesAge.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: age
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: age
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.global.organization }}/{{ .Values.sentencesAge.repository }}:{{ .Values.sentencesAge.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | resources:
30 | requests:
31 | cpu: 0.25
32 | limits:
33 | cpu: 0.25
34 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-name-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: name
7 | name: sentence-name
8 | spec:
9 | replicas: {{ .Values.sentencesName.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: name
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: name
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.global.organization }}/{{ .Values.sentencesName.repository }}:{{ .Values.sentencesName.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | resources:
30 | requests:
31 | cpu: 0.25
32 | limits:
33 | cpu: 0.25
34 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | {{- include "resources" .Values.sentences | nindent 8 }}
34 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | {{- include "resources" .Values.sentences | nindent 8 }}
34 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | {{- include "resources" .Values.sentences | nindent 8 }}
34 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | {{- .Values.sentences.resources | toYaml | nindent 10 }}
35 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | {{- .Values.sentences.resources | toYaml | nindent 10 }}
35 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | {{- .Values.sentences.resources | toYaml | nindent 10 }}
35 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | {{- .Values.sentences.resources | toYaml | nindent 10 }}
35 |
--------------------------------------------------------------------------------
/exercise-template.md:
--------------------------------------------------------------------------------
1 | # Template headline
2 |
3 | ## Learning Goals
4 |
5 | - provide a list of goals to learn here
6 |
7 | ## Introduction
8 |
9 | Here you will provide the bare minimum of information people need to solve the exercise.
10 |
11 | ## Subsections
12 |
13 | You can have several subsections if needed.
14 |
15 |
16 | :bulb: If an explanaition becomes too long, the more detailed parts can be encapsulated in a drop down section
17 |
18 |
19 | ## Exercise
20 |
21 | ### Overview
22 |
23 | - In bullets, what are you going to solve as a student
24 |
25 | ### Step by step instructions
26 |
27 |
28 | More Details
29 |
30 | **take the same bullet names as above and put them in to illustrate how far the student have gone**
31 |
32 | - all actions that you believe the student should do, should be in a bullet
33 |
34 | > :bulb: Help can be illustrated with bulbs in order to make it easy to distinguish.
35 |
36 |
37 |
38 | ### Clean up
39 |
40 | If anything needs cleaning up, here is the section to do just that.
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | requests:
35 | cpu: 0.25
36 | limits:
37 | cpu: 0.25
38 |
--------------------------------------------------------------------------------
/external-charts/done/todo/templates/todo-app-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: todo-app
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | io.kompose.service: todo-app
13 | strategy: {}
14 | template:
15 | metadata:
16 | creationTimestamp: null
17 | labels:
18 | io.kompose.service: todo-app
19 | spec:
20 | containers:
21 | - env:
22 | - name: MYSQL_HOST
23 | value: {{ .Values.todoApp.mysqlHost }}
24 | - name: MYSQL_DB
25 | value: {{ .Values.todoApp.mysqlDB }}
26 | - name: MYSQL_USER
27 | value: {{ .Values.todoApp.mysqlUser }}
28 | - name: MYSQL_PASSWORD
29 | value: {{ .Values.todoApp.mysqlPassword }}
30 | image: releasepraqma/todo-app
31 | name: todo-app
32 | ports:
33 | - containerPort: 3000
34 | resources: {}
35 | restartPolicy: Always
36 | status: {}
37 |
--------------------------------------------------------------------------------
/external-charts/start/todo/templates/todo-app-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: todo-app
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | io.kompose.service: todo-app
13 | strategy: {}
14 | template:
15 | metadata:
16 | creationTimestamp: null
17 | labels:
18 | io.kompose.service: todo-app
19 | spec:
20 | containers:
21 | - env:
22 | - name: MYSQL_HOST
23 | value: {{ .Values.todoApp.mysqlHost }}
24 | - name: MYSQL_DB
25 | value: {{ .Values.todoApp.mysqlDB }}
26 | - name: MYSQL_USER
27 | value: {{ .Values.todoApp.mysqlUser }}
28 | - name: MYSQL_PASSWORD
29 | value: {{ .Values.todoApp.mysqlPassword }}
30 | image: releasepraqma/todo-app
31 | name: todo-app
32 | ports:
33 | - containerPort: 3000
34 | resources: {}
35 | restartPolicy: Always
36 | status: {}
37 |
--------------------------------------------------------------------------------
/examples/apps/external-charts/todo/templates/todo-app-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: todo-app
7 | name: todo-app
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | io.kompose.service: todo-app
13 | strategy: {}
14 | template:
15 | metadata:
16 | creationTimestamp: null
17 | labels:
18 | io.kompose.service: todo-app
19 | spec:
20 | containers:
21 | - env:
22 | - name: MYSQL_HOST
23 | value: {{ .Release.Name }}-mysql
24 | - name: MYSQL_DB
25 | value: {{ .Values.todoApp.mysqlDB }}
26 | - name: MYSQL_USER
27 | value: {{ .Values.todoApp.mysqlUser }}
28 | - name: MYSQL_PASSWORD
29 | value: {{ .Values.todoApp.mysqlPassword }}
30 | image: releasepraqma/todo-app
31 | name: todo-app
32 | ports:
33 | - containerPort: 3000
34 | resources: {}
35 | restartPolicy: Always
36 | status: {}
37 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | requests:
35 | cpu: 0.25
36 | limits:
37 | cpu: 0.25
38 |
--------------------------------------------------------------------------------
/external-charts/start/todo/templates/mysql-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: mysql
7 | name: mysql
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | io.kompose.service: mysql
13 | strategy: {}
14 | template:
15 | metadata:
16 | creationTimestamp: null
17 | labels:
18 | io.kompose.service: mysql
19 | spec:
20 | containers:
21 | - env:
22 | - name: MYSQL_DATABASE
23 | value: {{ .Values.mysql.dbName }}
24 | - name: MYSQL_PASSWORD
25 | value: {{ .Values.mysql.dbPassword }}
26 | - name: MYSQL_ROOT_PASSWORD
27 | value: {{ .Values.mysql.dbRootPassword }}
28 | - name: MYSQL_USER
29 | value: {{ .Values.mysql.dbUser }}
30 | image: mysql:5.7
31 | name: mysql
32 | ports:
33 | - containerPort: 3306
34 | resources:
35 | limits:
36 | memory: 1Gi
37 | restartPolicy: Always
38 | status: {}
39 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/templates/sentences-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app: sentences
6 | component: main
7 | name: sentences
8 | spec:
9 | replicas: {{ .Values.sentences.replicas }}
10 | selector:
11 | matchLabels:
12 | app: sentences
13 | component: main
14 | template:
15 | metadata:
16 | labels:
17 | app: sentences
18 | component: main
19 | annotations:
20 | prometheus.io/scrape: 'true'
21 | prometheus.io/port: '8080'
22 | prometheus.io/path: '/metrics'
23 | spec:
24 | #priorityClassName: medium-priority
25 | containers:
26 | - image: {{ .Values.global.organization }}/{{ .Values.sentences.repository }}:{{ .Values.sentences.tag }}
27 | imagePullPolicy: Always
28 | name: sentences
29 | args: [
30 | '--age-service', 'http://age:8080',
31 | '--name-service', 'http://name:8080'
32 | ]
33 | resources:
34 | requests:
35 | cpu: 0.25
36 | limits:
37 | cpu: 0.25
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Eficode Academy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/helm-lint/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: aplication
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/sharing-charts/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/trainer/example-renderer/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: example-renderer
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/release-rollback/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/examples/apps/http-server/templates/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: networking.k8s.io/v1
2 | kind: Ingress
3 | metadata:
4 | name: {{ .Values.app }}
5 | labels:
6 | app: {{ .Values.app }}
7 | managed_by: {{ .Release.Service }}
8 | chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9 | annotations:
10 | # These annotations are required to use ALB Ingress Controller
11 | alb.ingress.kubernetes.io/scheme: internet-facing
12 | kubernetes.io/ingress.class: alb
13 | alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
14 | spec:
15 | rules:
16 | # Example: https://app.k8s.acme.com
17 | - host: {{ .Release.Namespace }}-{{ .Values.app }}.{{.Values.prefix}}.{{ .Values.defaultIngressHostSuffix }}
18 | http:
19 | paths:
20 | - path: /
21 | pathType: Prefix
22 | backend:
23 | service:
24 | name: {{ .Values.app }} #Same as the serivce name
25 | port:
26 | number: 80
27 | {{- if $.Values.customHost }}
28 | - host: {{ .Values.customHost }}
29 | http:
30 | paths:
31 | - path: /
32 | pathType: Prefix
33 | backend:
34 | service:
35 | name: {{ .Values.app }}
36 | port:
37 | name: server
38 | {{- end }}
39 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/done/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-conditionals/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/test-helm-deployments/done/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/test-helm-deployments/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/test-helm-deployments/sentence-regex-test/sentence_regex.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "io/ioutil"
5 | "log"
6 | "net/http"
7 | "os"
8 | "regexp"
9 | )
10 |
11 | func main() {
12 | // check that the users has provided an endpoint as the first argument
13 | if len(os.Args[1:]) < 1 {
14 | log.Fatalln("Error: You must pass the endpoint to query as the first argument.")
15 | }
16 | // parse the endpoint to a variable
17 | var endpoint = os.Args[1]
18 |
19 | // query the endpoint
20 | resp, err := http.Get(endpoint)
21 | if err != nil {
22 | log.Fatalln(err)
23 | }
24 |
25 | // parse the response body to a string
26 | body, err := ioutil.ReadAll(resp.Body)
27 | if err != nil {
28 | log.Fatalln(err)
29 | }
30 | sentence := string(body)
31 |
32 | // create the regex matcher
33 | var valid_regex = `^[A-Z][a-z]+\ is\ \d+\ years$`
34 | var valid_response = regexp.MustCompile(valid_regex)
35 |
36 | // check that the received body matches the regex
37 | if valid_response.MatchString(sentence) {
38 | log.Println("response: '", sentence, "' is valid.")
39 | // exit succesfully if matched
40 | os.Exit(0)
41 | } else {
42 | log.Println("response: '", sentence, "' is not valid.")
43 | // exit unsuccesfully if not matched
44 | os.Exit(1)
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/trainer/examples/templating/template-example/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: template-example
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-named-templates/done-extras/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-with-parameters/done-extras/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/done/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/helm-chart-whitespace-pipelines-functions/start/sentence-app/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: sentence-app
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | # It is recommended to use it with quotes.
24 | appVersion: "1.16.0"
25 |
--------------------------------------------------------------------------------
/sentences-app/deploy/helmsman/helmsman.yaml:
--------------------------------------------------------------------------------
1 | # For use with Helmsman
2 |
3 | metadata:
4 | org: "Praqma.com"
5 | maintainer: "Name Somename (example@praqma.net)"
6 | description: "Example Desired State File for Sentences demo app."
7 |
8 | helmRepos:
9 | stable: "https://kubernetes-charts.storage.googleapis.com"
10 |
11 | namespaces:
12 | default:
13 |
14 | apps:
15 | age:
16 | description: "The backend service for sentences to supply an age"
17 | chart: ../../../../k8s-sentences-age/helm/age
18 | namespace: default
19 | enabled: true
20 | priority: -1
21 | version: 0.1.0
22 | set:
23 | image.repository: "releasepraqma/age"
24 | image.tag: "latest"
25 |
26 | name:
27 | description: "The backend service for sentences to supply a name"
28 | chart: ../../../../k8s-sentences-name/helm/name
29 | namespace: default
30 | enabled: true
31 | priority: -1
32 | version: 0.1.0
33 | set:
34 | image.repository: "releasepraqma/name"
35 | image.tag: "latest"
36 |
37 | sentence:
38 | description: "The main facade for sentences"
39 | chart: ../../../../k8s-sentences-sentence/helm/sentence
40 | namespace: default
41 | enabled: true
42 | priority: 0
43 | wait: true
44 | version: 0.1.0
45 | set:
46 | image.repository: "releasepraqma/sentence"
47 | image.tag: "latest"
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Helm katas
2 |
3 | A set of Helm exercises actively used by [Eficode Academy](https://www.eficode.com/academy)
4 |
5 | ## Overview of exercises
6 |
7 | Natural progression:
8 |
9 | - [Intro to Kubernetes package manager](intro-to-kubernetes-package-manager.md)
10 | - [Hello sentences app](hello-sentences-app.md)
11 | - [Create a helm chart](create-a-helm-chart.md)
12 | - [Helm release and rollback](release-rollback.md)
13 | - [Helm chart with parameters](helm-chart-with-parameters.md)
14 | - [Helm Chart Whitespace Handling, Pipelines and Functions](helm-chart-whitespace-pipelines-functions.md)
15 | - [Helm Chart Conditionals](helm-chart-conditionals.md)
16 | - [Helm Chart Named Templates](helm-chart-named-templates.md)
17 | - [Helm lint and kubeval](helm-lint-kubeconform.md)
18 | - [Testing Helm Deployments](test-helm-deployments.md)
19 | - [Sharing charts](sharing-charts.md)
20 | - [External charts](external-charts.md)
21 |
22 | ## How to Read Exercise Files
23 |
24 | All exercise files start with an introduction
25 | followed by the actual exercise.
26 |
27 | A general overview of the exercise is given first,
28 | followed by more detailed step-by-step
29 | instructions. If you want a little challenge, you
30 | can try to read the general steps of the
31 | exercise and do the exercise, if you need more help, take a look at
32 | the step-by-step instructions. The step-by-step instructions also explain _why_
33 | some of the steps are done in the way they are in the exercise.
34 |
35 | **Each exercise is summarized in bold text at the
36 | beginning.**
37 |
38 | - All exercise steps are bulleted. The bulleted
39 | points summarize the previous paragraphs as
40 | small individual tasks. **To finish the
41 | exercise, it's sufficient to read only the
42 | bulleted steps.** All other text is just
43 | narrative and explanations as to why things are
44 | done the way they are.
45 |
46 | > Quoted blocks indicate points that are "nice to know" and
47 | > can be safely ignored. They won't affect the
48 | > outcome of the exercise, but generally include
49 | > additional information the training doesn't
50 | > handle.
51 | >
52 | > :bulb: If a quoted paragraph begins with a
53 | > lightbulb, it indicates that it's a hint for the
54 | > exercise step.
55 |
--------------------------------------------------------------------------------
/helm-lint-kubeconform.md:
--------------------------------------------------------------------------------
1 | # Helm Lint and kubeconform
2 | ## Learning Goals
3 |
4 | - Debug helm chart through `helm lint`
5 | - Debug kubernetes objects renderes through helm with the `helm kubeconform` plugin
6 |
7 | ## Helm linting and kubeconform plugin
8 |
9 | Linting and evaluating the kubernetes objects that helm produces through `helm lint` and `kubeconform` can help you speed up you development of helm charts, by catching your typos and indentation mistakes.
10 |
11 | We are going to use two different tools here:
12 |
13 | - `helm lint` will lint your helm chart, catching mandatory fields not set in the helm objects, and validate all of the YAML containing actions.
14 | - `helm kubeconform` is a plugin to render your chart into kubernetes objects, and then run the `kubeconform` kubernetes YAML linter on them. It functions similarly to `helm lint`, but for kubernetes objects.
15 |
16 | Both tools help you, but with different scope, one for the template files themselves, and the other for the rendered templates.
17 |
18 | ## Exercise
19 |
20 | This exercise is about using the linters to find mistakes in a chart we have prepared.
21 | Therefore there is no step by step walk through in this exercise, as you will have to use the tools to find the mistakes and fix them.
22 |
23 | But we will provide a section with hints in :bulb:.
24 |
25 | ### Overview
26 |
27 | The exercise resides in the `helm-lint/start` folder.
28 |
29 | - Run `helm lint sentence-app/` to help you identify the problems of the chart.
30 | - Run `helm kubeconform sentence-app/` to help you investigate further.
31 | - Deploy the fixed chart
32 |
33 | ### Hints
34 |
35 |
36 | :bulb: First hint
37 |
38 | > The first error you get when running helm lint is that the chart.metadata.type is wrong. That property is set in the Chart.yaml. Look at the spelling of application.
39 |
40 |
41 |
42 |
43 | :bulb: Second hint
44 |
45 | > Next output tells you that there is something wrong at line 12 in templates/sentences-name-svc.yaml. This is not exactly correct, but has to do with the way YAML gets linted. The real problem comes a few lines above and has something to do with indentation.
46 |
47 |
48 |
49 |
50 | :bulb: Third hint
51 |
52 | > By now, helm lint should not give you any more errors, and you need to use helm kubeconform. The error it gives you are aimed at the kubernetes objects. Therefore the typo in "port" should be fairly easy to spot in `sentence-app/templates/sentences-age-svc.yaml`
53 |
54 |
55 |
56 | ### Clean up
57 |
58 | If anything needs cleaning up, here is the section to do just that. If you have deployed the chart, please uninstall it again :)
59 |
60 | ### Resources
61 |
62 | https://github.com/melmorabity/helm-kubeconform
63 |
--------------------------------------------------------------------------------
/hello-sentences-app.md:
--------------------------------------------------------------------------------
1 | # Say Hello to the Sentences Application
2 |
3 | ## Learning goal
4 |
5 | - Try out the sentences application
6 |
7 | ## Introduction
8 |
9 | This exercise introduces the example application,
10 | aka. the `sentences application` and show how to
11 | run it both with docker-compose and on Kubernetes.
12 |
13 | ## Running the Sentences Application with Docker Compose
14 |
15 |
16 | More information
17 |
18 | The sentences application consists of three
19 | microservices packaged in three different
20 | container images. The sentences application can be
21 | run on a Docker host using e.g. docker-compose.
22 |
23 |
24 |
25 | ## Exercise
26 |
27 | Start docker-compose with the three microservices
28 | that make up the sentences application.
29 |
30 | ### Step by step
31 |
32 |
33 | More details
34 |
35 | Open a terminal in the root of the git repository (helm-katas) and use `docker-compose up` to deploy the stack:
36 |
37 | - `docker-compose -f sentences-app/deploy/docker-compose.yaml up -d`
38 |
39 | Use the following command to request sentences
40 | from the sentences application:
41 |
42 | - `curl 127.0.0.1:8080`
43 | - Observe that you get something like
44 | `Eric is 66 years` back
45 |
46 |
47 |
48 | ## Running the Sentences Application on Kubernetes
49 |
50 | Now we would like to deploy the application into
51 | our cluster.
52 |
53 | ## Exercise
54 |
55 | ### Overview
56 |
57 | - Deploy the sentences application to Kubernetes
58 | - Test the deployed application
59 |
60 | ### Step by step
61 |
62 |
63 | More details
64 |
65 | **Deploy the sentences application to Kubernetes**
66 |
67 | - `kubectl apply -f sentences-app/deploy/kubernetes`
68 |
69 | This will create three microservice deployments
70 | with a single POD instance each.
71 |
72 | **Test the deployed application**
73 |
74 | - `kubectl get pods`
75 |
76 | > :bulb: The front-end microservice for the
77 | > sentences application is exposed with a
78 | > Kubernetes service of type `NodePort`.
79 |
80 | When all three PODs are in a running state, look
81 | up the actual NodePort used by the frontend
82 | microservice:
83 |
84 | - `kubectl get svc sentence`
85 |
86 | Output:
87 |
88 | ```shell
89 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
90 | sentences NodePort 10.15.245.208 8080:30250/TCP 37s
91 | ```
92 |
93 | In the example above, the relevant NodePort is
94 | `30250`.
95 |
96 | - look up an external accessible IP address that
97 | can be used to access the front-end
98 | microservice.
99 |
100 | - `kubectl get nodes -o wide`
101 |
102 | Any of the IP addresses from the
103 | `EXTERNAL-IP`-column can be used.
104 |
105 | To request a sentence from the sentences
106 | application, use curl with the external IP address
107 | and `NodePort` found above:
108 |
109 | - `curl :30250`
110 |
111 | Output:
112 |
113 | ```shell
114 | John is 73 years
115 | ```
116 |
117 | > :bulb: in the above example `30250` should be
118 | > changed with your nodeport found above
119 |
120 |
121 |
122 | ## Cleanup
123 |
124 | - `docker-compose -f sentences-app/deploy/docker-compose.yaml down`
125 | - `kubectl delete -f sentences-app/deploy/kubernetes/`
126 |
--------------------------------------------------------------------------------
/cheat-sheet.md:
--------------------------------------------------------------------------------
1 |
2 | # List of Helm Commands
3 |
4 | Use the commands listed below as a quick reference when working with Helm inside Kubernetes.
5 |
6 | ## Install and Uninstall Apps
7 |
8 | Install an app:
9 |
10 | `helm install [name] [chart]`
11 |
12 | Install an app in a specific namespace:
13 |
14 | `helm install [name] [chart] --namespace [namespace]`
15 |
16 | Override the default values with those specified in a file of your choice:
17 |
18 | `helm install [name] [chart] --values [yaml-file/url]`
19 |
20 | Run a test install to validate and verify the chart:
21 |
22 | `helm install [name] --dry-run --debug`
23 |
24 | Uninstall a release:
25 |
26 | `helm uninstall [release]`
27 |
28 | ## Perform App Upgrade and Rollback
29 |
30 | Helm offers users multiple options for app upgrades, such as automatic rollback and upgrading to a specific version. Rollbacks can also be executed on their own.
31 |
32 | Upgrade an app:
33 |
34 | `helm upgrade [release] [chart]`
35 |
36 | Instruct Helm to rollback changes if the upgrade fails:
37 |
38 | `helm upgrade [release] [chart] --atomic`
39 |
40 | Upgrade a release. If it does not exist on the system, install it:
41 |
42 | `helm upgrade [release] [chart] --install`
43 |
44 | Upgrade to a specified version:
45 |
46 | `helm upgrade [release] [chart] --version [version-number]`
47 |
48 | Roll back a release:
49 |
50 | `helm rollback [release] [revision]`
51 |
52 | ## Download Release Information
53 |
54 | The helm get command lets you download information about a release.
55 |
56 | Download all the release information:
57 |
58 | `helm get all [release]`
59 |
60 | Download all hooks:
61 |
62 | `helm get hooks [release]`
63 |
64 | Download the manifest:
65 |
66 | `helm get manifest [release]`
67 |
68 | Download the notes:
69 |
70 | `helm get notes [release]`
71 |
72 | Download the values file:
73 |
74 | `helm get values [release]`
75 |
76 | Fetch release history:
77 |
78 | `helm history [release] `
79 |
80 | ## Add, Remove, and Update Repositories
81 |
82 | The helm command helm repo helps you manipulate chart repositories.
83 |
84 | Add a repository from the internet:
85 |
86 | `helm repo add [name] [url]`
87 |
88 | Remove a repository from your system:
89 |
90 | `helm repo remove [name]`
91 |
92 | Update repositories:
93 |
94 | `helm repo update`
95 |
96 | ## List and Search Repositories
97 |
98 | Use the helm repo and helm search commands to list and search Helm repositories. Helm search also enables you to find apps and repositories in Artifact hub.
99 |
100 | List chart repositories:
101 |
102 | `helm repo list`
103 |
104 | Generate an index file containing charts found in the current directory:
105 |
106 | `helm repo index`
107 |
108 | Search charts for a keyword:
109 |
110 | `helm search [keyword]`
111 |
112 | Search repositories for a keyword:
113 |
114 | `helm search repo [keyword]`
115 |
116 | Search Helm Hub:
117 |
118 | `helm search hub [keyword]`
119 |
120 | ## Release Monitoring
121 |
122 | The helm list command enables listing releases in a Kubernetes cluster according to several criteria, including using regular (Pearl compatible) expressions to filter results. Commands such as helm status and helm history provide more details about releases.
123 |
124 | List all available releases in the current namespace:
125 |
126 | `helm list`
127 |
128 | List all available releases across all namespaces:
129 |
130 | `helm list --all-namespaces`
131 |
132 | List all releases in a specific namespace:
133 |
134 | `helm list --namespace [namespace]`
135 |
136 | List all releases in a specified output format:
137 |
138 | `helm list --output [format]`
139 |
140 | Apply a filter to the list of releases using regular expressions:
141 |
142 | `helm list --filter '[expression]'`
143 |
144 | See the status of a specific release:
145 |
146 | `helm status [release]`
147 |
148 | Display the release history:
149 |
150 | `helm history [release]`
151 |
152 | See information about the Helm client environment:
153 |
154 | `helm env`
155 |
156 | ## Chart Management
157 |
158 | Helm charts use Kubernetes resources to define an application.
159 |
160 | Create a directory containing the common chart files and directories (Chart.yaml, values.yaml, charts/ and templates/):
161 |
162 | `helm create [name]`
163 |
164 | Package a chart into a chart archive:
165 |
166 | `helm package [chart-path]`
167 |
168 | Run tests to examine a chart and identify possible issues:
169 |
170 | `helm lint [chart]`
171 |
172 | Inspect a chart and list its contents:
173 |
174 | `helm show all [chart]`
175 |
176 | Display the chart’s definition:
177 |
178 | `helm show chart [chart]`
179 |
180 | Display the chart’s values:
181 |
182 | `helm show values [chart]`
183 |
184 | Download a chart:
185 |
186 | `helm pull [chart]`
187 |
188 | Download a chart and extract the archive’s contents into a directory:
189 |
190 | `helm pull [chart] --untar --untardir [directory]`
191 |
192 | Display a list of a chart’s dependencies:
193 |
194 | `helm dependency list [chart]`
--------------------------------------------------------------------------------
/helm-and-helmsman.md:
--------------------------------------------------------------------------------
1 | # Helm and Helmsman
2 |
3 | > Note: this exercise is quite old, and might not work.
4 |
5 | This exercise will demonstrate a declarative approach to Helm chart installation
6 | using [Helmsman](https://github.com/Praqma/helmsman).
7 |
8 | ## Prerequisites
9 |
10 | This exercise assumes that the following repositories (or forks) have been
11 | cloned into a shared folder:
12 |
13 | ```
14 | https://github.com/eficode-academy/kubernetes-appdev-katas
15 | https://github.com/eficode-academy/k8s-sentences-sentence
16 | https://github.com/eficode-academy/k8s-sentences-age
17 | https://github.com/eficode-academy/k8s-sentences-name
18 | ```
19 |
20 | I.e. listing folders should produce output as follows:
21 |
22 | ```shell
23 | $ ls -l
24 | drwxr-xr-x 6 ubuntu ubuntu 4096 Jan 7 11:36 kubernetes-appdev-katas
25 | drwxr-xr-x 7 ubuntu ubuntu 4096 Jan 7 11:36 k8s-sentences-sentence
26 | drwxr-xr-x 7 ubuntu ubuntu 4096 Jan 7 11:36 k8s-sentences-age
27 | drwxr-xr-x 7 ubuntu ubuntu 4096 Jan 7 11:36 k8s-sentences-name
28 | ```
29 |
30 | Use the following commands to clone Praqma repositories or replace with your
31 | own forks if possible:
32 |
33 | ```shell
34 | $ cd ~
35 | $ git clone https://github.com/eficode-academy/k8s-sentences-sentence.git
36 | $ git clone https://github.com/eficode-academy/k8s-sentences-age.git
37 | $ git clone https://github.com/eficode-academy/k8s-sentences-name.git
38 | ```
39 |
40 | ## Deploying with Helmsman
41 |
42 | Go to the folder which holds our Helmsman specification for the three
43 | microservices that make up the sentences application.
44 |
45 | ```shell
46 | $ cd kubernetes-appdev-katas/sentences-app/deploy/helmsman/
47 | ```
48 |
49 | The `helmsman.yaml` file in this folder is an Helmsman [desired state
50 | file](https://github.com/Praqma/helmsman/blob/master/docs/desired_state_specification.md)
51 | which basically is a declarative specification of the Helm charts we want
52 | installed and the parameters we want changed from the defaults.
53 |
54 | ### Specify Target Namespace
55 |
56 | Helmsman can create Kubernetes namespaces. We will not use this features,
57 | however, Helmsman still need a list of namespaces which we will deploy
58 | applications into.
59 |
60 | In the `helmsman.yaml` file the application destination namespace is found in
61 | four places. First in the overall list of namespaces (note the trailing ':'):
62 |
63 | ```
64 | namespaces:
65 | default:
66 | ```
67 |
68 | and a namespace destination for each microservce - here an example for the age
69 | service:
70 |
71 | ```
72 | apps:
73 | age:
74 | ...
75 | namespace: default
76 | ```
77 |
78 | We want to deploy the sentence application to our own namespace. Investigate the
79 | name of your namespace with:
80 |
81 | ```shell
82 | $ kubectl config view | grep namespace
83 | ```
84 |
85 | and then modify the `helmsman.yaml` file to use your namespace (four instances
86 | to update).
87 |
88 | ### Deploy the Sentences Application
89 |
90 | Deploy the sentences microservices (the three Helm charts) to your namespace with the following command:
91 |
92 | ```shell
93 | $ helmsman -apply -f helmsman.yaml
94 | ```
95 |
96 | Since Helmsman waits for resources to be deployed and ready, the command may
97 | take a little while to complete.
98 |
99 | When Helmsman have deployed the Helm charts, the main service is exposed with a
100 | Kubernetes service of type `LoadBalancer`. Use the following command to get the
101 | IP address of that service and test the deployed application.
102 |
103 | ```shell
104 | $ kubectl get services
105 | ```
106 |
107 | ### Upgrade a Microservice of the Sentences Application
108 |
109 | The `helmsman.yaml` file specifies both the Helm chart version for each
110 | microservice and values that set both container image repository and tag.
111 |
112 | Edit the `helmsman.yaml` file and change some of the image
113 | repositories/tags. E.g. change the image repository to your own repository or
114 | use different tags for Praqma images. The following Praqma images have a
115 | special observable behavior:
116 |
117 | `releasepraqma/sentence:1.0-1fee` (swaps age and name in the generated sentences)
118 |
119 | After modifying the `helmsman.yaml`, re-run Helmsman to reconcile the
120 | application specification with the application deployed to Kubernetes:
121 |
122 | ```shell
123 | $ helmsman -apply -f helmsman.yaml
124 | ```
125 |
126 | To see, that Helmsman actually installs Helm charts, use the following command
127 | to show installed Helm charts:
128 |
129 | ```shell
130 | $ helm ls
131 | ```
132 |
133 | ### Optional Exercise
134 |
135 | The Sentences application was deployed with the frontend service exposed with a
136 | Kubernetes service of type `LoadBalancer`. Update the `helmsman.yaml` to expose
137 | the front-end service using a service of type `NodePort` instead, upgrade the
138 | deployment and test access to the sentences application using the nodeport
139 | service.
140 |
141 |
142 | ## Cleanup
143 |
144 | Delete the application installed with Helmsman:
145 |
146 | ```shell
147 | $ helmsman -destroy -f helmsman.yaml
148 | ```
149 |
--------------------------------------------------------------------------------
/intro-to-kubernetes-package-manager.md:
--------------------------------------------------------------------------------
1 | # The Kubernetes package manager
2 |
3 | ## Learning goal
4 |
5 | - Try the Helm cli to spin up a chart
6 |
7 | ## Introduction
8 |
9 | [Enter Helm](https://github.com/helm/helm) - the
10 | answer to how to package multi-container
11 | applications, and how to easily install packages
12 | on Kubernetes.
13 |
14 | Helm helps you to:
15 |
16 | - Achieve a simple (one command) and repeatable
17 | deployment
18 | - Manage application dependency, using specific
19 | versions of other application and services
20 | - Manage multiple deployment configurations: test,
21 | staging, production and others
22 | - Execute post/pre deployment jobs during
23 | application deployment
24 | - Update/rollback and test application deployments
25 |
26 | ## Using Helm charts
27 |
28 | Helm uses a packaging format called charts. A
29 | Chart is a collection of files that describe k8s
30 | resources.
31 |
32 | Charts can be simple, describing something like a
33 | standalone web server but they can also be more
34 | complex, for example, a chart that represents a
35 | full web application stack included web servers,
36 | databases, proxies, etc.
37 |
38 | Instead of installing k8s resources manually via
39 | kubectl, we can use Helm to install pre-defined
40 | Charts faster, with less chance of typos or other
41 | operator errors.
42 |
43 | When you install Helm, it does not have a
44 | connection to any default repositories. This is
45 | because Helm wants to decouple the application to
46 | the repository in use.
47 |
48 | One of the largest Chart Repositories is the
49 | [BitNami Chart Repository](https://charts.bitnami.com),
50 | which we will be using in these exercises.
51 |
52 | Helm chart repositories are very dynamic due to
53 | updates and new additions. To keep Helm's local
54 | list updated with all these changes, we need to
55 | occasionally run the
56 | [repository update](https://helm.sh/docs/helm/helm_repo_update/)
57 | command.
58 |
59 | ## Exercise
60 |
61 | ### Overview
62 |
63 | - Add a chart repository to your Helm cli
64 | - Install Nginx chart
65 | - Access the Nginx load balanced service
66 | - Look at the status of the deployment with
67 | `helm ls`
68 | - Clean up the chart deployment
69 |
70 | ### Step by step
71 |
72 |
73 | More details
74 |
75 | **Add a chart repository to your Helm cli**
76 |
77 | To install the Bitnami Helm Repo and update Helm's
78 | local list of Charts, run:
79 |
80 | ```shell
81 | helm repo add bitnami https://charts.bitnami.com/bitnami
82 | ```
83 | ```shell
84 | helm repo update
85 | ```
86 |
87 | **Install Nginx Chart**
88 |
89 | We use the Nginx chart because it is fast and easy to install, and allows us to access the Nginx webserver from our browser to verify that it was deployed.
90 |
91 | ```shell
92 | helm install my-release bitnami/nginx --version=15.0.0 --set service.type=NodePort
93 | ```
94 |
95 | This command creates a release called `my-release`
96 | with the bitnami/nginx chart.
97 |
98 | The command will output information about your
99 | newly deployed nginx setup similar to this:
100 |
101 | ```shell
102 | NAME: my-release
103 | LAST DEPLOYED: Wed Sep 27 09:21:48 2023
104 | NAMESPACE: student-3
105 | STATUS: deployed
106 | REVISION: 1
107 | TEST SUITE: None
108 | NOTES:
109 | CHART NAME: nginx
110 | CHART VERSION: 15.3.1
111 | APP VERSION: 1.25.2
112 |
113 | ** Please be patient while the chart is being deployed **
114 | NGINX can be accessed through the following DNS name from within your cluster:
115 |
116 | my-release-nginx.student-3.svc.cluster.local (port 80)
117 |
118 | To access NGINX from outside the cluster, follow the steps below:
119 |
120 | 1. Get the NGINX URL by running these commands:
121 |
122 | export NODE_PORT=$(kubectl get --namespace student-3 -o jsonpath="{.spec.ports[0].nodePort}" services my-release-nginx)
123 | export NODE_IP=$(kubectl get nodes --namespace student-3 -o jsonpath="{.items[0].status.addresses[0].address}")
124 | echo "http://${NODE_IP}:${NODE_PORT}"
125 |
126 | ```
127 |
128 | **Access the Nginx NodePort service**
129 |
130 | Get the external port of Nginx with the following commands:
131 |
132 | ```shell
133 | kubectl get services
134 | ```
135 | - Note down the external port of the Nginx service, it should be in the range of 30000-32767
136 |
137 | - Note down one of the external IP addresses of the nodes in the cluster
138 |
139 | ```shell
140 | kubectl get nodes -o wide
141 | ```
142 |
143 | result:
144 |
145 | ```shell
146 | NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
147 | ip-192-168-83-125.eu-north-1.compute.internal Ready 4h29m v1.26.8 192.168.83.125 13.51.165.230 Ubuntu 20.04.6 LTS 5.15.0-1045-aws cri-o://1.26.1
148 | ip-192-168-85-161.eu-north-1.compute.internal Ready 4h29m v1.26.8 192.168.85.161 13.53.106.222 Ubuntu 20.04.6 LTS 5.15.0-1045-aws cri-o://1.26.1
149 | ```
150 |
151 | - Open a browser and enter the IP address and port of the Nginx service, e.g. `http://:`
152 |
153 | **Look at the status of the deployment with `helm`
154 | and `kubectl`**
155 |
156 | Running `helm ls` will show all current
157 | deployments.
158 |
159 | - Run `helm ls` and observe that you have a
160 | release named `my-release`
161 | - Run `kubectl get pods,deployments,svc` and look
162 | at a few of the kubernetes objects the release
163 | created.
164 |
165 | > :bulb: As said before Helm deals with the
166 | > concept of
167 | > [charts](https://github.com/kubernetes/charts)
168 | > for its deployment logic. bitnami/nginx was a
169 | > chart,
170 | > [found here](https://github.com/bitnami/charts/tree/master/bitnami/nginx)
171 | > that describes how helm should deploy it. It
172 | > interpolates values into the deployment, which
173 | > for nginx looks
174 | > [like this](https://github.com/bitnami/charts/blob/master/bitnami/nginx/templates/deployment.yaml).
175 | > The charts describe which values can be given
176 | > for overwriting default behavior, and there is
177 | > an active community around it.
178 |
179 | **Clean up the chart deployment**
180 |
181 | To remove the `my-release` release run:
182 |
183 | ```shell
184 | helm uninstall my-release
185 | ```
186 |
187 |
188 |
--------------------------------------------------------------------------------
/sharing-charts.md:
--------------------------------------------------------------------------------
1 | # Packaging and sharing charts
2 |
3 | Note: This exercise requires that you have forked the GitHub repository to your own user, so you have administrative access.
4 |
5 | ## Learning goal
6 |
7 | - Packaging Helm charts
8 | - Use GitHub as a simple chart registry
9 | - Share your chart through GitHub
10 |
11 | ## Introduction
12 |
13 | > :bulb: Know that a Helm repository is nothing more than a simple HTTP server that can host Helm charts.
14 | > Helm charts consists of a .tar file and an index.yaml file.
15 | > As simple as that.
16 |
17 | ## Exercise
18 |
19 | The chart we will work with in this exercise is located in the sharing charts folder.
20 |
21 | ### Overview
22 |
23 | - Clone down the repository
24 | - Package your chart
25 | - Create index.html and push `gh-pages` branch to github
26 | - Create index.yaml and push `gh-pages` branch to github
27 | - Add the new repository to your Helm cli
28 |
29 | ### Step by step
30 |
31 |
32 | More details
33 |
34 | **Clone down the repository**
35 |
36 | - In the helm-katas folder, make a new folder with your github handle as your name.
37 | - Open a terminal into that folder, and clone down your forked repository.
38 |
39 | > :bulb: make sure that the repo you are cloning down is your own, and not the eficode-academy one. Yours will have a URL like the following: https://github.com/yourusername/helm-katas where `yourusername` is replaced with your username.
40 |
41 | **Package your chart**
42 |
43 | - Open a terminal in the `/helm-katas/sharing-charts` directory
44 | - Package your chart with `helm package sentence-app`
45 | - Move the package out to the root folder of your cloned repository
46 |
47 | > the path would be something like this: `/home/ubuntu/helm-katas/YourGHName/helm-katas`
48 |
49 | **Create index.html and push `gh-pages` branch to github**
50 |
51 | - Add an empty index.html file in the root: `touch index.html`
52 |
53 | > Note: this is for github to recognize this as a website and start serving it as content.
54 |
55 | - create a branch named `gh-pages` from the main branch, and check it out.
56 | - add the helm chart `.tgz` and the `index.html` to git, make a commit and push it to your new `gh-pages` branch.
57 |
58 | > Note: the VSCode instances used would like to login for you with OAuth. We therefore recommend you to use a dummy github account for this due to security considerations.
59 |
60 |
61 | :bulb: git help
62 |
63 | - Make sure you are in the folder `/home/ubuntu/helm-katas/YourGHName/helm-katas`
64 | - Create and check out a new branch called `gh-pages` by running: `git checkout -b gh-pages`
65 | - Type `git status` to see that you have two new files, your index file and the app in compressed format.
66 | - Add both files to git with with `git add index.html` and `git add sentence-app-0.1.0.tgz`
67 | - Commit both files with `git commit -m "made first gh page"`
68 | - Push them to Github with `git push --set-upstream origin gh-pages`
69 |
70 |
71 |
72 | - Go to the Settings tab of your Github repository and the `Pages` tab on the left. Here you will see a link, in the format like: https://UserName.github.io/helm-katas/.
73 | - Click the link to see a blank webpage, making sure that the page is served through github.
74 |
75 | **Create index.yaml and push `gh-pages` branch to github**
76 |
77 | - Use the `helm repo index` command to generate the `index.yaml` file: `helm repo index . --url https://
129 |
130 | > :bulb: if you have multiple charts in the same repo added at different times, you can merge new versions into the same index.yaml file using `--merge` flag. For more info visit the [documentation](https://helm.sh/docs/topics/chart_repository/#add-new-charts-to-an-existing-repository)
131 |
132 | > :bulb: there is a new way of sharing charts now; using Open Container Initiative format (OCI). In that way, your chart is saved in the same repository as your images. It is an experimental feature for now, but you can read up upon it (and instructions to try it out) in the [documentation](https://helm.sh/docs/topics/registries/#enabling-oci-support)
133 |
134 | ### Extra (optional)
135 |
136 | This is the "Manual" way of doing a helm chart repo, and it has several downsides:
137 |
138 | * It stores all versions of your charts in a packaged (binary) file in your git repo, creating a large repository to clone over time.
139 | * It right now is manually done, so it needs to be CI'ed in a pipeline to become really usefull.
140 |
141 | But there is another way, using the [releaser](https://helm.sh/docs/howto/chart_releaser_action/) tool.
142 |
143 | The guide linked to describes how to use Chart Releaser Action to automate releasing charts through GitHub pages. Chart Releaser Action is a GitHub Action workflow to turn a GitHub project into a self-hosted Helm chart repo, using helm/chart-releaser CLI tool.
144 |
145 | Have a look at how to set this up.
146 |
147 | ### Credits
148 |
149 | This exercise has been adapted from a medium blogpost by [Ravindra Singh](https://medium.com/xebia-engineering/how-to-share-helm-chart-via-helm-repository-4cbfc7b1df90).
150 |
--------------------------------------------------------------------------------
/create-a-helm-chart.md:
--------------------------------------------------------------------------------
1 | # Create an Helm Chart
2 |
3 | ## Learning goal
4 |
5 | - Create a basic Helm chart for the `sentences`
6 | application
7 |
8 | ## Introduction
9 |
10 | This exercise will create a simple Helm chart for
11 | the sentence application. The chart will be
12 | 'simple' in the sense that it will not provide
13 | support for customizing application parameters.
14 |
15 |
16 | More information
17 |
18 | In the `sentences-app/deploy/kubernetes/` folder
19 | we have Kubernetes YAML definitions for the three
20 | microservices that make up the sentence
21 | application (three Deployments and three
22 | Services):
23 |
24 | ```shell
25 | $ ls -1 sentences-app/deploy/kubernetes/
26 | sentences-age-deployment.yaml
27 | sentences-age-svc.yaml
28 | sentences-deployment.yaml
29 | sentences-name-deployment.yaml
30 | sentences-name-svc.yaml
31 | sentences-svc.yaml
32 | ```
33 |
34 |
35 |
36 | ## Exercise
37 |
38 | ### Overview
39 |
40 | - Running the sentences application on Kubernetes
41 | - Create a skeleton Helm chart
42 | - Copy `sentences` kubernetes yaml into the chart
43 | - Lint and deploy our new chart
44 |
45 | ### Step by step
46 |
47 |
48 | More details
49 |
50 | **Deploy the sentences application to Kubernetes**
51 |
52 | First, let's run the application in bare Kubernetes to see that our YAML is right.
53 |
54 | - `kubectl apply -f sentences-app/deploy/kubernetes`
55 |
56 | This will create three microservice deployments
57 | with a single POD instance each.
58 |
59 | **Test the deployed application**
60 |
61 | - `kubectl get pods`
62 |
63 | > :bulb: The front-end microservice for the
64 | > sentences application is exposed with a
65 | > Kubernetes service of type `NodePort`.
66 |
67 | When all three PODs are in a running state, look
68 | up the actual NodePort used by the frontend
69 | microservice:
70 |
71 | - `kubectl get svc sentence`
72 |
73 | Output:
74 |
75 | ```shell
76 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
77 | sentences NodePort 10.15.245.208 8080:30250/TCP 37s
78 | ```
79 |
80 | In the example above, the relevant NodePort is
81 | `30250`.
82 |
83 | - look up an external accessible IP address that
84 | can be used to access the front-end
85 | microservice.
86 |
87 | - `kubectl get nodes -o wide`
88 |
89 | Any of the IP addresses from the
90 | `EXTERNAL-IP`-column can be used.
91 |
92 | To request a sentence from the sentences
93 | application, use curl with the external IP address
94 | and `NodePort` found above:
95 |
96 | - `curl :`
97 |
98 | Output:
99 |
100 | ```shell
101 | John is 73 years
102 | ```
103 |
104 | > :bulb: in the above example `NodePort` should be
105 | > changed with your nodeport found above
106 |
107 | - Clean up the application deployed with `kubectl delete -f sentences-app/deploy/kubernetes/`
108 |
109 | **Create a skeleton Helm chart**
110 |
111 | First we create a new directory for our Helm chart, and then use the `helm create` command to create the chart skeleton:
112 |
113 | - `mkdir helm-chart`
114 | - `cd helm-chart`
115 | - `helm create sentence-app`
116 |
117 | The `helm create` command we just issued created a lot of files that you might want to use when creating a new Helm chart.
118 | We do not need all of those files for the chart we will be creating, therefore we will remove the files we do not need:
119 |
120 | - `rm -rf sentence-app/templates/*`
121 | - `echo "" > sentence-app/values.yaml`
122 |
123 | This provides us with skeleton chart without any
124 | template files.
125 |
126 | **Copy `sentences` kubernetes yaml into the
127 | chart**
128 |
129 | Next, we copy the original Kubernetes YAML files
130 | to the template folder:
131 |
132 | - `cp -v ../sentences-app/deploy/kubernetes/*.yaml sentence-app/templates/`
133 |
134 | That's it - now we have a Helm chart for our
135 | sentences application.
136 |
137 | > :bulb: It is a simple Helm chart in the sense
138 | > that it has no configurable values, but it is a
139 | > complete installable chart and it will use the
140 | > correct sentence application Kubernetes YAML
141 | > definitions.
142 |
143 | **Lint and deploy our new chart**
144 |
145 | Before deploying the chart, we run a static
146 | validation of it:
147 |
148 | - `helm lint sentence-app/`
149 |
150 | Running this command produces the following output:
151 |
152 | ```shell
153 | ==> Linting sentence-app/
154 | [INFO] Chart.yaml: icon is recommended
155 |
156 | 1 chart(s) linted, 0 chart(s) failed
157 | ```
158 |
159 | > :bulb: Normally a chart is fetched from a chart
160 | > registry (like a container registry), however, a
161 | > chart stored locally can also be deployed with
162 | > Helm.
163 |
164 | To deploy the chart from the newly created chart
165 | run the following:
166 |
167 | ```bash
168 | helm install sentences sentence-app/
169 | ```
170 |
171 | Running this command produces the following output:
172 |
173 | ```shell
174 | NAME: sentences
175 | LAST DEPLOYED: Wed Apr 21 10:43:55 2021
176 | NAMESPACE: user1
177 | STATUS: deployed
178 | REVISION: 1
179 | TEST SUITE: None
180 | ```
181 |
182 | To see all the different objects that Helm has
183 | created, use:
184 |
185 | ```shell
186 | kubectl get pods,services,deployments
187 | ```
188 |
189 | Expected output:
190 |
191 | ```shell
192 | NAME READY STATUS RESTARTS AGE
193 | pod/sentence-age-78fc854dd5-w9gdq 1/1 Running 0 64s
194 | pod/sentence-name-ff4c584b9-txp5n 1/1 Running 0 64s
195 | pod/sentences-746cc46db8-khp85 1/1 Running 0 64s
196 |
197 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
198 | service/age ClusterIP 10.191.240.60 8080/TCP 66s
199 | service/name ClusterIP 10.191.251.238 8080/TCP 66s
200 | service/sentence NodePort 10.191.245.72 8080:32665/TCP 66s
201 |
202 | NAME READY UP-TO-DATE AVAILABLE AGE
203 | deployment.apps/sentence-age 1/1 1 1 66s
204 | deployment.apps/sentence-name 1/1 1 1 66s
205 | deployment.apps/sentences 1/1 1 1 66s
206 | ```
207 |
208 | To see the applications installed with Helm use
209 | the `helm ls` operation:
210 |
211 | ```shell
212 | helm ls
213 | ```
214 |
215 | expected output:
216 |
217 | ```shell
218 | NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
219 | sentences user1 1 2021-04-21 10:43:55.789048706 +0000 UTC deployed sentence-app-0.1.0 1.16.0
220 | ```
221 |
222 | To see the Kubernetes YAML which Helm used to
223 | install the application use the `helm get`
224 | operation:
225 |
226 | ```shell
227 | helm get all sentences
228 | ```
229 |
230 | In our case this will be identical to the YAML
231 | files we copied previously since we haven't
232 | provided any means of customizing the application
233 | installation.
234 |
235 | Try to reach it again like we did with the raw kubernetes objects application to begin with.
236 |
237 | - Note down the NodePort from the service `kubectl get svc`
238 |
239 | Look up an external accessible IP address that can be used to access the front-end microservice.
240 |
241 | - `kubectl get nodes -o wide`
242 |
243 | Any of the IP addresses from the `EXTERNAL-IP`-column can be used.
244 |
245 | - `curl :` and see that your application is running once again.
246 |
247 | Output:
248 |
249 | ```shell
250 | John is 47 years
251 | ```
252 |
253 |
254 |
255 | ## Food for Thought
256 |
257 | In this exercise we created a single Helm chart
258 | for the complete application even though it is based
259 | on three microservices. When would it make sense
260 | to have a Helm chart for each microservice?
261 |
262 | ## Cleanup
263 |
264 | Uninstall the application release with Helm:
265 |
266 | ```shell
267 | helm uninstall sentences
268 | ```
269 |
--------------------------------------------------------------------------------
/sentences-app/dashboard.json:
--------------------------------------------------------------------------------
1 | {
2 | "annotations": {
3 | "list": [
4 | {
5 | "builtIn": 1,
6 | "datasource": "-- Grafana --",
7 | "enable": true,
8 | "hide": true,
9 | "iconColor": "rgba(0, 211, 255, 1)",
10 | "name": "Annotations & Alerts",
11 | "type": "dashboard"
12 | }
13 | ]
14 | },
15 | "editable": true,
16 | "gnetId": null,
17 | "graphTooltip": 0,
18 | "id": 1,
19 | "links": [],
20 | "panels": [
21 | {
22 | "aliasColors": {},
23 | "bars": false,
24 | "dashLength": 10,
25 | "dashes": false,
26 | "fill": 1,
27 | "gridPos": {
28 | "h": 9,
29 | "w": 12,
30 | "x": 0,
31 | "y": 0
32 | },
33 | "id": 2,
34 | "legend": {
35 | "avg": false,
36 | "current": false,
37 | "max": false,
38 | "min": false,
39 | "show": true,
40 | "total": false,
41 | "values": false
42 | },
43 | "lines": true,
44 | "linewidth": 1,
45 | "links": [],
46 | "nullPointMode": "null",
47 | "options": {},
48 | "percentage": false,
49 | "pointradius": 2,
50 | "points": false,
51 | "renderer": "flot",
52 | "seriesOverrides": [],
53 | "spaceLength": 10,
54 | "stack": false,
55 | "steppedLine": false,
56 | "targets": [
57 | {
58 | "expr": "sum(rate(sentence_requests_total[3m])) by (type)",
59 | "format": "time_series",
60 | "intervalFactor": 1,
61 | "legendFormat": "{{type}}",
62 | "refId": "A"
63 | }
64 | ],
65 | "thresholds": [],
66 | "timeFrom": null,
67 | "timeRegions": [],
68 | "timeShift": null,
69 | "title": "Requests/s",
70 | "tooltip": {
71 | "shared": true,
72 | "sort": 0,
73 | "value_type": "individual"
74 | },
75 | "type": "graph",
76 | "xaxis": {
77 | "buckets": null,
78 | "mode": "time",
79 | "name": null,
80 | "show": true,
81 | "values": []
82 | },
83 | "yaxes": [
84 | {
85 | "format": "short",
86 | "label": null,
87 | "logBase": 1,
88 | "max": null,
89 | "min": null,
90 | "show": true
91 | },
92 | {
93 | "format": "short",
94 | "label": null,
95 | "logBase": 1,
96 | "max": null,
97 | "min": null,
98 | "show": true
99 | }
100 | ],
101 | "yaxis": {
102 | "align": false,
103 | "alignLevel": null
104 | }
105 | },
106 | {
107 | "aliasColors": {},
108 | "bars": false,
109 | "dashLength": 10,
110 | "dashes": false,
111 | "fill": 1,
112 | "gridPos": {
113 | "h": 8,
114 | "w": 12,
115 | "x": 12,
116 | "y": 0
117 | },
118 | "id": 6,
119 | "legend": {
120 | "avg": false,
121 | "current": false,
122 | "max": false,
123 | "min": false,
124 | "show": true,
125 | "total": false,
126 | "values": false
127 | },
128 | "lines": true,
129 | "linewidth": 1,
130 | "links": [],
131 | "nullPointMode": "null",
132 | "options": {},
133 | "percentage": false,
134 | "pointradius": 2,
135 | "points": false,
136 | "renderer": "flot",
137 | "seriesOverrides": [],
138 | "spaceLength": 10,
139 | "stack": false,
140 | "steppedLine": false,
141 | "targets": [
142 | {
143 | "expr": "count(sentence_requests_total) by (type)",
144 | "format": "time_series",
145 | "intervalFactor": 1,
146 | "legendFormat": "{{type}}",
147 | "refId": "A"
148 | }
149 | ],
150 | "thresholds": [],
151 | "timeFrom": null,
152 | "timeRegions": [],
153 | "timeShift": null,
154 | "title": "POD count",
155 | "tooltip": {
156 | "shared": true,
157 | "sort": 0,
158 | "value_type": "individual"
159 | },
160 | "type": "graph",
161 | "xaxis": {
162 | "buckets": null,
163 | "mode": "time",
164 | "name": null,
165 | "show": true,
166 | "values": []
167 | },
168 | "yaxes": [
169 | {
170 | "decimals": 0,
171 | "format": "short",
172 | "label": null,
173 | "logBase": 1,
174 | "max": null,
175 | "min": null,
176 | "show": true
177 | },
178 | {
179 | "format": "short",
180 | "label": null,
181 | "logBase": 1,
182 | "max": null,
183 | "min": null,
184 | "show": true
185 | }
186 | ],
187 | "yaxis": {
188 | "align": false,
189 | "alignLevel": null
190 | }
191 | },
192 | {
193 | "aliasColors": {},
194 | "bars": false,
195 | "dashLength": 10,
196 | "dashes": false,
197 | "fill": 1,
198 | "gridPos": {
199 | "h": 8,
200 | "w": 12,
201 | "x": 0,
202 | "y": 9
203 | },
204 | "id": 4,
205 | "legend": {
206 | "avg": false,
207 | "current": false,
208 | "max": false,
209 | "min": false,
210 | "show": true,
211 | "total": false,
212 | "values": false
213 | },
214 | "lines": true,
215 | "linewidth": 1,
216 | "links": [],
217 | "nullPointMode": "null",
218 | "options": {},
219 | "percentage": false,
220 | "pointradius": 2,
221 | "points": false,
222 | "renderer": "flot",
223 | "seriesOverrides": [],
224 | "spaceLength": 10,
225 | "stack": false,
226 | "steppedLine": false,
227 | "targets": [
228 | {
229 | "expr": "sum(rate (container_cpu_usage_seconds_total{pod_name=~\"age.*\", image!=\"\"}[3m]))",
230 | "format": "time_series",
231 | "intervalFactor": 1,
232 | "legendFormat": "age",
233 | "refId": "B"
234 | },
235 | {
236 | "expr": "sum(rate (container_cpu_usage_seconds_total{pod_name=~\"name.*\", image!=\"\"}[3m]))",
237 | "format": "time_series",
238 | "intervalFactor": 1,
239 | "legendFormat": "name",
240 | "refId": "A"
241 | },
242 | {
243 | "expr": "sum(rate (container_cpu_usage_seconds_total{pod_name=~\"sentence.*\", image!=\"\"}[3m]))",
244 | "format": "time_series",
245 | "intervalFactor": 1,
246 | "legendFormat": "sentence",
247 | "refId": "C"
248 | }
249 | ],
250 | "thresholds": [],
251 | "timeFrom": null,
252 | "timeRegions": [],
253 | "timeShift": null,
254 | "title": "POD CPU usage",
255 | "tooltip": {
256 | "shared": true,
257 | "sort": 0,
258 | "value_type": "individual"
259 | },
260 | "type": "graph",
261 | "xaxis": {
262 | "buckets": null,
263 | "mode": "time",
264 | "name": null,
265 | "show": true,
266 | "values": []
267 | },
268 | "yaxes": [
269 | {
270 | "format": "short",
271 | "label": null,
272 | "logBase": 1,
273 | "max": null,
274 | "min": null,
275 | "show": true
276 | },
277 | {
278 | "format": "short",
279 | "label": null,
280 | "logBase": 1,
281 | "max": null,
282 | "min": null,
283 | "show": true
284 | }
285 | ],
286 | "yaxis": {
287 | "align": false,
288 | "alignLevel": null
289 | }
290 | }
291 | ],
292 | "refresh": "5s",
293 | "schemaVersion": 18,
294 | "style": "dark",
295 | "tags": [],
296 | "templating": {
297 | "list": []
298 | },
299 | "time": {
300 | "from": "now-5m",
301 | "to": "now"
302 | },
303 | "timepicker": {
304 | "refresh_intervals": [
305 | "5s",
306 | "10s",
307 | "30s",
308 | "1m",
309 | "5m",
310 | "15m",
311 | "30m",
312 | "1h",
313 | "2h",
314 | "1d"
315 | ],
316 | "time_options": [
317 | "5m",
318 | "15m",
319 | "1h",
320 | "6h",
321 | "12h",
322 | "24h",
323 | "2d",
324 | "7d",
325 | "30d"
326 | ]
327 | },
328 | "timezone": "",
329 | "title": "Sentences dashboard",
330 | "uid": "lQ4U2LSZk",
331 | "version": 1
332 | }
333 |
--------------------------------------------------------------------------------
/helm-chart-conditionals.md:
--------------------------------------------------------------------------------
1 | # Helm Chart Conditionals and Control Flow
2 |
3 | ## Learning Goals
4 |
5 | - Use Helm control flow and conditionals
6 | - Use if statements
7 | - Use equality operators
8 |
9 | ## Introduction
10 |
11 | Sometimes we want to do different things in our templates depending on how our deployment is to be configured.
12 |
13 | For example we might want to specify a specific port to use for a NodePort service, but only if the service is of type NodePort.
14 |
15 | To achieve this we can use conditionals and control flow in our Helm code.
16 |
17 | ### Helm Control Flow and Conditionals
18 |
19 | Helm has support for simple control flow using conditionals:
20 |
21 | The simplest form is an `if` statement:
22 |
23 | ```
24 | {{ if }}
25 | # do something
26 | {{ end }}
27 | ```
28 | > :bulb: We write `` here to indicate that the argument for the conditional can be as simple or complicated as needed.
29 |
30 | > :bulb: Referencing a value is implcitly a valid pipeline!
31 |
32 | A pipeline is evaluated as false if it returns:
33 | - a boolean `false`
34 | - a numeric zero `0`
35 | - an empty string `""`
36 | - an empty or null `nil`
37 | - an empty collection `[] {} ()`
38 |
39 | **All other cases are evaluated as true!**
40 |
41 | Let's look at an example:
42 | ```
43 | {{ if .Values.myVal }}
44 | myValPresent: true
45 | {{ end }}
46 | ```
47 | In the above example the string `myValPresent: true` is returned if the value `.Values.myVal` has been specified.
48 |
49 | We can add an `else` statement:
50 |
51 | ```
52 | {{ if .Values.myVal }}
53 | myValPresent: true
54 | {{ else }}
55 | myValPresent: false
56 | {{ end }}
57 | ```
58 | In which case, if `.Values.myVal` is not set, the string `myValPresent: false` will be returned.
59 |
60 | We can also use `else if` if we have multiple conditions:
61 |
62 | ```
63 | {{ if .Values.myVal }}
64 | myValPresent: true
65 | {{ else if .Values.myOtherVal }}
66 | myOtherValPresent: true
67 | {{ else }}
68 | myValPresent: false
69 | {{ end }}
70 | ```
71 |
72 | [Control flow documentation](https://helm.sh/docs/chart_template_guide/control_structures/)
73 |
74 | Helm has a number of functions that can be used in the conditionals like `and` and `eq`.
75 |
76 | We can use the `eq` or 'equals' function to check if a value matches another predefined value:
77 | ```
78 | {{ eq .Values.myVal "MatchThis" }}
79 | ```
80 |
81 | We can even use these as arguments to other functions like the `and` function, which returns true if both of it's arguments are true:
82 |
83 | ```
84 | {{ and (eq .Values.myVal "MatchThis") .Values.myOtherVal }}
85 | ```
86 |
87 | The above example will return true if both: the `eq` function returns true, and the `.Values.myOtherVal` is present.
88 |
89 | We could even use the above `and` example as the conditional for an `if` statement:
90 |
91 | ```
92 | {{ if and (eq .Values.myVal "MatchThis") .Values.myOtherVal }}
93 | # do something
94 | {{ end }}
95 | ```
96 |
97 | There are a number of functions available that you can use to control the flow of your templates: [Control flow functions documentation](https://helm.sh/docs/chart_template_guide/function_list/#logic-and-flow-control-functions)
98 |
99 | ## Exercise
100 |
101 | In this exercise we will conditionally specify which nodePort our sentences service should use, and only insert the value, if the service type is NodePort.
102 |
103 | ### Overview
104 |
105 | - Make the sentences service type parameterized
106 | - Conditionally specify which nodePort to use
107 | - Only insert the nodePort if service type is NodePort
108 |
109 | You can use your Helm chart from the previous exercise as the starting point for this exercise.
110 | Alternatively there is a Helm chart that picks up from the last exercise in `helm-katas/helm-chart-conditionals/start` that you can use.
111 | If you get stuck, or you want to see how the final chart looks, there is a solved version of the chart in `helm-katas/helm-chart-conditionals/done`.
112 |
113 | ### Step-by-Step
114 |
115 |
116 | Steps:
117 |
118 | **Make the sentences service type parameterized**
119 |
120 | First let's have a look at the sentences service template, the file is located in `sentence-app/templates/sentences-svc.yaml`
121 |
122 | The type and ports for the service are hard-coded in the service template.
123 |
124 | - Let's make the type a parameter:
125 |
126 | ```yaml
127 | apiVersion: v1
128 | kind: Service
129 | ...
130 | spec:
131 | ...
132 | type: {{ .Values.sentences.service.type }}
133 | ```
134 |
135 | - Add the type to your `values.yaml`:
136 |
137 | ```yaml
138 | sentences:
139 | ...
140 | service:
141 | type: ClusterIP
142 | ```
143 |
144 | - Let's try to render the service template:
145 |
146 | ```sh
147 | $ helm template sentence-app --show-only templates/sentences-svc.yaml
148 | ---
149 | # Source: sentence-app/templates/sentences-svc.yaml
150 | apiVersion: v1
151 | kind: Service
152 | ...
153 | spec:
154 | ...
155 | type: ClusterIP
156 | ```
157 |
158 | Sweet, that works.
159 |
160 | - Let's try to change the `type` in your `values.yaml` to `NodePort`.
161 |
162 | - Render the template again, and verify that it is now set to `NodePort`.
163 |
164 | **Conditionally specify which nodePort to use**
165 |
166 | When using the `NodePort` service type, Kubernetes allows us to specify which port we would like to use.
167 | This argument is only relevant when using the `NodePort` service type, so let's make conditional that only adds the `nodePort` key if the value is set.
168 |
169 | > :bulb: Note the difference in case for `NodePort` and `nodePort`.
170 |
171 | - Choose a random number between 30000 and 32767 and add it as the `nodePort` in your `values.yaml`:
172 |
173 | > :bulb: the range `30000-32767` is the default range for NodePorts in Kubernetes.
174 | > Only one service can occupy a specific port at a time, therefore if you are multiple people doing the exercises together, then everyone must choose a unique port, so as not to conflict.
175 | > [You click here if you need inspiration for your unique port number](https://www.randomlists.com/random-numbers?dup=false&qty=1&max=32767&min=30000)
176 | > In the example we will use `31234`, but you should choose a different one.
177 |
178 | ```yaml
179 | sentences:
180 | ...
181 | service:
182 | type: NodePort
183 | nodePort: 31234
184 | ```
185 |
186 | - Add the conditional to the `ports` map of the service spec in your sentences service template:
187 |
188 | ```yaml
189 | apiVersion: v1
190 | kind: Service
191 | ...
192 | spec:
193 | ports:
194 | - port: 8080
195 | protocol: TCP
196 | targetPort: 8080
197 | {{- if .Values.sentences.service.nodePort }}
198 | nodePort: {{ .Values.sentences.service.nodePort }}
199 | {{- end }}
200 | ...
201 | type: {{ .Values.sentences.service.type }}
202 | ```
203 |
204 | > :bulb: Notice the use of `{{-` to remove whitespace around the injected value in the if statement.
205 |
206 | Now the `nodePort` key will be inserted if the key is set.
207 |
208 | - Render the template:
209 |
210 | ```sh
211 | helm template sentence-app --show-only templates/sentences-svc.yaml
212 | ---
213 | # Source: sentence-app/templates/sentences-svc.yaml
214 | apiVersion: v1
215 | kind: Service
216 | metadata:
217 | ...
218 | spec:
219 | ports:
220 | - port: 8080
221 | protocol: TCP
222 | targetPort: 8080
223 | nodePort: 31234
224 | ...
225 | ```
226 |
227 | - Try to comment out the `nodePort` in your values file and render the template again:
228 |
229 | ```yaml
230 | sentences:
231 | ...
232 | service:
233 | type: ClusterIP
234 | # nodePort: 31234
235 | ```
236 |
237 | When we render the template again the `nodePort` will not be shown, as the value is not set, which means the if statement is false.
238 |
239 | ```sh
240 | helm template sentence-app --show-only templates/sentences-svc.yaml
241 | ---
242 | # Source: sentence-app/templates/sentences-svc.yaml
243 | apiVersion: v1
244 | kind: Service
245 | metadata:
246 | ...
247 | spec:
248 | ports:
249 | - port: 8080
250 | protocol: TCP
251 | targetPort: 8080
252 | ...
253 | ```
254 |
255 | - Uncomment the `nodePort` line in your values file.
256 |
257 | **Only insert the nodePort if service type is NodePort**
258 |
259 | As we stated in the beginning of the exercise the `nodePort` key is only used if the service type is `NodePort`.
260 | So we can add an extra condition to our service, so that the `nodePort` key is only used if the service is indeed set to `NodePort`.
261 |
262 | To do this we will use the `and` function.
263 |
264 | The `and` function takes two arguments, both of which must be true:
265 |
266 | ```yaml
267 | {{ and }}
268 | ```
269 |
270 | An argument can be the result of another function or pipeline of functions.
271 | These must be placed in parentheses.
272 |
273 | We can use the `eq` or 'equals' function to check that the service is type is "NodePort":
274 |
275 | ```yaml
276 | {{ eq .Values.MyValue "MyValue" }}
277 | ```
278 |
279 | When we put it all together we get an if statement, where the condition is the `and` function, where the first of the arguments to the `and` function is the `eq` function that checks if the service type is `NodePort` and the second argument is a check that the `nodePort` value has been set.
280 |
281 | ```yaml
282 | {{ if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
283 | ```
284 |
285 | Thus only when both conditions are met, the value will be inserted.
286 |
287 | - Edit your service file with the new if statement:
288 |
289 | ```yaml
290 | apiVersion: v1
291 | kind: Service
292 | ...
293 | spec:
294 | ports:
295 | - port: 8080
296 | protocol: TCP
297 | targetPort: 8080
298 | {{- if and (eq .Values.sentences.service.type "NodePort") .Values.sentences.service.nodePort }}
299 | nodePort: {{ .Values.sentences.service.nodePort }}
300 | {{- end }}
301 | ...
302 | type: {{ .Values.sentences.service.type }}
303 | ```
304 |
305 | - Try to render the template:
306 |
307 | ```sh
308 | $ helm template sentence-app --show-only templates/sentences-svc.yaml
309 | ---
310 | # Source: sentence-app/templates/sentences-svc.yaml
311 | apiVersion: v1
312 | kind: Service
313 | ...
314 | spec:
315 | ports:
316 | - port: 8080
317 | protocol: TCP
318 | targetPort: 8080
319 | nodePort: 31234
320 | ...
321 | type: NodePort
322 | ```
323 |
324 | - Try to change the type back to `ClusterIP` in the values file, and render the template again:
325 |
326 | ```sh
327 | $ helm template sentence-app --show-only templates/sentences-svc.yaml
328 | ---
329 | # Source: sentence-app/templates/sentences-svc.yaml
330 | apiVersion: v1
331 | kind: Service
332 | ...
333 | spec:
334 | ports:
335 | - port: 8080
336 | protocol: TCP
337 | targetPort: 8080
338 | ...
339 | type: ClusterIP
340 | ```
341 |
342 | So that we can verify that the `nodePort` key is only added when the `type` is set to `NodePort`.
343 |
344 |
345 |
--------------------------------------------------------------------------------