From c2b23f71f480e06457cb8c7ad8d693bf7e4e0683 Mon Sep 17 00:00:00 2001 From: Diego Date: Fri, 10 Mar 2023 16:53:06 -0300 Subject: [PATCH 1/2] chore: update chart version --- charts/s3-step/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/s3-step/Chart.yaml b/charts/s3-step/Chart.yaml index 7d4ffa4..05a5eb3 100644 --- a/charts/s3-step/Chart.yaml +++ b/charts/s3-step/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.1.0 description: A Helm chart for Kubernetes name: s3-step type: application -version: 0.1.0 +version: 0.2.0 From 42ad15c7f1095205213a9c9be71762acb7caedfe Mon Sep 17 00:00:00 2001 From: Diego Date: Fri, 10 Mar 2023 16:57:04 -0300 Subject: [PATCH 2/2] feat: add option to use kafka authentication Also merge configmap and service templates --- charts/s3-step/templates/configmap.yaml | 24 +++++++++++++ charts/s3-step/templates/configmap_atlas.yaml | 11 ------ charts/s3-step/templates/configmap_ztf.yaml | 11 ------ .../s3-step/templates/deployment_atlas.yaml | 12 +++++++ charts/s3-step/templates/deployment_ztf.yaml | 12 +++++++ .../templates/{hpa_atlas.yaml => hpa.yaml} | 31 ++++++++++++++++ charts/s3-step/templates/hpa_ztf.yaml | 29 --------------- charts/s3-step/templates/secret.yaml | 12 ++++++- charts/s3-step/templates/service.yaml | 36 +++++++++++++++++++ charts/s3-step/templates/service_atlas.yaml | 17 --------- charts/s3-step/templates/service_ztf.yaml | 17 --------- charts/s3-step/values.yaml | 6 ++++ 12 files changed, 132 insertions(+), 86 deletions(-) create mode 100644 charts/s3-step/templates/configmap.yaml delete mode 100644 charts/s3-step/templates/configmap_atlas.yaml delete mode 100644 charts/s3-step/templates/configmap_ztf.yaml rename charts/s3-step/templates/{hpa_atlas.yaml => hpa.yaml} (50%) delete mode 100644 charts/s3-step/templates/hpa_ztf.yaml create mode 100644 charts/s3-step/templates/service.yaml delete mode 100644 charts/s3-step/templates/service_atlas.yaml delete mode 100644 charts/s3-step/templates/service_ztf.yaml diff --git a/charts/s3-step/templates/configmap.yaml b/charts/s3-step/templates/configmap.yaml new file mode 100644 index 0000000..ab6e296 --- /dev/null +++ b/charts/s3-step/templates/configmap.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: '{{ include "s3-step.fullname" . }}-atlas' + namespace: {{ .Values.namespace }} +data: + consumer-topics: {{ .Values.configmap.atlas.consumerTopics }} + internal-server: {{ .Values.configmap.atlas.internalServer }} + metrics-topic: {{ .Values.configmap.atlas.metricsTopic }} + bucket-name: {{ .Values.configmap.atlas.bucketName }} + region-name: {{ .Values.configmap.atlas.regionName }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: '{{ include "s3-step.fullname" . }}-ztf' + namespace: {{ .Values.namespace }} +data: + consumer-topics: {{ .Values.configmap.ztf.consumerTopics }} + internal-server: {{ .Values.configmap.ztf.internalServer }} + metrics-topic: {{ .Values.configmap.ztf.metricsTopic }} + bucket-name: {{ .Values.configmap.ztf.bucketName }} + region-name: {{ .Values.configmap.ztf.regionName }} \ No newline at end of file diff --git a/charts/s3-step/templates/configmap_atlas.yaml b/charts/s3-step/templates/configmap_atlas.yaml deleted file mode 100644 index c3a12a6..0000000 --- a/charts/s3-step/templates/configmap_atlas.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: '{{ include "s3-step.fullname" . }}-atlas' - namespace: {{ .Values.namespace }} -data: - consumer-topics: {{ .Values.configmap.atlas.consumerTopics }} - internal-server: {{ .Values.configmap.atlas.internalServer }} - metrics-topic: {{ .Values.configmap.atlas.metricsTopic }} - bucket-name: {{ .Values.configmap.atlas.bucketName }} - region-name: {{ .Values.configmap.atlas.regionName }} \ No newline at end of file diff --git a/charts/s3-step/templates/configmap_ztf.yaml b/charts/s3-step/templates/configmap_ztf.yaml deleted file mode 100644 index 307ab34..0000000 --- a/charts/s3-step/templates/configmap_ztf.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: '{{ include "s3-step.fullname" . }}-ztf' - namespace: {{ .Values.namespace }} -data: - consumer-topics: {{ .Values.configmap.ztf.consumerTopics }} - internal-server: {{ .Values.configmap.ztf.internalServer }} - metrics-topic: {{ .Values.configmap.ztf.metricsTopic }} - bucket-name: {{ .Values.configmap.ztf.bucketName }} - region-name: {{ .Values.configmap.ztf.regionName }} \ No newline at end of file diff --git a/charts/s3-step/templates/deployment_atlas.yaml b/charts/s3-step/templates/deployment_atlas.yaml index 5dee2dd..f797478 100644 --- a/charts/s3-step/templates/deployment_atlas.yaml +++ b/charts/s3-step/templates/deployment_atlas.yaml @@ -72,6 +72,18 @@ spec: configMapKeyRef: name: '{{ include "s3-step.fullname" . }}-atlas' key: region-name + {{- if .Values.secrets.kafkaAuth.enabled }} + - name: KAFKA_USERNAME + valueFrom: + secretKeyRef: + name: kafka-auth + key: username + - name: KAFKA_PASSWORD + valueFrom: + secretKeyRef: + name: kafka-auth + key: password + {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/s3-step/templates/deployment_ztf.yaml b/charts/s3-step/templates/deployment_ztf.yaml index 9fc951b..671afc8 100644 --- a/charts/s3-step/templates/deployment_ztf.yaml +++ b/charts/s3-step/templates/deployment_ztf.yaml @@ -72,6 +72,18 @@ spec: configMapKeyRef: name: '{{ include "s3-step.fullname" . }}-ztf' key: region-name + {{- if .Values.secrets.kafkaAuth.enabled }} + - name: KAFKA_USERNAME + valueFrom: + secretKeyRef: + name: kafka-auth + key: username + - name: KAFKA_PASSWORD + valueFrom: + secretKeyRef: + name: kafka-auth + key: password + {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/s3-step/templates/hpa_atlas.yaml b/charts/s3-step/templates/hpa.yaml similarity index 50% rename from charts/s3-step/templates/hpa_atlas.yaml rename to charts/s3-step/templates/hpa.yaml index 144965d..0b16cce 100644 --- a/charts/s3-step/templates/hpa_atlas.yaml +++ b/charts/s3-step/templates/hpa.yaml @@ -1,3 +1,4 @@ +--- {{- if .Values.autoscaling.atlas.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler @@ -26,4 +27,34 @@ spec: name: memory targetAverageUtilization: {{ .Values.autoscaling.atlas.targetMemoryUtilizationPercentage }} {{- end }} +{{- end }} +--- +{{- if .Values.autoscaling.ztf.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: '{{ include "s3-step.fullname" . }}-ztf' + namespace: {{ .Values.namespace }} + labels: + {{- include "s3-step.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: '{{ include "s3-step.fullname" . }}-ztf' + minReplicas: {{ .Values.autoscaling.ztf.minReplicas }} + maxReplicas: {{ .Values.autoscaling.ztf.maxReplicas }} + metrics: + {{- if .Values.autoscaling.ztf.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.ztf.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.ztf.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.ztf.targetMemoryUtilizationPercentage }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/charts/s3-step/templates/hpa_ztf.yaml b/charts/s3-step/templates/hpa_ztf.yaml deleted file mode 100644 index 30d2a6d..0000000 --- a/charts/s3-step/templates/hpa_ztf.yaml +++ /dev/null @@ -1,29 +0,0 @@ -{{- if .Values.autoscaling.ztf.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: '{{ include "s3-step.fullname" . }}-ztf' - namespace: {{ .Values.namespace }} - labels: - {{- include "s3-step.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: '{{ include "s3-step.fullname" . }}-ztf' - minReplicas: {{ .Values.autoscaling.ztf.minReplicas }} - maxReplicas: {{ .Values.autoscaling.ztf.maxReplicas }} - metrics: - {{- if .Values.autoscaling.ztf.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.ztf.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.ztf.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.ztf.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/s3-step/templates/secret.yaml b/charts/s3-step/templates/secret.yaml index a36eb4d..dd6e332 100644 --- a/charts/s3-step/templates/secret.yaml +++ b/charts/s3-step/templates/secret.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Secret metadata: @@ -5,4 +6,13 @@ metadata: namespace: {{ .Values.namespace }} type: kubernetes.io/dockerconfigjson data: - .dockerconfigjson: {{ template "imagePullSecret" . }} \ No newline at end of file + .dockerconfigjson: {{ template "imagePullSecret" . }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: kafka-auth + namespace: {{ .Values.namespace }} +stringData: + username: {{ .Values.secrets.kafkaAuth.username }} + password: {{ .Values.secrets.kafkaAuth.password }} \ No newline at end of file diff --git a/charts/s3-step/templates/service.yaml b/charts/s3-step/templates/service.yaml new file mode 100644 index 0000000..c5ec94e --- /dev/null +++ b/charts/s3-step/templates/service.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: '{{ include "s3-step.fullname" . }}-atlas' + namespace: {{ .Values.namespace }} + labels: + {{- include "s3-step.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.atlas.type }} + ports: + - port: {{ .Values.service.atlas.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: '{{ include "s3-step.name" . }}-atlas' + app.kubernetes.io/instance: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: '{{ include "s3-step.fullname" . }}-ztf' + namespace: {{ .Values.namespace }} + labels: + {{- include "s3-step.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.ztf.type }} + ports: + - port: {{ .Values.service.ztf.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: '{{ include "s3-step.name" . }}-ztf' + app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/s3-step/templates/service_atlas.yaml b/charts/s3-step/templates/service_atlas.yaml deleted file mode 100644 index 5f7abc0..0000000 --- a/charts/s3-step/templates/service_atlas.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: '{{ include "s3-step.fullname" . }}-atlas' - namespace: {{ .Values.namespace }} - labels: - {{- include "s3-step.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.atlas.type }} - ports: - - port: {{ .Values.service.atlas.port }} - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: '{{ include "s3-step.name" . }}-atlas' - app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/s3-step/templates/service_ztf.yaml b/charts/s3-step/templates/service_ztf.yaml deleted file mode 100644 index 5593524..0000000 --- a/charts/s3-step/templates/service_ztf.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: '{{ include "s3-step.fullname" . }}-ztf' - namespace: {{ .Values.namespace }} - labels: - {{- include "s3-step.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.ztf.type }} - ports: - - port: {{ .Values.service.ztf.port }} - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: '{{ include "s3-step.name" . }}-ztf' - app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/s3-step/values.yaml b/charts/s3-step/values.yaml index 007080c..60ebbcf 100644 --- a/charts/s3-step/values.yaml +++ b/charts/s3-step/values.yaml @@ -68,6 +68,12 @@ configmap: bucketName: "" regionName: "" +secrets: + kafkaAuth: + enabled: false + username: "" + password: "" + imageCredentials: registry: "" username: ""