From ec600d43c3e6397f6ac450b7ea99552d1f671aab Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 17:02:05 +0300 Subject: [PATCH 1/6] solution --- .infrastructure/helm-chart/todoapp/Chart.yaml | 8 ++ .../todoapp/charts/mysql/Chart.yaml | 24 +++++ .../charts/mysql/templates/configMap.yml | 15 ++++ .../todoapp/charts/mysql/templates/ns.yml | 4 + .../todoapp/charts/mysql/templates/secret.yml | 10 +++ .../charts/mysql/templates/service.yml | 17 ++++ .../charts/mysql/templates/statefulSet.yml | 89 +++++++++++++++++++ .../todoapp/charts/mysql/values.yaml | 34 +++++++ .../todoapp/templates/clusterIp.yml | 13 +++ .../todoapp/templates/configMap.yml | 7 ++ .../todoapp/templates/deployment.yml | 86 ++++++++++++++++++ .../helm-chart/todoapp/templates/hpa.yml | 25 ++++++ .../helm-chart/todoapp/templates/ingress.yml | 18 ++++ .../helm-chart/todoapp/templates/nodeport.yml | 14 +++ .../helm-chart/todoapp/templates/ns.yml | 4 + .../helm-chart/todoapp/templates/pv.yml | 14 +++ .../helm-chart/todoapp/templates/pvc.yml | 13 +++ .../helm-chart/todoapp/templates/secret.yml | 10 +++ .../helm-chart/todoapp/values.yaml | 55 ++++++++++++ README.md | 62 ++++++++----- bootstrap.sh | 33 +++---- output.log | 75 ++++++++++++++++ 22 files changed, 591 insertions(+), 39 deletions(-) create mode 100644 .infrastructure/helm-chart/todoapp/Chart.yaml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml create mode 100644 .infrastructure/helm-chart/todoapp/charts/mysql/values.yaml create mode 100644 .infrastructure/helm-chart/todoapp/templates/clusterIp.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/configMap.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/deployment.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/hpa.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/ingress.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/nodeport.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/ns.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/pv.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/pvc.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/secret.yml create mode 100644 .infrastructure/helm-chart/todoapp/values.yaml create mode 100644 output.log diff --git a/.infrastructure/helm-chart/todoapp/Chart.yaml b/.infrastructure/helm-chart/todoapp/Chart.yaml new file mode 100644 index 0000000..587faa1 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: todoapp +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "1.16.0" +dependencies: + - name: mysql diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml new file mode 100644 index 0000000..e65c7a0 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: mysql +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml new file mode 100644 index 0000000..f20dbd9 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.mysql.namespace }} + labels: + app: {{ .Chart.Name }} +data: + init.sql: | + GRANT ALL PRIVILEGES ON app_db.* TO 'app_user'@'%'; + USE app_db; + CREATE TABLE counter ( + id INT AUTO_INCREMENT PRIMARY KEY, + value INT + ); diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml new file mode 100644 index 0000000..71fc563 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.mysql.namespace }} \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml new file mode 100644 index 0000000..30de47d --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Chart.Name }}-secrets + namespace: {{ .Values.mysql.namespace }} +type: Opaque +data: + {{- range $k, $v := .Values.mysql.secrets.data }} + {{ $k }}: {{ $v | quote }} + {{- end }} \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml new file mode 100644 index 0000000..d12f94d --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml @@ -0,0 +1,17 @@ +# Headless service for stable DNS entries of StatefulSet members. +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.mysql.namespace }} +spec: + selector: + app: {{ .Chart.Name }} + ports: + - name: {{ .Chart.Name }} + port: 3306 + clusterIP: None + +# pod-name.service-name.namespace.svc.cluster.local +# pod-name.service-name +# mysql-0.mysql.mysql.svc.cluster.local \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml new file mode 100644 index 0000000..fbc282a --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.mysql.namespace }} +spec: + selector: + matchLabels: + app: {{ .Chart.Name }} + replicas: {{ .Values.mysql.replicas }} + serviceName: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + containers: + - name: {{ .Values.mysql.image.name }} + image: {{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.version }} + env: + {{- range $k, $v := .Values.mysql.secrets.data }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: {{ $.Chart.Name }}-secret + key: {{ $k }} + {{- end }} + - name: MYSQL_DATABASE + value: app_db + ports: + - name: {{ .Chart.Name }} + containerPort: 3306 + volumeMounts: + - name: data + mountPath: /var/lib/mysql + subPath: {{ .Chart.Name }} + - name: config-map + mountPath: /docker-entrypoint-initdb.d + resources: + requests: + cpu: {{ .Values.mysql.resources.requests.cpu }} + memory: {{ .Values.mysql.resources.requests.memory }} + livenessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + readinessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: 5 + periodSeconds: 2 + timeoutSeconds: 1 + volumes: + - name: config-map + configMap: + name: {{ .Chart.Name }} + tolerations: + - key: "app" + operator: "Equal" + value: "mysql" + effect: "NoSchedule" + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: {{ .Values.mysql.affinity.podAffinity.key }} + operator: In + values: + - {{ .Values.mysql.affinity.podAffinity.values }} + topologyKey: "kubernetes.io/hostname" + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .Values.mysql.affinity.nodeAffinity.key }} + operator: In + values: + - {{ .Values.mysql.affinity.nodeAffinity.values }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: {{ .Values.mysql.volumeClaimTemplates.resources.requests.storage }} diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml b/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml new file mode 100644 index 0000000..9d7380a --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml @@ -0,0 +1,34 @@ +mysql: + + namespace: mysql + + secrets: + data: + MYSQL_ROOT_PASSWORD: "MTIzNA==" # Base64 encoding for "1234" + MYSQL_USER: "YXBwX3VzZXI=" # Base64 encoding for "app_user" + MYSQL_PASSWORD: "MTIzNA==" # Base64 encoding for "1234" + + image: + name: mysql + repository: mysql + version: "8.0" + + replicas: 2 + + resources: + requests: + cpu: 500m + memory: 1Gi + + volumeClaimTemplates: + resources: + requests: + storage: 2Gi + + affinity: + podAffinity: + key: "app" + value: "mysql" + nodeAffinity: + key: "app" + value: "mysql" \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml b/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml new file mode 100644 index 0000000..b56d1b2 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-service + namespace: {{ .Values.todoapp.namespace }} +spec: + type: ClusterIP + selector: + app: {{ .Chart.Name }} + ports: + - protocol: TCP + port: 80 + targetPort: 8080 diff --git a/.infrastructure/helm-chart/todoapp/templates/configMap.yml b/.infrastructure/helm-chart/todoapp/templates/configMap.yml new file mode 100644 index 0000000..58491c4 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/configMap.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Chart.Name }}-config + namespace: {{ .Values.todoapp.namespace }} +data: + PYTHONUNBUFFERED: "1" \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/deployment.yml b/.infrastructure/helm-chart/todoapp/templates/deployment.yml new file mode 100644 index 0000000..d7d1323 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/deployment.yml @@ -0,0 +1,86 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} + namespace: {{ .Values.todoapp.namespace }} +spec: + strategy: + type: {{ .Values.todoapp.strategy.type }} + rollingUpdate: + maxSurge: {{ .Values.todoapp.strategy.rollingUpdate.maxSurge }} + maxUnavailable: {{ .Values.todoapp.strategy.rollingUpdate.maxUnavailable }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + serviceAccountName: {{ .Values.todoapp.serviceAccount.name }} + containers: + - name: {{ .Values.todoapp.image.name }} + image: {{ .Values.todoapp.image.repository }}:{{ .Values.todoapp.image.version }} + volumeMounts: + - name: data + mountPath: /app/data + - name: app-secrets-volume + mountPath: "/app/secrets" + readOnly: true + - name: app-config-volume + mountPath: "/app/configs" + readOnly: true + resources: + requests: + memory: {{ .Values.todoapp.resources.requests.memory }} + cpu: {{ .Values.todoapp.resources.requests.cpu }} + limits: + memory: {{ .Values.todoapp.resources.limits.memory }} + cpu: {{ .Values.todoapp.resources.limits.cpu }} + env: + {{- range $k, $v := .Values.todoapp.secrets.data }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: {{ $.Chart.Name }}-secret + key: {{ $k }} + {{- end }} + - name: PYTHONUNBUFFERED + valueFrom: + configMapKeyRef: + name: {{ .Chart.Name }}-config + key: PYTHONUNBUFFERED + ports: + - containerPort: 8080 + livenessProbe: + httpGet: + path: api/health + port: 8080 + initialDelaySeconds: 60 + periodSeconds: 5 + readinessProbe: + httpGet: + path: api/ready + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 5 + volumes: + - name: data + persistentVolumeClaim: + claimName: pvc-data + - name: app-secrets-volume + secret: + secretName: {{ .Chart.Name }}-secret + - name: app-config-volume + configMap: + name: {{ .Chart.Name }}-config + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: {{ .Values.todoapp.affinity.nodeAffinity.key }} + operator: In + values: + - {{ .Values.todoapp.affinity.nodeAffinity.values | quote }} \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/hpa.yml b/.infrastructure/helm-chart/todoapp/templates/hpa.yml new file mode 100644 index 0000000..e2c97ea --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/hpa.yml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.todoapp.namespace }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Release.Name }}-{{ .Chart.Name }} + minReplicas: {{ .Values.todoapp.hpa.minReplicas }} + maxReplicas: {{ .Values.todoapp.hpa.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.todoapp.hpa.cpu.averageUtilization }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.todoapp.hpa.memory.averageUtilization }} diff --git a/.infrastructure/helm-chart/todoapp/templates/ingress.yml b/.infrastructure/helm-chart/todoapp/templates/ingress.yml new file mode 100644 index 0000000..3b347a1 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/ingress.yml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Chart.Name }}-ingress + namespace: {{ .Values.todoapp.namespace }} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /$2 +spec: + rules: + - http: + paths: + - pathType: Prefix + path: /(|$)(.*) + backend: + service: + name: {{ .Chart.Name }}-service + port: + number: 80 \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/nodeport.yml b/.infrastructure/helm-chart/todoapp/templates/nodeport.yml new file mode 100644 index 0000000..f038370 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/nodeport.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-nodeport + namespace: {{ .Values.todoapp.namespace }} +spec: + type: NodePort + selector: + app: {{ .Chart.Name }} + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + nodePort: 30007 diff --git a/.infrastructure/helm-chart/todoapp/templates/ns.yml b/.infrastructure/helm-chart/todoapp/templates/ns.yml new file mode 100644 index 0000000..3c2dfc3 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/ns.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.todoapp.namespace }} \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/pv.yml b/.infrastructure/helm-chart/todoapp/templates/pv.yml new file mode 100644 index 0000000..33ebc09 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/pv.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-data + namespace: {{ .Values.todoapp.namespace }} +spec: + storageClassName: standard + persistentVolumeReclaimPolicy: Delete + accessModes: + - ReadWriteMany + capacity: + storage: 1Gi + hostPath: + path: /data/ diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml new file mode 100644 index 0000000..040564b --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -0,0 +1,13 @@ + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pvc-data + namespace: {{ .Values.todoapp.namespace }} +spec: + volumeName: pv-data + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/secret.yml b/.infrastructure/helm-chart/todoapp/templates/secret.yml new file mode 100644 index 0000000..cd22fb6 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/secret.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Chart.Name }}-secret + namespace: {{ .Values.todoapp.namespace }} +type: Opaque +data: + {{- range $k, $v := .Values.todoapp.secrets.data }} + {{ $k }}: {{ $v | quote }} + {{- end }} diff --git a/.infrastructure/helm-chart/todoapp/values.yaml b/.infrastructure/helm-chart/todoapp/values.yaml new file mode 100644 index 0000000..a4215aa --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/values.yaml @@ -0,0 +1,55 @@ +todoapp: + + namespace: todoapp + + resources: + requests: + memory: "256Mi" + cpu: "150m" + limits: + memory: "256Mi" + cpu: "150m" + + secrets: + data: + SECRET_KEY: QGUyKHl4KXYmdGdoM19zPTB5amEtaSFkcGVieHN6XmRnNDd4KS1rJmtxXzN6Zio5ZSoK + DB_NAME: "YXBwX2RiCg==" + DB_USER: "YXBwX3VzZXI=" + DB_PASSWORD: "MTIzNA==" + DB_HOST: "bXlzcWwtMC5teXNxbC5teXNxbC5zdmMuY2x1c3Rlci5sb2NhbAo=" + + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 1 + + image: + name: todoapp + repository: ikulyk404/todoapp + version: 4.0.1 + + affinity: + nodeAffinity: + key: app + values: + - todoapp + + hpa: + minReplicas: 2 + maxReplicas: 5 + cpu: + averageUtilization: 70 + memory: + averageUtilization: 70 + + pv: + capacity: + storage: 2Gi + + pvc: + requests: + storage: 1Gi + + serviceAccount: + name: secrets-reader \ No newline at end of file diff --git a/README.md b/README.md index 93f589c..878420a 100644 --- a/README.md +++ b/README.md @@ -37,31 +37,31 @@ Create a kubernetes manifest for a pod which will containa ToDo app container: 1. Taint nodes labeled with `app=mysql` with `app=mysql:NoSchedule` 1. Create a helm chart named `todoapp` inside a `helm-chart` directory 1. `todoapp` helm chart requirements: - 1. Namespace name should be controlled from a `values.yaml` file - 1. Use `.Chart.Name` as a prefix for all resources names - 1. Secrets should be controlled from a `values.yaml` file - 1. Secrets `data` should be popualted by a `range` function - 1. Inside the deployment use `range` to map secrets as environment variables - 1. Resources requests and limits should controlled from a `values.yaml` file - 1. RollingUpdate parameters should be controlled from a `values.yaml` file - 1. Image repository and tag should be controlled from a `values.yaml` file - 1. Deployment node affinity parameters should be controlled from a `values.yaml` file (key and values) - 1. `hpa` min and max replicas should be controlled from a `values.yaml` file - 1. `hpa` average CPU and Memory utilization should be controlled from a `values.yaml` file - 1. `pv` capacity should be controlled from a `values.yaml` file - 1. `pvc` requests storage should be controlled from a `values.yaml` file - 1. Service Account Name inside both `Deployment` and all rbac objects should be controld from a `values.yaml` file -1. Creata a sub-chart called `mysql` inside a `charts` directory of the `todoapp` helm chart + ~~1. Namespace name should be controlled from a `values.yaml` file~~ + ~~1. Use `.Chart.Name` as a prefix for all resources names~~ + ~~1. Secrets should be controlled from a `values.yaml` file~~ + ~~1. Secrets `data` should be popualted by a `range` function_~~ + ~~1. Inside the deployment use `range` to map secrets as environment variables~~ + ~~1. Resources requests and limits should controlled from a `values.yaml` file~~ + ~~1. RollingUpdate parameters should be controlled from a `values.yaml` file~~ + ~~1. Image repository and tag should be controlled from a `values.yaml` file~~ + ~~1. Deployment node affinity parameters should be controlled from a `values.yaml` file (key and values)~~ + ~~1. `hpa` min and max replicas should be controlled from a `values.yaml` file~~ + ~~1. `hpa` average CPU and Memory utilization should be controlled from a `values.yaml` file~~ + ~~1. `pv` capacity should be controlled from a `values.yaml` file~~ + ~~1. `pvc` requests storage should be controlled from a `values.yaml` file~~ + ~~1. Service Account Name inside both `Deployment` and all rbac objects should be controld from a `values.yaml` file~~ +~~1. Creata a sub-chart called `mysql` inside a `charts` directory of the `todoapp` helm chart~~ 1. `mysql` helm chart requirements: - 1. Namespace name should be controlled from a `values.yaml` file - 1. Use `.Chart.Name` as a prefix for all resources names - 1. Secrets should be controlled from a `values.yaml` file - 1. Secrets `data` should be popualted by a `range` function - 1. StateFulSet's Replicas should be controlled from a `values.yaml` file - 1. Image repository and tag should be controlled from a `values.yaml` file - 1. `pvc` requests storage should be controlled from a `values.yaml` file - 1. Affinity and Toleration parameters should be controlled from a `values.yaml` file - 1. Resource requests and limits should controlled from a `values.yaml` file + ~~1. Namespace name should be controlled from a `values.yaml` file~~ + ~~1. Use `.Chart.Name` as a prefix for all resources names~~ + ~~1. Secrets should be controlled from a `values.yaml` file~~ + ~~1. Secrets `data` should be popualted by a `range` function~~ + ~~1. StateFulSet's Replicas should be controlled from a `values.yaml` file~~ + ~~1. Image repository and tag should be controlled from a `values.yaml` file~~ + ~~1. `pvc` requests storage should be controlled from a `values.yaml` file~~ + ~~1. Affinity and Toleration parameters should be controlled from a `values.yaml` file~~ + ~~1. Resource requests and limits should controlled from a `values.yaml` file~~ 1. Add explicit dependencies between `todoapp` and `mysql` charts 1. Inside the Chart.yaml file of todoapp chart, add lines ``` @@ -73,4 +73,18 @@ Create a kubernetes manifest for a pod which will containa ToDo app container: 11. Deploy helm chart to your `kind` cluster 11. Run command `kubectl get all,cm,secret,ing -A` and put the output in a file called `output.log` in a root of the repository 12. `README.md` should have instructuions on how to validate the changes + +Check dry-run: + +``` + helm install todoapp .infrastructure/helm-chart/todoapp --dry-run +``` + +Check output.log file to ensure everything is up and running or the commands below: + +``` +./bootstrap.sh +kubectl get all,cm,secret,ing -A +``` + 13. Create PR with your changes and attach it for validation on a platform. diff --git a/bootstrap.sh b/bootstrap.sh index 2d534d7..54a8db7 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,20 +1,23 @@ #!/bin/bash -kubectl apply -f .infrastructure/mysql/ns.yml -kubectl apply -f .infrastructure/mysql/configMap.yml -kubectl apply -f .infrastructure/mysql/secret.yml -kubectl apply -f .infrastructure/mysql/service.yml -kubectl apply -f .infrastructure/mysql/statefulSet.yml +# kubectl apply -f .infrastructure/mysql/ns.yml +# kubectl apply -f .infrastructure/mysql/configMap.yml +# kubectl apply -f .infrastructure/mysql/secret.yml +# kubectl apply -f .infrastructure/mysql/service.yml +# kubectl apply -f .infrastructure/mysql/statefulSet.yml -kubectl apply -f .infrastructure/app/ns.yml -kubectl apply -f .infrastructure/app/pv.yml -kubectl apply -f .infrastructure/app/pvc.yml -kubectl apply -f .infrastructure/app/secret.yml -kubectl apply -f .infrastructure/app/configMap.yml -kubectl apply -f .infrastructure/app/clusterIp.yml -kubectl apply -f .infrastructure/app/nodeport.yml -kubectl apply -f .infrastructure/app/hpa.yml -kubectl apply -f .infrastructure/app/deployment.yml +# kubectl apply -f .infrastructure/app/ns.yml +# kubectl apply -f .infrastructure/app/pv.yml +# kubectl apply -f .infrastructure/app/pvc.yml +# kubectl apply -f .infrastructure/app/secret.yml +# kubectl apply -f .infrastructure/app/configMap.yml +# kubectl apply -f .infrastructure/app/clusterIp.yml +# kubectl apply -f .infrastructure/app/nodeport.yml +# kubectl apply -f .infrastructure/app/hpa.yml +# kubectl apply -f .infrastructure/app/deployment.yml # Install Ingress Controller -kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml +# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml # kubectl apply -f .infrastructure/ingress/ingress.yml + +# deploy using helm +helm install todoapp .infrastructure/helm-chart/todoapp \ No newline at end of file diff --git a/output.log b/output.log new file mode 100644 index 0000000..324cf78 --- /dev/null +++ b/output.log @@ -0,0 +1,75 @@ +NAMESPACE NAME READY STATUS RESTARTS AGE +kube-system pod/coredns-6f6b679f8f-98tsv 1/1 Running 0 4h48m +kube-system pod/coredns-6f6b679f8f-chvkg 1/1 Running 0 4h48m +kube-system pod/etcd-kind-control-plane 1/1 Running 0 4h48m +kube-system pod/kindnet-54lv5 1/1 Running 0 4h46m +kube-system pod/kindnet-62q8r 1/1 Running 0 4h46m +kube-system pod/kindnet-j6hgt 1/1 Running 0 4h46m +kube-system pod/kindnet-j8pjz 1/1 Running 0 4h46m +kube-system pod/kindnet-pkk8m 1/1 Running 0 4h46m +kube-system pod/kindnet-vmvh2 1/1 Running 0 4h46m +kube-system pod/kindnet-vsj4l 1/1 Running 0 4h46m +kube-system pod/kube-apiserver-kind-control-plane 1/1 Running 0 4h48m +kube-system pod/kube-controller-manager-kind-control-plane 1/1 Running 6 (21m ago) 4h48m +kube-system pod/kube-proxy-725tj 1/1 Running 0 4h46m +kube-system pod/kube-proxy-7q2xv 1/1 Running 0 4h46m +kube-system pod/kube-proxy-8mthn 1/1 Running 0 4h46m +kube-system pod/kube-proxy-jql9n 1/1 Running 0 4h46m +kube-system pod/kube-proxy-skdv2 1/1 Running 0 4h46m +kube-system pod/kube-proxy-wdxkd 1/1 Running 0 4h46m +kube-system pod/kube-proxy-z7q9j 1/1 Running 0 4h48m +kube-system pod/kube-scheduler-kind-control-plane 1/1 Running 5 (21m ago) 4h48m +local-path-storage pod/local-path-provisioner-57c5987fd4-qj5bc 1/1 Running 0 4h46m +mysql pod/mysql-0 0/1 Pending 0 4m40s + +NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +default service/kubernetes ClusterIP 10.96.0.1 443/TCP 4h48m +kube-system service/kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 4h48m +mysql service/mysql ClusterIP None 3306/TCP 4m40s +todoapp service/todoapp-nodeport NodePort 10.96.49.162 80:30007/TCP 4m40s +todoapp service/todoapp-service ClusterIP 10.96.210.208 80/TCP 4m40s + +NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE +kube-system deployment.apps/coredns 2/2 2 2 4h48m +local-path-storage deployment.apps/local-path-provisioner 1/1 1 1 4h47m +todoapp deployment.apps/todoapp-todoapp 0/2 0 0 4m40s + +NAMESPACE NAME DESIRED CURRENT READY AGE +kube-system replicaset.apps/coredns-6f6b679f8f 2 2 2 4h48m +local-path-storage replicaset.apps/local-path-provisioner-57c5987fd4 1 1 1 4h46m +todoapp replicaset.apps/todoapp-todoapp-5d78f7c7b5 2 0 0 4m40s + +NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE +kube-system daemonset.apps/kindnet 7 7 7 7 7 kubernetes.io/os=linux 4h47m +kube-system daemonset.apps/kube-proxy 7 7 7 7 7 kubernetes.io/os=linux 4h48m + +NAMESPACE NAME READY AGE +mysql statefulset.apps/mysql 0/2 4m40s + +NAMESPACE NAME DATA AGE +default configmap/kube-root-ca.crt 1 4h48m +kube-node-lease configmap/kube-root-ca.crt 1 4h48m +kube-public configmap/cluster-info 2 4h48m +kube-public configmap/kube-root-ca.crt 1 4h48m +kube-system configmap/coredns 1 4h48m +kube-system configmap/extension-apiserver-authentication 6 4h48m +kube-system configmap/kube-apiserver-legacy-service-account-token-tracking 1 4h48m +kube-system configmap/kube-proxy 2 4h48m +kube-system configmap/kube-root-ca.crt 1 4h48m +kube-system configmap/kubeadm-config 1 4h48m +kube-system configmap/kubelet-config 1 4h48m +local-path-storage configmap/kube-root-ca.crt 1 4h46m +local-path-storage configmap/local-path-config 4 4h47m +mysql configmap/kube-root-ca.crt 1 4m41s +mysql configmap/mysql 1 4m41s +todoapp configmap/kube-root-ca.crt 1 4m41s +todoapp configmap/todoapp-config 1 4m41s + +NAMESPACE NAME TYPE DATA AGE +default secret/sh.helm.release.v1.todoapp.v1 helm.sh/release.v1 1 4m41s +kube-system secret/bootstrap-token-abcdef bootstrap.kubernetes.io/token 6 4h48m +mysql secret/mysql-secrets Opaque 3 4m41s +todoapp secret/todoapp-secret Opaque 5 4m41s + +NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE +todoapp ingress.networking.k8s.io/todoapp-ingress * 80 4m40s From 72ec2793e112758cfac44d2779c6d423be281e55 Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 19:13:48 +0300 Subject: [PATCH 2/6] fix EoF, add serviceAccount YAML file, use pv storage value from value.yml --- .infrastructure/helm-chart/todoapp/Chart.yaml | 1 + .../todoapp/charts/mysql/Chart.yaml | 1 + .../charts/mysql/templates/configMap.yml | 1 + .../todoapp/charts/mysql/templates/ns.yml | 2 +- .../todoapp/charts/mysql/templates/secret.yml | 2 +- .../charts/mysql/templates/service.yml | 2 +- .../charts/mysql/templates/statefulSet.yml | 1 + .../todoapp/charts/mysql/values.yaml | 2 +- .../todoapp/templates/clusterIp.yml | 1 + .../todoapp/templates/configMap.yml | 2 +- .../todoapp/templates/deployment.yml | 2 +- .../helm-chart/todoapp/templates/hpa.yml | 1 + .../helm-chart/todoapp/templates/ingress.yml | 2 +- .../helm-chart/todoapp/templates/nodeport.yml | 1 + .../helm-chart/todoapp/templates/ns.yml | 2 +- .../helm-chart/todoapp/templates/pv.yml | 3 +- .../helm-chart/todoapp/templates/pvc.yml | 2 +- .../helm-chart/todoapp/templates/rbac.yml | 30 +++++++++++++++++++ .../helm-chart/todoapp/templates/secret.yml | 1 + .../helm-chart/todoapp/values.yaml | 2 +- bootstrap.sh | 2 +- 21 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 .infrastructure/helm-chart/todoapp/templates/rbac.yml diff --git a/.infrastructure/helm-chart/todoapp/Chart.yaml b/.infrastructure/helm-chart/todoapp/Chart.yaml index 587faa1..0997056 100644 --- a/.infrastructure/helm-chart/todoapp/Chart.yaml +++ b/.infrastructure/helm-chart/todoapp/Chart.yaml @@ -6,3 +6,4 @@ version: 0.1.0 appVersion: "1.16.0" dependencies: - name: mysql + diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml index e65c7a0..5a577ec 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml @@ -22,3 +22,4 @@ version: 0.1.0 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "1.16.0" + diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml index f20dbd9..6da40a0 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml @@ -13,3 +13,4 @@ data: id INT AUTO_INCREMENT PRIMARY KEY, value INT ); + diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml index 71fc563..d5a8a94 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/ns.yml @@ -1,4 +1,4 @@ apiVersion: v1 kind: Namespace metadata: - name: {{ .Values.mysql.namespace }} \ No newline at end of file + name: {{ .Values.mysql.namespace }} diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml index 30de47d..7368f9d 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml @@ -7,4 +7,4 @@ type: Opaque data: {{- range $k, $v := .Values.mysql.secrets.data }} {{ $k }}: {{ $v | quote }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml index d12f94d..07a7f88 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml @@ -14,4 +14,4 @@ spec: # pod-name.service-name.namespace.svc.cluster.local # pod-name.service-name -# mysql-0.mysql.mysql.svc.cluster.local \ No newline at end of file +# mysql-0.mysql.mysql.svc.cluster.local diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml index fbc282a..3e6b01e 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml @@ -87,3 +87,4 @@ spec: resources: requests: storage: {{ .Values.mysql.volumeClaimTemplates.resources.requests.storage }} + diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml b/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml index 9d7380a..9c505aa 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml @@ -31,4 +31,4 @@ mysql: value: "mysql" nodeAffinity: key: "app" - value: "mysql" \ No newline at end of file + value: "mysql" diff --git a/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml b/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml index b56d1b2..c62f3f7 100644 --- a/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml +++ b/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml @@ -11,3 +11,4 @@ spec: - protocol: TCP port: 80 targetPort: 8080 + diff --git a/.infrastructure/helm-chart/todoapp/templates/configMap.yml b/.infrastructure/helm-chart/todoapp/templates/configMap.yml index 58491c4..8bf9081 100644 --- a/.infrastructure/helm-chart/todoapp/templates/configMap.yml +++ b/.infrastructure/helm-chart/todoapp/templates/configMap.yml @@ -4,4 +4,4 @@ metadata: name: {{ .Chart.Name }}-config namespace: {{ .Values.todoapp.namespace }} data: - PYTHONUNBUFFERED: "1" \ No newline at end of file + PYTHONUNBUFFERED: "1" diff --git a/.infrastructure/helm-chart/todoapp/templates/deployment.yml b/.infrastructure/helm-chart/todoapp/templates/deployment.yml index d7d1323..f60dea3 100644 --- a/.infrastructure/helm-chart/todoapp/templates/deployment.yml +++ b/.infrastructure/helm-chart/todoapp/templates/deployment.yml @@ -83,4 +83,4 @@ spec: - key: {{ .Values.todoapp.affinity.nodeAffinity.key }} operator: In values: - - {{ .Values.todoapp.affinity.nodeAffinity.values | quote }} \ No newline at end of file + - {{ .Values.todoapp.affinity.nodeAffinity.values | quote }} diff --git a/.infrastructure/helm-chart/todoapp/templates/hpa.yml b/.infrastructure/helm-chart/todoapp/templates/hpa.yml index e2c97ea..ecce4a1 100644 --- a/.infrastructure/helm-chart/todoapp/templates/hpa.yml +++ b/.infrastructure/helm-chart/todoapp/templates/hpa.yml @@ -23,3 +23,4 @@ spec: target: type: Utilization averageUtilization: {{ .Values.todoapp.hpa.memory.averageUtilization }} + diff --git a/.infrastructure/helm-chart/todoapp/templates/ingress.yml b/.infrastructure/helm-chart/todoapp/templates/ingress.yml index 3b347a1..95f2e6a 100644 --- a/.infrastructure/helm-chart/todoapp/templates/ingress.yml +++ b/.infrastructure/helm-chart/todoapp/templates/ingress.yml @@ -15,4 +15,4 @@ spec: service: name: {{ .Chart.Name }}-service port: - number: 80 \ No newline at end of file + number: 80 diff --git a/.infrastructure/helm-chart/todoapp/templates/nodeport.yml b/.infrastructure/helm-chart/todoapp/templates/nodeport.yml index f038370..fb71efe 100644 --- a/.infrastructure/helm-chart/todoapp/templates/nodeport.yml +++ b/.infrastructure/helm-chart/todoapp/templates/nodeport.yml @@ -12,3 +12,4 @@ spec: port: 80 targetPort: 8080 nodePort: 30007 + diff --git a/.infrastructure/helm-chart/todoapp/templates/ns.yml b/.infrastructure/helm-chart/todoapp/templates/ns.yml index 3c2dfc3..5b90b3f 100644 --- a/.infrastructure/helm-chart/todoapp/templates/ns.yml +++ b/.infrastructure/helm-chart/todoapp/templates/ns.yml @@ -1,4 +1,4 @@ apiVersion: v1 kind: Namespace metadata: - name: {{ .Values.todoapp.namespace }} \ No newline at end of file + name: {{ .Values.todoapp.namespace }} diff --git a/.infrastructure/helm-chart/todoapp/templates/pv.yml b/.infrastructure/helm-chart/todoapp/templates/pv.yml index 33ebc09..2ce47c1 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pv.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pv.yml @@ -9,6 +9,7 @@ spec: accessModes: - ReadWriteMany capacity: - storage: 1Gi + storage: {{ .Values.todoapp.capacity.storage }} hostPath: path: /data/ + diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml index 040564b..1dbe7a8 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pvc.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -10,4 +10,4 @@ spec: - ReadWriteMany resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/.infrastructure/helm-chart/todoapp/templates/rbac.yml b/.infrastructure/helm-chart/todoapp/templates/rbac.yml new file mode 100644 index 0000000..aa3f727 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/rbac.yml @@ -0,0 +1,30 @@ +kind: ServiceAccount +apiVersion: v1 +metadata: + name: {{ .Values.todoapp.ServiceAccount.name }} + namespace: {{ .Values.todoapp.namespace }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: {{ .Values.todoapp.namespace }} + name: {{ .Values.todoapp.ServiceAccount.name }} +rules: +- apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "watch", "list"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Values.todoapp.ServiceAccount.name }}-binding + namespace: {{ .Values.todoapp.namespace }} +subjects: +- kind: ServiceAccount + name: {{ .Values.todoapp.ServiceAccount.name }} +roleRef: + kind: Role + name: {{ .Values.todoapp.ServiceAccount.name }} + apiGroup: rbac.authorization.k8s.io \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/secret.yml b/.infrastructure/helm-chart/todoapp/templates/secret.yml index cd22fb6..635ef8a 100644 --- a/.infrastructure/helm-chart/todoapp/templates/secret.yml +++ b/.infrastructure/helm-chart/todoapp/templates/secret.yml @@ -8,3 +8,4 @@ data: {{- range $k, $v := .Values.todoapp.secrets.data }} {{ $k }}: {{ $v | quote }} {{- end }} + diff --git a/.infrastructure/helm-chart/todoapp/values.yaml b/.infrastructure/helm-chart/todoapp/values.yaml index a4215aa..c8c0c4b 100644 --- a/.infrastructure/helm-chart/todoapp/values.yaml +++ b/.infrastructure/helm-chart/todoapp/values.yaml @@ -52,4 +52,4 @@ todoapp: storage: 1Gi serviceAccount: - name: secrets-reader \ No newline at end of file + name: secrets-reader diff --git a/bootstrap.sh b/bootstrap.sh index 54a8db7..c06fd99 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -20,4 +20,4 @@ # kubectl apply -f .infrastructure/ingress/ingress.yml # deploy using helm -helm install todoapp .infrastructure/helm-chart/todoapp \ No newline at end of file +helm install todoapp .infrastructure/helm-chart/todoapp From 6065aa9d92bb019a8f0519ae66e8dd1126175aa7 Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 19:17:50 +0300 Subject: [PATCH 3/6] use pvc storage value from value.yml --- .infrastructure/helm-chart/todoapp/templates/pvc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml index 1dbe7a8..b10eb1b 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pvc.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -10,4 +10,4 @@ spec: - ReadWriteMany resources: requests: - storage: 1Gi + storage: {{ .Values.todoapp.requests.storage }} From 651ed26852cd1d09eda9062dd0f26287d1a5599f Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 19:30:32 +0300 Subject: [PATCH 4/6] fix ServiceAccount name value --- .infrastructure/helm-chart/todoapp/templates/rbac.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.infrastructure/helm-chart/todoapp/templates/rbac.yml b/.infrastructure/helm-chart/todoapp/templates/rbac.yml index aa3f727..1830184 100644 --- a/.infrastructure/helm-chart/todoapp/templates/rbac.yml +++ b/.infrastructure/helm-chart/todoapp/templates/rbac.yml @@ -1,7 +1,7 @@ kind: ServiceAccount apiVersion: v1 metadata: - name: {{ .Values.todoapp.ServiceAccount.name }} + name: {{ .Values.todoapp.serviceAccount.name }} namespace: {{ .Values.todoapp.namespace }} --- @@ -9,7 +9,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: {{ .Values.todoapp.namespace }} - name: {{ .Values.todoapp.ServiceAccount.name }} + name: {{ .Values.todoapp.serviceAccount.name }} rules: - apiGroups: [""] resources: ["secrets"] @@ -19,12 +19,12 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ .Values.todoapp.ServiceAccount.name }}-binding + name: {{ .Values.todoapp.serviceAccount.name }}-binding namespace: {{ .Values.todoapp.namespace }} subjects: - kind: ServiceAccount - name: {{ .Values.todoapp.ServiceAccount.name }} + name: {{ .Values.todoapp.serviceAccount.name }} roleRef: kind: Role - name: {{ .Values.todoapp.ServiceAccount.name }} + name: {{ .Values.todoapp.serviceAccount.name }} apiGroup: rbac.authorization.k8s.io \ No newline at end of file From 0220484a82692bae8032914238202c00dd544c78 Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 19:32:48 +0300 Subject: [PATCH 5/6] fix pvc storage value --- .infrastructure/helm-chart/todoapp/templates/pvc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml index b10eb1b..b5f7ae2 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pvc.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -10,4 +10,4 @@ spec: - ReadWriteMany resources: requests: - storage: {{ .Values.todoapp.requests.storage }} + storage: {{ .Values.todoapp.pvc.requests.storage }} From e1c08c06c3ac1f593255944dd1c207fdecd38508 Mon Sep 17 00:00:00 2001 From: Darya-Savchenko Date: Tue, 22 Oct 2024 19:34:06 +0300 Subject: [PATCH 6/6] fix pv storage value --- .infrastructure/helm-chart/todoapp/templates/pv.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.infrastructure/helm-chart/todoapp/templates/pv.yml b/.infrastructure/helm-chart/todoapp/templates/pv.yml index 2ce47c1..abf7c1d 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pv.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pv.yml @@ -9,7 +9,7 @@ spec: accessModes: - ReadWriteMany capacity: - storage: {{ .Values.todoapp.capacity.storage }} + storage: {{ .Values.todoapp.pv.capacity.storage }} hostPath: path: /data/