From 7f85cb960eab1679347a54bcb7b25b6a07a8dd45 Mon Sep 17 00:00:00 2001 From: Nikolay Nechaev Date: Fri, 12 Apr 2024 17:34:42 +0300 Subject: [PATCH] Lab 11, bonus task --- k8s/app-go/templates/_helpers.tpl | 7 +++++++ k8s/app-go/templates/deployment.yaml | 2 ++ k8s/app-go/values.yaml | 12 ++++++------ k8s/app-py/templates/_helpers.tpl | 7 +++++++ k8s/app-py/templates/deployment.yaml | 1 + k8s/app-py/values.yaml | 12 ++++++------ 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/k8s/app-go/templates/_helpers.tpl b/k8s/app-go/templates/_helpers.tpl index 5eb8a04b68..43215a32ff 100644 --- a/k8s/app-go/templates/_helpers.tpl +++ b/k8s/app-go/templates/_helpers.tpl @@ -60,3 +60,10 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{- define "app-go.environ" -}} +- name: var1 + value: val1 +- name: var2 + value: val2 +{{- end }} diff --git a/k8s/app-go/templates/deployment.yaml b/k8s/app-go/templates/deployment.yaml index 466839093c..57e368e236 100644 --- a/k8s/app-go/templates/deployment.yaml +++ b/k8s/app-go/templates/deployment.yaml @@ -50,6 +50,8 @@ spec: volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} + env: + {{ include "app-go.environ" . | nindent 12 }} {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} diff --git a/k8s/app-go/values.yaml b/k8s/app-go/values.yaml index f5da900ee3..14a6b3f2bb 100644 --- a/k8s/app-go/values.yaml +++ b/k8s/app-go/values.yaml @@ -51,17 +51,17 @@ ingress: # hosts: # - chart-example.local -resources: {} +resources: # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: + limits: # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + memory: 50Mi + requests: + cpu: 2000m + memory: 20Mi livenessProbe: httpGet: diff --git a/k8s/app-py/templates/_helpers.tpl b/k8s/app-py/templates/_helpers.tpl index 5eb8a04b68..8d9ce31df4 100644 --- a/k8s/app-py/templates/_helpers.tpl +++ b/k8s/app-py/templates/_helpers.tpl @@ -60,3 +60,10 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{- define "app-py.environ" -}} +- name: var1 + value: val1 +- name: var2 + value: val2 +{{- end }} diff --git a/k8s/app-py/templates/deployment.yaml b/k8s/app-py/templates/deployment.yaml index 45eeeabf3b..86be3e5805 100644 --- a/k8s/app-py/templates/deployment.yaml +++ b/k8s/app-py/templates/deployment.yaml @@ -56,6 +56,7 @@ spec: secretKeyRef: name: env-secret key: value + {{ include "app-py.environ" . | nindent 12 }} {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} diff --git a/k8s/app-py/values.yaml b/k8s/app-py/values.yaml index 217657fdd9..db65125736 100644 --- a/k8s/app-py/values.yaml +++ b/k8s/app-py/values.yaml @@ -55,17 +55,17 @@ ingress: # hosts: # - chart-example.local -resources: {} +resources: # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: + limits: # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + memory: 60Mi + requests: + cpu: 2000m + memory: 30Mi livenessProbe: httpGet: