Skip to content

Commit

Permalink
Merge pull request #62 from alercebroker/s3/kafka-auth
Browse files Browse the repository at this point in the history
feat: add option to use kafka authentication on s3 step
  • Loading branch information
dirodriguezm authored Mar 14, 2023
2 parents 078f6eb + 42ad15c commit 1182c59
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 87 deletions.
2 changes: 1 addition & 1 deletion charts/s3-step/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions charts/s3-step/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 0 additions & 11 deletions charts/s3-step/templates/configmap_atlas.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions charts/s3-step/templates/configmap_ztf.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions charts/s3-step/templates/deployment_atlas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
12 changes: 12 additions & 0 deletions charts/s3-step/templates/deployment_ztf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
{{- if .Values.autoscaling.atlas.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
Expand Down Expand Up @@ -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 }}
29 changes: 0 additions & 29 deletions charts/s3-step/templates/hpa_ztf.yaml

This file was deleted.

12 changes: 11 additions & 1 deletion charts/s3-step/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
---
apiVersion: v1
kind: Secret
metadata:
name: image-pull-access
namespace: {{ .Values.namespace }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
.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 }}
36 changes: 36 additions & 0 deletions charts/s3-step/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 0 additions & 17 deletions charts/s3-step/templates/service_atlas.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions charts/s3-step/templates/service_ztf.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions charts/s3-step/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ configmap:
bucketName: ""
regionName: ""

secrets:
kafkaAuth:
enabled: false
username: ""
password: ""

imageCredentials:
registry: ""
username: ""
Expand Down

0 comments on commit 1182c59

Please sign in to comment.