From e95e15ec4c2618aa7a3c6d3874611c021a155c1a Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Mon, 6 May 2024 18:11:34 +0300 Subject: [PATCH 1/6] Solution --- .../helm-chart/todoapp/.helmignore | 23 ++++++ .infrastructure/helm-chart/todoapp/Chart.yaml | 6 ++ .../todoapp/charts/mysql/Chart.yaml | 6 ++ .../charts/mysql/templates/configMap.yml | 17 ++++ .../todoapp/charts/mysql/templates/ns.yml | 4 + .../todoapp/charts/mysql/templates/secret.yml | 10 +++ .../charts/mysql/templates/service.yml | 13 +++ .../charts/mysql/templates/statefulSet.yml | 75 ++++++++++++++++++ .../todoapp/charts/mysql/values.yaml | 49 ++++++++++++ .../todoapp/templates/clusterIp.yml | 13 +++ .../todoapp/templates/configMap.yml | 7 ++ .../todoapp/templates/deployment.yml | 79 +++++++++++++++++++ .../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/rbac.yml | 30 +++++++ .../helm-chart/todoapp/templates/secret.yml | 10 +++ .../helm-chart/todoapp/values.yaml | 69 ++++++++++++++++ README.md | 79 +++++++------------ bootstrap.sh | 21 +---- 23 files changed, 528 insertions(+), 71 deletions(-) create mode 100644 .infrastructure/helm-chart/todoapp/.helmignore 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/rbac.yml create mode 100644 .infrastructure/helm-chart/todoapp/templates/secret.yml create mode 100644 .infrastructure/helm-chart/todoapp/values.yaml diff --git a/.infrastructure/helm-chart/todoapp/.helmignore b/.infrastructure/helm-chart/todoapp/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/.infrastructure/helm-chart/todoapp/Chart.yaml b/.infrastructure/helm-chart/todoapp/Chart.yaml new file mode 100644 index 0000000..2237169 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: todoapp +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "1.16.0" 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..786033a --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: mysql +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "1.16.0" \ No newline at end of file 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..cd8c7c8 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml @@ -0,0 +1,17 @@ +# templates/configmap.yaml + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Chart.Name }}-init-sql + 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..d5a8a94 --- /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 }} 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..fdc9571 --- /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 $key, $value := .Values.mysql.secrets }} + {{ $key | upper }}: {{ $value | b64enc | quote }} + {{- end }} 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..6b01e3f --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.mysql.namespace }} +spec: + selector: + app: {{ .Chart.Name }} + ports: + - name: {{ .Chart.Name }} + port: {{ .Values.mysql.port }} + clusterIP: {{ .Values.mysql.service.clusterIP }} + \ 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..2f801f9 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml @@ -0,0 +1,75 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.mysql.namespace }} +spec: + replicas: {{ .Values.mysql.replicas }} + serviceName: {{ .Chart.Name }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}" + env: + {{- range $v, $k := .Values.mysql.secrets }} + - name: {{ $v }} + valueFrom: + secretKeyRef: + name: {{ $v }} + key: {{ $k | b64enc | quote }} + {{- end }} + ports: + - name: {{ .Chart.Name }} + containerPort: {{ .Values.mysql.port }} + volumeMounts: + - name: data + mountPath: /var/lib/mysql + - name: config-map + mountPath: /docker-entrypoint-initdb.d + resources: + requests: + cpu: {{ .Values.mysql.resources.requests.cpu }} + memory: {{ .Values.mysql.resources.requests.memory }} + limits: + cpu: {{ .Values.mysql.resources.limits.cpu }} + memory: {{ .Values.mysql.resources.limits.memory }} + livenessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: 5 + periodSeconds: 2 + volumes: + - name: config-map + configMap: + name: {{ .Chart.Name }} + tolerations: + {{ toYaml .Values.mysql.tolerations | nindent 8 }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "app" + operator: In + values: + - {{ .Chart.Name }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: {{ .Values.mysql.storage.size }} 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..584c946 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/values.yaml @@ -0,0 +1,49 @@ +mysql: + namespace: mysql + image: + repository: mysql + tag: 8.0 + replicas: 2 + port: 3306 + + service: + clusterIP: None + + secrets: + MYSQL_ROOT_PASSWORD: "MTIzNA==" + MYSQL_USER: "YXBwX3VzZXI=" + MYSQL_PASSWORD: "MTIzNA==" + + resources: + requests: + cpu: "500m" + memory: "1Gi" + limits: + cpu: "1" + memory: "2Gi" + storage: + size: "2Gi" + + tolerations: + - key: "app" + operator: "Equal" + value: "mysql" + effect: "NoSchedule" + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: "app" + operator: In + values: + - mysql + topologyKey: "kubernetes.io/hostname" + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - nodeSelectorTerms: + - matchExpressions: + - key: "app" + operator: In + values: + - "mysql" diff --git a/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml b/.infrastructure/helm-chart/todoapp/templates/clusterIp.yml new file mode 100644 index 0000000..06c1a2d --- /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: {{ .Values.todoapp.service.type }} + selector: + app: {{ .Chart.Name }} + ports: + - protocol: TCP + port: {{ .Values.todoapp.service.port }} + targetPort: {{ .Values.todoapp.service.targetPort }} 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..f867e5f --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/deployment.yml @@ -0,0 +1,79 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} + namespace: {{ .Values.todoapp.namespace }} +spec: + replicas: {{ .Values.todoapp.replicaCount | default 1 }} + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: {{ .Values.todoapp.rollingUpdate.maxSurge | default 1 }} + maxUnavailable: {{ .Values.todoapp.rollingUpdate.maxUnavailable | default 1 }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + serviceAccountName: {{ .Chart.Name }}-secrets-reader + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.todoapp.image.repository }}:{{ .Values.todoapp.image.tag }}" + ports: + - containerPort: {{ .Values.todoapp.service.targetPort }} + env: + - name: PYTHONUNBUFFERED + valueFrom: + configMapKeyRef: + name: {{ .Chart.Name }}-config + key: PYTHONUNBUFFERED + {{- range $key, $value := .Values.todoapp.secrets }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: app-secret + key: {{ $key }} + {{- end }} + 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 }} + livenessProbe: + {{- toYaml .Values.todoapp.livenessProbe | nindent 10 }} + readinessProbe: + {{- toYaml .Values.todoapp.readinessProbe | nindent 10 }} + volumeMounts: + - name: data + mountPath: /app/data + - name: app-secrets-volume + mountPath: /app/secrets + readOnly: true + - name: app-config-volume + mountPath: /app/configs + readOnly: true + volumes: + - name: data + persistentVolumeClaim: + claimName: pvc-data + - name: app-secrets-volume + secret: + secretName: app-secret + - name: app-config-volume + configMap: + name: app-config + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: app + operator: In + values: + - kube2py diff --git a/.infrastructure/helm-chart/todoapp/templates/hpa.yml b/.infrastructure/helm-chart/todoapp/templates/hpa.yml new file mode 100644 index 0000000..8f6e271 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/hpa.yml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Chart.Name }}-hpa + namespace: {{ .Values.todoapp.namespace }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Release.Name }}-{{ .Chart.Name }} + minReplicas: {{ .Values.todoapp.autoscaling.minReplicas }} + maxReplicas: {{ .Values.todoapp.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.todoapp.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.todoapp.autoscaling.targetMemoryUtilizationPercentage }} 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..5b90b3f --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/ns.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.todoapp.namespace }} diff --git a/.infrastructure/helm-chart/todoapp/templates/pv.yml b/.infrastructure/helm-chart/todoapp/templates/pv.yml new file mode 100644 index 0000000..ae6db47 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/pv.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ .Chart.Name }}-pv-data + namespace: {{ .Values.todoapp.namespace }} +spec: + storageClassName: standard + persistentVolumeReclaimPolicy: Delete + accessModes: + - ReadWriteMany + capacity: + storage: {{ .Values.todoapp.volumes.persistentVolume.capacity }} + 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..ce954d5 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Chart.Name }}-pvc-data + namespace: {{ .Values.todoapp.namespace }} +spec: + volumeName: pv-data + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.todoapp.volumes.persistentVolumeClaim.requestStorage }} + \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/rbac.yml b/.infrastructure/helm-chart/todoapp/templates/rbac.yml new file mode 100644 index 0000000..268b4a1 --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/rbac.yml @@ -0,0 +1,30 @@ +kind: ServiceAccount +apiVersion: v1 +metadata: + name: {{ .Chart.Name }}-secrets-reader + namespace: {{ .Values.todoapp.namespace }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: {{ .Values.todoapp.namespace }} + name: secrets-reader +rules: +- apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "watch", "list"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: secrets-reader-binding + namespace: {{ .Values.todoapp.namespace }} +subjects: +- kind: ServiceAccount + name: secrets-reader +roleRef: + kind: Role + name: secrets-reader + apiGroup: rbac.authorization.k8s.io diff --git a/.infrastructure/helm-chart/todoapp/templates/secret.yml b/.infrastructure/helm-chart/todoapp/templates/secret.yml new file mode 100644 index 0000000..8db0b1a --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/templates/secret.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Chart.Name }}-secrets + namespace: {{ .Values.todoapp.namespace }} +type: Opaque +data: +{{- range $key, $val:= .Values.todoapp.secrets }} + {{ $key | upper }}: {{ $val | b64enc | quote}} +{{- end }} diff --git a/.infrastructure/helm-chart/todoapp/values.yaml b/.infrastructure/helm-chart/todoapp/values.yaml new file mode 100644 index 0000000..78ab37b --- /dev/null +++ b/.infrastructure/helm-chart/todoapp/values.yaml @@ -0,0 +1,69 @@ +todoapp: + namespace: todoapp + image: + repository: ikulyk404/todoapp + tag: "4.0.1" + replicaCount: 1 + + secrets: + SECRET_KEY: "QGUyKHl4KXYmdGdoM19zPTB5amEtaSFkcGVieHN6XmRnNDd4KS1rJmtxXzN6Zio5ZSoK" + DB_NAME: "YXBwX2RiCg==" + DB_USER: "YXBwX3VzZXI=" + DB_PASSWORD: "MTIzNA==" + DB_HOST: "bXlzcWwtMC5teXNxbC5teXNxbC5zdmMuY2x1c3Rlci5sb2NhbAo=" + + rollingUpdate: + maxSurge: "25%" + maxUnavailable: 1 + + service: + type: ClusterIP + port: 80 + targetPort: 8080 + + ingress: + enabled: false + className: "" + annotations: {} + + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + + resources: + limits: + cpu: "100m" + memory: "128Mi" + requests: + cpu: "100m" + memory: "128Mi" + + livenessProbe: + httpGet: + path: "api/health" + port: 8080 + initialDelaySeconds: 60 + periodSeconds: 5 + + readinessProbe: + httpGet: + path: "api/ready" + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 5 + + autoscaling: + enabled: true + minReplicas: 2 + maxReplicas: 5 + targetCPUUtilizationPercentage: 70 + targetMemoryUtilizationPercentage: 70 + + volumes: + persistentVolume: + capacity: "1Gi" + persistentVolumeClaim: + requestStorage: "1Gi" diff --git a/README.md b/README.md index e4c3922..027882f 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,44 @@ -# Django ToDo list -This is a todo list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need: +# Kubernetes Manifest for Todoapp -- CSS | [Skeleton](http://getskeleton.com/) -- JS | [jQuery](https://jquery.com/) +This repository contains the Kubernetes manifests for deploying a ToDo app using Helm. Below are the instructions for setting up the environment and deploying the application. -## Explore +## Instructions -Try it out by installing the requirements (the following commands work only with Python 3.8 and higher, due to Django 4): +### Environment Setup +Install Kind: Use kind to spin up a Kubernetes cluster. You can find the configuration file cluster.yml within the repository. Use it to create a cluster with the necessary specifications. +```bash +kind create cluster --config=cluster.yml ``` -pip install -r requirements.txt + +### Helm Chart install + +```bash +./bootstrap.sh ``` -Create a database schema: +### Check active namespaces +```bash +kubectl get ns ``` -python manage.py migrate + +### Check helm list + +```bash +helm list ``` -And then start the server (default is http://localhost:8000): +### Check helm release history +```bash +helm history todoapp ``` -python manage.py runserver + +### Command delete release + +```bash +helm uninstall todoapp ``` -Now you can browse the [API](http://localhost:8000/api/) or start on the [landing page](http://localhost:8000/). - -## Task - -Create a kubernetes manifest for a pod which will containa ToDo app container: - -1. Fork this repository. -1. Use `kind` to spin up a cluster from a `cluster.yml` configuration file. -1. Inspect Nodes for Labels and Taints -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. `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. `bootstrap.sh`containe all commands to deploy prerequsites and the `todoapp` helm chart -1. `README.md` should have instructuions on how to validate the changes -1. Create PR with your changes and attach it for validation on a platform. diff --git a/bootstrap.sh b/bootstrap.sh index 2d534d7..7fa6859 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,20 +1 @@ -#!/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/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 .infrastructure/ingress/ingress.yml +helm install todoapp .infrastructure/helm-chart/todoapp From c9cdf702374fc3d4ca6ceec40f14fb8b41add804 Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Mon, 6 May 2024 18:14:40 +0300 Subject: [PATCH 2/6] fix: EOF --- .infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml | 2 +- .infrastructure/helm-chart/todoapp/templates/configMap.yml | 2 +- .infrastructure/helm-chart/todoapp/templates/ingress.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml index 786033a..2f18252 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/Chart.yaml @@ -3,4 +3,4 @@ name: mysql description: A Helm chart for Kubernetes type: application version: 0.1.0 -appVersion: "1.16.0" \ No newline at end of file +appVersion: "1.16.0" 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/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 From 4617a814e4d836ec6299b6a2a3b596f154d23763 Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Tue, 7 May 2024 16:02:38 +0300 Subject: [PATCH 3/6] fix: fix correct settings --- .../todoapp/charts/mysql/templates/configMap.yml | 4 +--- .../todoapp/charts/mysql/templates/secret.yml | 2 +- .../todoapp/charts/mysql/templates/statefulSet.yml | 10 ++++++---- .../helm-chart/todoapp/templates/deployment.yml | 8 ++++---- .infrastructure/helm-chart/todoapp/templates/pvc.yml | 2 +- .../helm-chart/todoapp/templates/secret.yml | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml index cd8c7c8..f20dbd9 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/configMap.yml @@ -1,9 +1,7 @@ -# templates/configmap.yaml - apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Chart.Name }}-init-sql + name: {{ .Chart.Name }} namespace: {{ .Values.mysql.namespace }} labels: app: {{ .Chart.Name }} diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml index fdc9571..bf223af 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/secret.yml @@ -6,5 +6,5 @@ metadata: type: Opaque data: {{- range $key, $value := .Values.mysql.secrets }} - {{ $key | upper }}: {{ $value | b64enc | quote }} + {{ $key | upper }}: {{ $value }} {{- end }} diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml index 2f801f9..eea2bfc 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/statefulSet.yml @@ -18,13 +18,15 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}" env: - {{- range $v, $k := .Values.mysql.secrets }} - - name: {{ $v }} + {{- range $key, $val := .Values.mysql.secrets }} + - name: {{ $key }} valueFrom: secretKeyRef: - name: {{ $v }} - key: {{ $k | b64enc | quote }} + name: mysql-secrets + key: {{ $key }} {{- end }} + - name: MYSQL_DATABASE + value: app_db ports: - name: {{ .Chart.Name }} containerPort: {{ .Values.mysql.port }} diff --git a/.infrastructure/helm-chart/todoapp/templates/deployment.yml b/.infrastructure/helm-chart/todoapp/templates/deployment.yml index f867e5f..761fb0f 100644 --- a/.infrastructure/helm-chart/todoapp/templates/deployment.yml +++ b/.infrastructure/helm-chart/todoapp/templates/deployment.yml @@ -34,7 +34,7 @@ spec: - name: {{ $key }} valueFrom: secretKeyRef: - name: app-secret + name: todoapp-secret key: {{ $key }} {{- end }} resources: @@ -60,13 +60,13 @@ spec: volumes: - name: data persistentVolumeClaim: - claimName: pvc-data + claimName: {{ .Chart.Name }}-pvc-data - name: app-secrets-volume secret: - secretName: app-secret + secretName: {{ .Chart.Name }}-secret - name: app-config-volume configMap: - name: app-config + name: {{ .Chart.Name }}-config affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml index ce954d5..c57a89e 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pvc.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -4,7 +4,7 @@ metadata: name: {{ .Chart.Name }}-pvc-data namespace: {{ .Values.todoapp.namespace }} spec: - volumeName: pv-data + volumeName: {{ .Chart.Name }}-pv-data accessModes: - ReadWriteMany resources: diff --git a/.infrastructure/helm-chart/todoapp/templates/secret.yml b/.infrastructure/helm-chart/todoapp/templates/secret.yml index 8db0b1a..2f821f8 100644 --- a/.infrastructure/helm-chart/todoapp/templates/secret.yml +++ b/.infrastructure/helm-chart/todoapp/templates/secret.yml @@ -1,10 +1,10 @@ apiVersion: v1 kind: Secret metadata: - name: {{ .Chart.Name }}-secrets + name: {{ .Chart.Name }}-secret namespace: {{ .Values.todoapp.namespace }} type: Opaque data: {{- range $key, $val:= .Values.todoapp.secrets }} - {{ $key | upper }}: {{ $val | b64enc | quote}} + {{ $key | upper }}: {{ $val }} {{- end }} From e4ea7ddfed974da5ed2d214e0864651e144ba362 Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Mon, 13 May 2024 18:03:46 +0300 Subject: [PATCH 4/6] refactor: upd readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 027882f..99dc4d6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This repository contains the Kubernetes manifests for deploying a ToDo app using ### Environment Setup Install Kind: Use kind to spin up a Kubernetes cluster. You can find the configuration file cluster.yml within the repository. Use it to create a cluster with the necessary specifications. + ```bash kind create cluster --config=cluster.yml ``` From db163a79fea605f7c3e3547778d53469b33600ec Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Mon, 13 May 2024 18:36:47 +0300 Subject: [PATCH 5/6] add output.log --- .gitignore | 1 - .infrastructure/helm-chart/todoapp/Chart.yaml | 3 + README.md | 1 - output.log | 163 ++++++++++++++++++ 4 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 output.log diff --git a/.gitignore b/.gitignore index 68bc17f..10cc536 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,6 @@ cover/ *.pot # Django stuff: -*.log local_settings.py db.sqlite3 db.sqlite3-journal diff --git a/.infrastructure/helm-chart/todoapp/Chart.yaml b/.infrastructure/helm-chart/todoapp/Chart.yaml index 2237169..69b3db0 100644 --- a/.infrastructure/helm-chart/todoapp/Chart.yaml +++ b/.infrastructure/helm-chart/todoapp/Chart.yaml @@ -4,3 +4,6 @@ description: A Helm chart for Kubernetes type: application version: 0.1.0 appVersion: "1.16.0" + +dependencies: + - name: mysql diff --git a/README.md b/README.md index 99dc4d6..672f5dc 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,3 @@ helm history todoapp ```bash helm uninstall todoapp ``` - diff --git a/output.log b/output.log new file mode 100644 index 0000000..cd5394a --- /dev/null +++ b/output.log @@ -0,0 +1,163 @@ +NAMESPACE NAME READY STATUS RESTARTS AGE +default pod/alertmanager-prometheus-kube-prometheus-alertmanager-0 2/2 Running 2 (4m16s ago) 6d +default pod/grafana-8c8f844f-86b4m 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-operator-74c5cfdb84-gjvn8 1/1 Running 2 (3m26s ago) 6d +default pod/prometheus-kube-prometheus-stack-grafana-74f59445f-xnpgv 3/3 Running 3 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-kube-state-metrics-7858dcswq5x 1/1 Running 2 (3m33s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-2mzbm 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-cwkxj 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-kc9d2 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-kwnkn 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-l7hmc 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-mgp7c 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-kube-prometheus-stack-prometheus-node-exporter-qp7qj 1/1 Running 1 (4m16s ago) 6d +default pod/prometheus-prometheus-kube-prometheus-prometheus-0 2/2 Running 2 (4m16s ago) 6d +kube-system pod/coredns-76f75df574-2pq95 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/coredns-76f75df574-vclxj 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/etcd-kind-control-plane 1/1 Running 0 4m6s +kube-system pod/kindnet-298w6 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-2t554 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-bj75p 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-gcddz 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-s2s87 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-wp4lq 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kindnet-zsmz2 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-apiserver-kind-control-plane 1/1 Running 0 4m6s +kube-system pod/kube-controller-manager-kind-control-plane 1/1 Running 2 (4m16s ago) 7d1h +kube-system pod/kube-proxy-64nqm 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-7486p 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-g5mrm 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-n9ch5 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-vjfrm 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-w5vrw 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-proxy-wdvml 1/1 Running 1 (4m16s ago) 7d1h +kube-system pod/kube-scheduler-kind-control-plane 1/1 Running 2 (4m16s ago) 7d1h +local-path-storage pod/local-path-provisioner-7577fdbbfb-xn6jh 1/1 Running 2 (3m27s ago) 7d1h +mysql pod/mysql-0 1/1 Running 0 3m12s +mysql pod/mysql-1 1/1 Running 0 3m +todoapp pod/todoapp-todoapp-7cfbb4b546-jmd45 1/1 Running 2 (2m53s ago) 3m13s +todoapp pod/todoapp-todoapp-7cfbb4b546-xftmb 1/1 Running 2 (2m35s ago) 2m58s + +NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +default service/alertmanager-operated ClusterIP None 9093/TCP,9094/TCP,9094/UDP 6d +default service/grafana ClusterIP 10.96.116.141 80/TCP 6d +default service/kubernetes ClusterIP 10.96.0.1 443/TCP 7d1h +default service/prometheus-kube-prometheus-alertmanager ClusterIP 10.96.20.171 9093/TCP,8080/TCP 6d +default service/prometheus-kube-prometheus-operator ClusterIP 10.96.135.108 443/TCP 6d +default service/prometheus-kube-prometheus-prometheus ClusterIP 10.96.139.105 9090/TCP,8080/TCP 6d +default service/prometheus-kube-prometheus-stack-grafana ClusterIP 10.96.48.223 80/TCP 6d +default service/prometheus-kube-prometheus-stack-kube-state-metrics ClusterIP 10.96.39.75 8080/TCP 6d +default service/prometheus-kube-prometheus-stack-prometheus-node-exporter ClusterIP 10.96.34.73 9100/TCP 6d +default service/prometheus-operated ClusterIP None 9090/TCP 6d +kube-system service/kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 7d1h +kube-system service/prometheus-kube-prometheus-coredns ClusterIP None 9153/TCP 6d +kube-system service/prometheus-kube-prometheus-kube-controller-manager ClusterIP None 10257/TCP 6d +kube-system service/prometheus-kube-prometheus-kube-etcd ClusterIP None 2381/TCP 6d +kube-system service/prometheus-kube-prometheus-kube-proxy ClusterIP None 10249/TCP 6d +kube-system service/prometheus-kube-prometheus-kube-scheduler ClusterIP None 10259/TCP 6d +kube-system service/prometheus-kube-prometheus-kubelet ClusterIP None 10250/TCP,10255/TCP,4194/TCP 7d +mysql service/mysql ClusterIP None 3306/TCP 3m13s +todoapp service/todoapp-nodeport NodePort 10.96.226.11 80:30007/TCP 3m13s +todoapp service/todoapp-service ClusterIP 10.96.191.184 80/TCP 3m13s + +NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE +default daemonset.apps/prometheus-kube-prometheus-stack-prometheus-node-exporter 7 7 7 7 7 kubernetes.io/os=linux 6d +kube-system daemonset.apps/kindnet 7 7 7 7 7 kubernetes.io/os=linux 7d1h +kube-system daemonset.apps/kube-proxy 7 7 7 7 7 kubernetes.io/os=linux 7d1h + +NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE +default deployment.apps/grafana 1/1 1 1 6d +default deployment.apps/prometheus-kube-prometheus-operator 1/1 1 1 6d +default deployment.apps/prometheus-kube-prometheus-stack-grafana 1/1 1 1 6d +default deployment.apps/prometheus-kube-prometheus-stack-kube-state-metrics 1/1 1 1 6d +kube-system deployment.apps/coredns 2/2 2 2 7d1h +local-path-storage deployment.apps/local-path-provisioner 1/1 1 1 7d1h +todoapp deployment.apps/todoapp-todoapp 2/2 2 2 3m13s + +NAMESPACE NAME DESIRED CURRENT READY AGE +default replicaset.apps/grafana-8c8f844f 1 1 1 6d +default replicaset.apps/prometheus-kube-prometheus-operator-74c5cfdb84 1 1 1 6d +default replicaset.apps/prometheus-kube-prometheus-stack-grafana-74f59445f 1 1 1 6d +default replicaset.apps/prometheus-kube-prometheus-stack-kube-state-metrics-7858dcb5c4 1 1 1 6d +kube-system replicaset.apps/coredns-76f75df574 2 2 2 7d1h +local-path-storage replicaset.apps/local-path-provisioner-7577fdbbfb 1 1 1 7d1h +todoapp replicaset.apps/todoapp-todoapp-7cfbb4b546 2 2 2 3m13s + +NAMESPACE NAME READY AGE +default statefulset.apps/alertmanager-prometheus-kube-prometheus-alertmanager 1/1 6d +default statefulset.apps/prometheus-prometheus-kube-prometheus-prometheus 1/1 6d +mysql statefulset.apps/mysql 2/2 3m13s + +NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE +todoapp horizontalpodautoscaler.autoscaling/todoapp-hpa Deployment/todoapp-todoapp /70%, /70% 2 5 2 3m13s + +NAMESPACE NAME DATA AGE +default configmap/grafana 1 6d +default configmap/kube-root-ca.crt 1 7d1h +default configmap/prometheus-kube-prometheus-alertmanager-overview 1 6d +default configmap/prometheus-kube-prometheus-apiserver 1 6d +default configmap/prometheus-kube-prometheus-cluster-total 1 6d +default configmap/prometheus-kube-prometheus-controller-manager 1 6d +default configmap/prometheus-kube-prometheus-etcd 1 6d +default configmap/prometheus-kube-prometheus-grafana-datasource 1 6d +default configmap/prometheus-kube-prometheus-grafana-overview 1 6d +default configmap/prometheus-kube-prometheus-k8s-coredns 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-cluster 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-multicluster 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-namespace 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-node 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-pod 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-workload 1 6d +default configmap/prometheus-kube-prometheus-k8s-resources-workloads-namespace 1 6d +default configmap/prometheus-kube-prometheus-kubelet 1 6d +default configmap/prometheus-kube-prometheus-namespace-by-pod 1 6d +default configmap/prometheus-kube-prometheus-namespace-by-workload 1 6d +default configmap/prometheus-kube-prometheus-node-cluster-rsrc-use 1 6d +default configmap/prometheus-kube-prometheus-node-rsrc-use 1 6d +default configmap/prometheus-kube-prometheus-nodes 1 6d +default configmap/prometheus-kube-prometheus-nodes-darwin 1 6d +default configmap/prometheus-kube-prometheus-persistentvolumesusage 1 6d +default configmap/prometheus-kube-prometheus-pod-total 1 6d +default configmap/prometheus-kube-prometheus-prometheus 1 6d +default configmap/prometheus-kube-prometheus-proxy 1 6d +default configmap/prometheus-kube-prometheus-scheduler 1 6d +default configmap/prometheus-kube-prometheus-stack-grafana 1 6d +default configmap/prometheus-kube-prometheus-stack-grafana-config-dashboards 1 6d +default configmap/prometheus-kube-prometheus-workload-total 1 6d +default configmap/prometheus-prometheus-kube-prometheus-prometheus-rulefiles-0 35 6d +kube-node-lease configmap/kube-root-ca.crt 1 7d1h +kube-public configmap/cluster-info 1 7d1h +kube-public configmap/kube-root-ca.crt 1 7d1h +kube-system configmap/coredns 1 7d1h +kube-system configmap/extension-apiserver-authentication 6 7d1h +kube-system configmap/kube-apiserver-legacy-service-account-token-tracking 1 7d1h +kube-system configmap/kube-proxy 2 7d1h +kube-system configmap/kube-root-ca.crt 1 7d1h +kube-system configmap/kubeadm-config 1 7d1h +kube-system configmap/kubelet-config 1 7d1h +local-path-storage configmap/kube-root-ca.crt 1 7d1h +local-path-storage configmap/local-path-config 4 7d1h +mysql configmap/kube-root-ca.crt 1 3m13s +mysql configmap/mysql 1 3m13s +todoapp configmap/kube-root-ca.crt 1 3m13s +todoapp configmap/todoapp-config 1 3m13s + +NAMESPACE NAME TYPE DATA AGE +default secret/alertmanager-prometheus-kube-prometheus-alertmanager Opaque 1 6d +default secret/alertmanager-prometheus-kube-prometheus-alertmanager-generated Opaque 1 6d +default secret/alertmanager-prometheus-kube-prometheus-alertmanager-tls-assets-0 Opaque 0 6d +default secret/alertmanager-prometheus-kube-prometheus-alertmanager-web-config Opaque 1 6d +default secret/grafana Opaque 3 6d +default secret/prometheus-kube-prometheus-admission Opaque 3 7d +default secret/prometheus-kube-prometheus-stack-grafana Opaque 3 6d +default secret/prometheus-prometheus-kube-prometheus-prometheus Opaque 1 6d +default secret/prometheus-prometheus-kube-prometheus-prometheus-tls-assets-0 Opaque 1 6d +default secret/prometheus-prometheus-kube-prometheus-prometheus-web-config Opaque 1 6d +default secret/sh.helm.release.v1.grafana.v1 helm.sh/release.v1 1 6d +default secret/sh.helm.release.v1.prometheus-kube-prometheus-stack.v1 helm.sh/release.v1 1 6d +default secret/sh.helm.release.v1.todoapp.v1 helm.sh/release.v1 1 3m13s +mysql secret/mysql-secrets Opaque 3 3m13s +todoapp secret/todoapp-secret Opaque 5 3m13s + +NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE +todoapp ingress.networking.k8s.io/todoapp-ingress * 80 3m13s From 4251a7f6f44072fbf801b5509020396add39ca49 Mon Sep 17 00:00:00 2001 From: kirillpolozenko Date: Mon, 13 May 2024 18:40:32 +0300 Subject: [PATCH 6/6] fix eof --- .../helm-chart/todoapp/charts/mysql/templates/service.yml | 1 - .infrastructure/helm-chart/todoapp/templates/pvc.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml index 6b01e3f..46364e8 100644 --- a/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml +++ b/.infrastructure/helm-chart/todoapp/charts/mysql/templates/service.yml @@ -10,4 +10,3 @@ spec: - name: {{ .Chart.Name }} port: {{ .Values.mysql.port }} clusterIP: {{ .Values.mysql.service.clusterIP }} - \ No newline at end of file diff --git a/.infrastructure/helm-chart/todoapp/templates/pvc.yml b/.infrastructure/helm-chart/todoapp/templates/pvc.yml index c57a89e..4d0d27d 100644 --- a/.infrastructure/helm-chart/todoapp/templates/pvc.yml +++ b/.infrastructure/helm-chart/todoapp/templates/pvc.yml @@ -10,4 +10,3 @@ spec: resources: requests: storage: {{ .Values.todoapp.volumes.persistentVolumeClaim.requestStorage }} - \ No newline at end of file