From e357e675f32e30fe6c3033dc4988ee9b782ef1e6 Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Wed, 24 Apr 2024 07:43:56 +0200 Subject: [PATCH] Helm: don't use subcharts anymore (#617) * refactor: convert subcharts to "normal" files * ci: update buildChart script --- .ci/helm/buildChart.js | 5 +- helm/Chart.yaml | 14 ---- helm/charts/admincli/Chart.yaml | 9 --- helm/charts/adminui/Chart.yaml | 9 --- helm/charts/adminui/templates/hpa.yaml | 28 -------- helm/charts/consumerapi/Chart.yaml | 9 --- .../consumerapi/templates/backendconfig.yaml | 17 ----- helm/charts/consumerapi/templates/hpa.yaml | 28 -------- helm/charts/eventhandler/Chart.yaml | 9 --- .../admincli/templates/deployment.yaml | 26 ++++---- .../adminui}/templates/deployment.yaml | 66 +++++++++---------- helm/templates/adminui/templates/hpa.yaml | 28 ++++++++ .../adminui/templates/service.yaml | 2 +- .../consumerapi/templates/backendconfig.yaml | 17 +++++ .../consumerapi}/templates/deployment.yaml | 66 +++++++++---------- helm/templates/consumerapi/templates/hpa.yaml | 28 ++++++++ .../consumerapi/templates/httproute.yaml | 10 +-- .../consumerapi/templates/ingress.yaml | 6 +- .../consumerapi/templates/service.yaml | 10 +-- .../eventhandler/templates/deployment.yaml | 26 ++++---- .../rabbitmq-password-secret.yaml | 0 21 files changed, 180 insertions(+), 233 deletions(-) delete mode 100644 helm/charts/admincli/Chart.yaml delete mode 100644 helm/charts/adminui/Chart.yaml delete mode 100644 helm/charts/adminui/templates/hpa.yaml delete mode 100644 helm/charts/consumerapi/Chart.yaml delete mode 100644 helm/charts/consumerapi/templates/backendconfig.yaml delete mode 100644 helm/charts/consumerapi/templates/hpa.yaml delete mode 100644 helm/charts/eventhandler/Chart.yaml rename helm/{charts => templates}/admincli/templates/deployment.yaml (59%) rename helm/{charts/consumerapi => templates/adminui}/templates/deployment.yaml (60%) create mode 100644 helm/templates/adminui/templates/hpa.yaml rename helm/{charts => templates}/adminui/templates/service.yaml (91%) create mode 100644 helm/templates/consumerapi/templates/backendconfig.yaml rename helm/{charts/adminui => templates/consumerapi}/templates/deployment.yaml (58%) create mode 100644 helm/templates/consumerapi/templates/hpa.yaml rename helm/{charts => templates}/consumerapi/templates/httproute.yaml (58%) rename helm/{charts => templates}/consumerapi/templates/ingress.yaml (84%) rename helm/{charts => templates}/consumerapi/templates/service.yaml (63%) rename helm/{charts => templates}/eventhandler/templates/deployment.yaml (67%) rename helm/templates/{ => rabbitmq}/rabbitmq-password-secret.yaml (100%) diff --git a/.ci/helm/buildChart.js b/.ci/helm/buildChart.js index ed917a0e9e..2a93da2ca8 100755 --- a/.ci/helm/buildChart.js +++ b/.ci/helm/buildChart.js @@ -7,7 +7,4 @@ const version = getRequiredEnvVar("VERSION"); await $`helm dependency update helm`; -// replace <> with the value of `version` in all Chart.yaml files in helm folder -await $`find helm -name Chart.yaml -exec sed -i -e 's/__app_version__/${version}/g' {} +`; - -await $`helm package --version ${version} helm`; +await $`helm package --version ${version} --app-version ${version} helm`; diff --git a/helm/Chart.yaml b/helm/Chart.yaml index d2abe8d5f2..8b725e3ee8 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -6,20 +6,6 @@ type: application # version is set by the .ci/helm/pushChart.sh script version: 0.0.0 -dependencies: - - name: admincli - version: "*" - repository: file://charts/admincli - - name: adminui - version: "*" - repository: file://charts/adminui - - name: consumerapi - version: "*" - repository: file://charts/consumerapi - - name: eventhandler - version: "*" - repository: file://charts/eventhandler - icon: https://raw.githubusercontent.com/nmshd/nmshd.github.io/main/assets/images/Logo.svg home: https://enmeshed.eu sources: diff --git a/helm/charts/admincli/Chart.yaml b/helm/charts/admincli/Chart.yaml deleted file mode 100644 index 54002a6002..0000000000 --- a/helm/charts/admincli/Chart.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v2 -name: admincli -description: A Helm chart for Kubernetes - -type: application - -version: "1.0.0" - -appVersion: "__appVersion__" diff --git a/helm/charts/adminui/Chart.yaml b/helm/charts/adminui/Chart.yaml deleted file mode 100644 index 76d2c27b25..0000000000 --- a/helm/charts/adminui/Chart.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v2 -name: adminui -description: A Helm chart for Kubernetes - -type: application - -version: "1.0.0" - -appVersion: "__appVersion__" diff --git a/helm/charts/adminui/templates/hpa.yaml b/helm/charts/adminui/templates/hpa.yaml deleted file mode 100644 index 1711417ec0..0000000000 --- a/helm/charts/adminui/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "global.name" . }} - labels: - {{- include "global.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "global.name" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/helm/charts/consumerapi/Chart.yaml b/helm/charts/consumerapi/Chart.yaml deleted file mode 100644 index bf0efeb8cf..0000000000 --- a/helm/charts/consumerapi/Chart.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v2 -name: consumerapi -description: A Helm chart for Kubernetes - -type: application - -version: "1.0.0" - -appVersion: "__appVersion__" diff --git a/helm/charts/consumerapi/templates/backendconfig.yaml b/helm/charts/consumerapi/templates/backendconfig.yaml deleted file mode 100644 index fdc8046cfb..0000000000 --- a/helm/charts/consumerapi/templates/backendconfig.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if eq .Values.global.provider "GoogleCloud" }} -apiVersion: cloud.google.com/v1 -kind: BackendConfig -metadata: - labels: - {{- include "global.labels" . | nindent 4 }} - name: {{ include "global.name" . }} -spec: - healthCheck: - checkIntervalSec: {{ .Values.backendConfig.healthCheck.checkIntervalSec }} - timeoutSec: {{ .Values.backendConfig.healthCheck.timeoutSec }} - healthyThreshold: {{ .Values.backendConfig.healthCheck.healthyThreshold }} - unhealthyThreshold: {{ .Values.backendConfig.healthCheck.unhealthyThreshold }} - type: HTTP - requestPath: /health - port: 8080 -{{- end }} diff --git a/helm/charts/consumerapi/templates/hpa.yaml b/helm/charts/consumerapi/templates/hpa.yaml deleted file mode 100644 index 1711417ec0..0000000000 --- a/helm/charts/consumerapi/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "global.name" . }} - labels: - {{- include "global.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "global.name" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/helm/charts/eventhandler/Chart.yaml b/helm/charts/eventhandler/Chart.yaml deleted file mode 100644 index 7230025f17..0000000000 --- a/helm/charts/eventhandler/Chart.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v2 -name: eventhandler -description: A Helm chart for Kubernetes - -type: application - -version: "1.0.0" - -appVersion: "__appVersion__" diff --git a/helm/charts/admincli/templates/deployment.yaml b/helm/templates/admincli/templates/deployment.yaml similarity index 59% rename from helm/charts/admincli/templates/deployment.yaml rename to helm/templates/admincli/templates/deployment.yaml index 03f8b99a57..5b872db345 100644 --- a/helm/charts/admincli/templates/deployment.yaml +++ b/helm/templates/admincli/templates/deployment.yaml @@ -12,49 +12,49 @@ spec: app: {{ include "global.name" . }} template: metadata: - {{- with .Values.podAnnotations }} + {{- with .Values.admincli.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: app: {{ include "global.name" . }} spec: - {{- with .Values.podSecurityContext }} + {{- with .Values.admincli.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml .Values.admincli.podSecurityContext | nindent 8 }} {{- end }} - {{- with .Values.image.imagePullSecrets }} + {{- with .Values.admincli.image.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ include "global.name" . }} - {{- with .Values.securityContext }} + {{- with .Values.admincli.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 8 }} + {{- toYaml .Values.admincli.securityContext | nindent 8 }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} - image: "{{ .Values.image.repository }}:{{- default .Chart.AppVersion .Values.image.tagOverride }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.admincli.resources | nindent 12 }} + image: "{{ .Values.admincli.image.repository }}:{{- default .Chart.AppVersion .Values.admincli.image.tagOverride }}" + imagePullPolicy: {{ .Values.admincli.image.pullPolicy }} env: - name: Database__Provider value: {{ .Values.global.configuration.modules.devices.infrastructure.sqlDatabase.provider }} - {{- with .Values.env }} + {{- with .Values.admincli.env }} {{- toYaml . | nindent 12 }} {{- end }} tty: true command: - /bin/bash - {{- with .Values.nodeSelector }} + {{- with .Values.admincli.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.admincli.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.admincli.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/charts/consumerapi/templates/deployment.yaml b/helm/templates/adminui/templates/deployment.yaml similarity index 60% rename from helm/charts/consumerapi/templates/deployment.yaml rename to helm/templates/adminui/templates/deployment.yaml index d3148813dd..43aba0b988 100644 --- a/helm/charts/consumerapi/templates/deployment.yaml +++ b/helm/templates/adminui/templates/deployment.yaml @@ -6,12 +6,12 @@ metadata: {{- include "global.labels" . | nindent 4 }} app: {{ include "global.name" . }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.adminui.replicas }} strategy: type: RollingUpdate rollingUpdate: - maxSurge: {{ .Values.maxSurge }} - maxUnavailable: {{ .Values.maxUnavailable }} + maxSurge: {{ .Values.adminui.maxSurge }} + maxUnavailable: {{ .Values.adminui.maxUnavailable }} selector: matchLabels: app: {{ include "global.name" . }} @@ -19,7 +19,7 @@ spec: metadata: annotations: checksum/config: {{ .Values.global.configuration | toString | sha256sum }} - {{- with .Values.podAnnotations }} + {{- with .Values.adminui.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: @@ -29,15 +29,15 @@ spec: {{- with .Values.global.serviceAccount.name}} serviceAccountName: {{ . }} {{- end }} - {{- with .Values.podSecurityContext }} + {{- with .Values.adminui.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml .Values.adminui.podSecurityContext | nindent 8 }} {{- end }} - {{- with .Values.image.imagePullSecrets }} + {{- with .Values.adminui.image.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.podAnnotations }} + {{- with .Values.adminui.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} @@ -47,18 +47,34 @@ spec: name: configuration containers: - name: {{ include "global.name" . }} - {{- with .Values.securityContext }} + {{- with .Values.adminui.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 8 }} + {{- toYaml .Values.adminui.securityContext | nindent 8 }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} - image: "{{ .Values.image.repository }}:{{- default .Chart.AppVersion .Values.image.tagOverride }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.adminui.resources | nindent 12 }} + image: "{{ .Values.adminui.image.repository }}:{{- default .Chart.AppVersion .Values.adminui.image.tagOverride }}" + imagePullPolicy: {{ .Values.adminui.image.pullPolicy }} ports: - name: http containerPort: 8080 protocol: TCP + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: {{ .Values.adminui.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.adminui.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.adminui.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.adminui.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: {{ .Values.adminui.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.adminui.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.adminui.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.adminui.readinessProbe.failureThreshold }} volumeMounts: - name: settings-override mountPath: /app/appsettings.override.json @@ -78,34 +94,18 @@ spec: name: rabbitmq-password key: "VALUE" {{- end }} - {{- with .Values.env }} + {{- with .Values.adminui.env }} {{- toYaml . | nindent 12 }} {{- end }} - livenessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - readinessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- with .Values.nodeSelector }} + {{- with .Values.adminui.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.adminui.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.adminui.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/templates/adminui/templates/hpa.yaml b/helm/templates/adminui/templates/hpa.yaml new file mode 100644 index 0000000000..a58f4203c3 --- /dev/null +++ b/helm/templates/adminui/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.adminui.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "global.name" . }} + labels: + {{- include "global.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "global.name" . }} + minReplicas: {{ .Values.adminui.autoscaling.minReplicas }} + maxReplicas: {{ .Values.adminui.autoscaling.maxReplicas }} + metrics: + {{- if .Values.adminui.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.adminui.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.adminui.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.adminui.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm/charts/adminui/templates/service.yaml b/helm/templates/adminui/templates/service.yaml similarity index 91% rename from helm/charts/adminui/templates/service.yaml rename to helm/templates/adminui/templates/service.yaml index 25ac18ec29..4ef1b52b64 100644 --- a/helm/charts/adminui/templates/service.yaml +++ b/helm/templates/adminui/templates/service.yaml @@ -10,7 +10,7 @@ metadata: cloud.google.com/backend-config: '{"default": "{{ include "global.name" . }}"}' {{- end }} spec: - type: {{ .Values.service.type }} + type: {{ .Values.adminui.service.type }} ports: - port: 8080 targetPort: 8080 diff --git a/helm/templates/consumerapi/templates/backendconfig.yaml b/helm/templates/consumerapi/templates/backendconfig.yaml new file mode 100644 index 0000000000..05c998b615 --- /dev/null +++ b/helm/templates/consumerapi/templates/backendconfig.yaml @@ -0,0 +1,17 @@ +{{- if eq .Values.global.provider "GoogleCloud" }} +apiVersion: cloud.google.com/v1 +kind: BackendConfig +metadata: + labels: + {{- include "global.labels" . | nindent 4 }} + name: {{ include "global.name" . }} +spec: + healthCheck: + checkIntervalSec: {{ .Values.consumerapi.backendConfig.healthCheck.checkIntervalSec }} + timeoutSec: {{ .Values.consumerapi.backendConfig.healthCheck.timeoutSec }} + healthyThreshold: {{ .Values.consumerapi.backendConfig.healthCheck.healthyThreshold }} + unhealthyThreshold: {{ .Values.consumerapi.backendConfig.healthCheck.unhealthyThreshold }} + type: HTTP + requestPath: /health + port: 8080 +{{- end }} diff --git a/helm/charts/adminui/templates/deployment.yaml b/helm/templates/consumerapi/templates/deployment.yaml similarity index 58% rename from helm/charts/adminui/templates/deployment.yaml rename to helm/templates/consumerapi/templates/deployment.yaml index 5d847a0209..eeb699c772 100644 --- a/helm/charts/adminui/templates/deployment.yaml +++ b/helm/templates/consumerapi/templates/deployment.yaml @@ -6,12 +6,12 @@ metadata: {{- include "global.labels" . | nindent 4 }} app: {{ include "global.name" . }} spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.consumerapi.replicas }} strategy: type: RollingUpdate rollingUpdate: - maxSurge: {{ .Values.maxSurge }} - maxUnavailable: {{ .Values.maxUnavailable }} + maxSurge: {{ .Values.consumerapi.maxSurge }} + maxUnavailable: {{ .Values.consumerapi.maxUnavailable }} selector: matchLabels: app: {{ include "global.name" . }} @@ -19,7 +19,7 @@ spec: metadata: annotations: checksum/config: {{ .Values.global.configuration | toString | sha256sum }} - {{- with .Values.podAnnotations }} + {{- with .Values.consumerapi.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: @@ -29,15 +29,15 @@ spec: {{- with .Values.global.serviceAccount.name}} serviceAccountName: {{ . }} {{- end }} - {{- with .Values.podSecurityContext }} + {{- with .Values.consumerapi.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml .Values.consumerapi.podSecurityContext | nindent 8 }} {{- end }} - {{- with .Values.image.imagePullSecrets }} + {{- with .Values.consumerapi.image.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.podAnnotations }} + {{- with .Values.consumerapi.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} @@ -47,34 +47,18 @@ spec: name: configuration containers: - name: {{ include "global.name" . }} - {{- with .Values.securityContext }} + {{- with .Values.consumerapi.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 8 }} + {{- toYaml .Values.consumerapi.securityContext | nindent 8 }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} - image: "{{ .Values.image.repository }}:{{- default .Chart.AppVersion .Values.image.tagOverride }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.consumerapi.resources | nindent 12 }} + image: "{{ .Values.consumerapi.image.repository }}:{{- default .Chart.AppVersion .Values.consumerapi.image.tagOverride }}" + imagePullPolicy: {{ .Values.consumerapi.image.pullPolicy }} ports: - name: http containerPort: 8080 protocol: TCP - livenessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - readinessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} volumeMounts: - name: settings-override mountPath: /app/appsettings.override.json @@ -94,18 +78,34 @@ spec: name: rabbitmq-password key: "VALUE" {{- end }} - {{- with .Values.env }} + {{- with .Values.consumerapi.env }} {{- toYaml . | nindent 12 }} {{- end }} - {{- with .Values.nodeSelector }} + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: {{ .Values.consumerapi.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.consumerapi.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.consumerapi.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.consumerapi.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: {{ .Values.consumerapi.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.consumerapi.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.consumerapi.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.consumerapi.readinessProbe.failureThreshold }} + {{- with .Values.consumerapi.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.consumerapi.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.consumerapi.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/templates/consumerapi/templates/hpa.yaml b/helm/templates/consumerapi/templates/hpa.yaml new file mode 100644 index 0000000000..816ad94b62 --- /dev/null +++ b/helm/templates/consumerapi/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.consumerapi.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "global.name" . }} + labels: + {{- include "global.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "global.name" . }} + minReplicas: {{ .Values.consumerapi.autoscaling.minReplicas }} + maxReplicas: {{ .Values.consumerapi.autoscaling.maxReplicas }} + metrics: + {{- if .Values.consumerapi.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.consumerapi.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.consumerapi.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.consumerapi.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm/charts/consumerapi/templates/httproute.yaml b/helm/templates/consumerapi/templates/httproute.yaml similarity index 58% rename from helm/charts/consumerapi/templates/httproute.yaml rename to helm/templates/consumerapi/templates/httproute.yaml index 98397644fa..c1c7a7c46d 100644 --- a/helm/charts/consumerapi/templates/httproute.yaml +++ b/helm/templates/consumerapi/templates/httproute.yaml @@ -1,4 +1,4 @@ -{{- if .Values.httpRoute.enabled }} +{{- if .Values.consumerapi.httpRoute.enabled }} apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: @@ -7,10 +7,10 @@ metadata: {{- include "global.labels" . | nindent 4 }} spec: parentRefs: - - name: {{ .Values.httpRoute.parentRefName }} - namespace: {{ .Values.httpRoute.parentRefNamespace }} - sectionName: {{ .Values.httpRoute.parentRefSectionName }} - {{- with .Values.httpRoute.hostnames }} + - name: {{ .Values.consumerapi.httpRoute.parentRefName }} + namespace: {{ .Values.consumerapi.httpRoute.parentRefNamespace }} + sectionName: {{ .Values.consumerapi.httpRoute.parentRefSectionName }} + {{- with .Values.consumerapi.httpRoute.hostnames }} hostnames: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/helm/charts/consumerapi/templates/ingress.yaml b/helm/templates/consumerapi/templates/ingress.yaml similarity index 84% rename from helm/charts/consumerapi/templates/ingress.yaml rename to helm/templates/consumerapi/templates/ingress.yaml index e4829cd986..ed39cf7cca 100644 --- a/helm/charts/consumerapi/templates/ingress.yaml +++ b/helm/templates/consumerapi/templates/ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.ingress.enabled }} +{{- if .Values.consumerapi.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -8,12 +8,12 @@ metadata: app: {{ include "global.name" . }} annotations: kubernetes.io/ingress.class: azure/application-gateway - appgw.ingress.kubernetes.io/appgw-ssl-certificate: {{ .Values.ingress.certName }} + appgw.ingress.kubernetes.io/appgw-ssl-certificate: {{ .Values.consumerapi.ingress.certName }} appgw.ingress.kubernetes.io/connection-draining: "true" appgw.ingress.kubernetes.io/connection-draining-timeout: "30" spec: rules: - - host: {{ .Values.ingress.host }} + - host: {{ .Values.consumerapi.ingress.host }} http: paths: - path: "/*" diff --git a/helm/charts/consumerapi/templates/service.yaml b/helm/templates/consumerapi/templates/service.yaml similarity index 63% rename from helm/charts/consumerapi/templates/service.yaml rename to helm/templates/consumerapi/templates/service.yaml index 9ae17c7c0d..b1de961c48 100644 --- a/helm/charts/consumerapi/templates/service.yaml +++ b/helm/templates/consumerapi/templates/service.yaml @@ -9,14 +9,14 @@ metadata: annotations: cloud.google.com/backend-config: '{"default": "{{ include "global.name" . }}"}' {{- end }} - {{- if eq .Values.service.type "LoadBalancer" }} + {{- if eq .Values.consumerapi.service.type "LoadBalancer" }} annotations: - service.beta.kubernetes.io/azure-load-balancer-resource-group: {{ .Values.service.loadBalancer.azureResourceGroup }} + service.beta.kubernetes.io/azure-load-balancer-resource-group: {{ .Values.consumerapi.service.loadBalancer.azureResourceGroup }} {{- end }} spec: - type: {{ .Values.service.type }} - {{- if eq .Values.service.type "LoadBalancer" }} - loadBalancerIP: {{ .Values.service.loadBalancer.ip }} + type: {{ .Values.consumerapi.service.type }} + {{- if eq .Values.consumerapi.service.type "LoadBalancer" }} + loadBalancerIP: {{ .Values.consumerapi.service.loadBalancer.ip }} {{- end }} ports: - port: 8080 diff --git a/helm/charts/eventhandler/templates/deployment.yaml b/helm/templates/eventhandler/templates/deployment.yaml similarity index 67% rename from helm/charts/eventhandler/templates/deployment.yaml rename to helm/templates/eventhandler/templates/deployment.yaml index 2ece25396b..536c66ff82 100644 --- a/helm/charts/eventhandler/templates/deployment.yaml +++ b/helm/templates/eventhandler/templates/deployment.yaml @@ -12,18 +12,18 @@ spec: app: {{ include "global.name" . }} template: metadata: - {{- with .Values.podAnnotations }} + {{- with .Values.eventhandler.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: app: {{ include "global.name" . }} spec: - {{- with .Values.podSecurityContext }} + {{- with .Values.eventhandler.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml .Values.eventhandler.podSecurityContext | nindent 8 }} {{- end }} - {{- with .Values.image.imagePullSecrets }} + {{- with .Values.eventhandler.image.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} @@ -33,14 +33,14 @@ spec: name: configuration containers: - name: {{ include "global.name" . }} - {{- with .Values.securityContext }} + {{- with .Values.eventhandler.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 8 }} + {{- toYaml .Values.eventhandler.securityContext | nindent 8 }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} - image: "{{ .Values.image.repository }}:{{- default .Chart.AppVersion .Values.image.tagOverride }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.eventhandler.resources | nindent 12 }} + image: "{{ .Values.eventhandler.image.repository }}:{{- default .Chart.AppVersion .Values.eventhandler.image.tagOverride }}" + imagePullPolicy: {{ .Values.eventhandler.image.pullPolicy }} volumeMounts: - name: settings-override mountPath: /app/appsettings.override.json @@ -60,18 +60,18 @@ spec: name: rabbitmq-password key: "VALUE" {{- end }} - {{- with .Values.env }} + {{- with .Values.eventhandler.env }} {{- toYaml . | nindent 12 }} {{- end }} - {{- with .Values.nodeSelector }} + {{- with .Values.eventhandler.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.eventhandler.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.eventhandler.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/templates/rabbitmq-password-secret.yaml b/helm/templates/rabbitmq/rabbitmq-password-secret.yaml similarity index 100% rename from helm/templates/rabbitmq-password-secret.yaml rename to helm/templates/rabbitmq/rabbitmq-password-secret.yaml