Skip to content

Commit

Permalink
Kafka variable config (#94)
Browse files Browse the repository at this point in the history
Co-authored-by: Yogesh Garg <yogeshg91@gmail.com>
  • Loading branch information
jsbroks and yogeshg authored Mar 20, 2024
1 parent f14f489 commit a6940ff
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/operator-wandb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: operator-wandb
description: A Helm chart for deploying W&B to Kubernetes
type: application
version: 0.11.0
version: 0.11.1
appVersion: 1.0.0
icon: https://wandb.ai/logo.svg

Expand Down
3 changes: 3 additions & 0 deletions charts/operator-wandb/charts/app/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ metadata:
{{- toYaml .Values.service.labels | nindent 4 }}
{{- end }}
annotations:
prometheus.io/scrape: 'true'
prometheus.io/path: '/metrics'
prometheus.io/port: '8181'
{{- if .Values.service.annotations -}}
{{- toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
Expand Down
54 changes: 54 additions & 0 deletions charts/operator-wandb/templates/_kafka.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{/*
These are the variables a service can expect
- name: KAFKA_BROKER_URL
value: "{{ include "wandb.kafka.brokerUrl" . }}"
- name: KAFKA_BROKER_PORT
value: "{{ include "wandb.kafka.brokerPort" . }}"
- name: KAFKA_CLIENT_USER
value: "{{ include "wandb.kafka.user" . }}"
- name: KAFKA_CLIENT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "wandb.kafka.passwordSecret" . }}
key: KAFKA_CLIENT_PASSWORD
*/}}

{{/*
Return the kafka client user
*/}}
{{- define "wandb.kafka.user" -}}
{{ .Values.global.kafka.user }}
{{- end -}}

{{/*
Return the kafka client password
*/}}
{{- define "wandb.kafka.password" -}}
{{ .Values.global.kafka.password }}
{{- end -}}


{{/*
Return name of secret where kafka information is stored
*/}}
{{- define "wandb.kafka.passwordSecret" -}}
{{- print .Release.Name "-kafka" -}}
{{- end -}}

{{/*
Return the kafka broker url port
*/}}
{{- define "wandb.kafka.brokerUrl" -}}
{{- if eq .Values.global.redis.host "" -}}
{{ printf "%s-%s" .Release.Name "kafka" }}
{{- else -}}
{{ .Values.global.kafka.brokerUrl }}
{{- end -}}
{{- end -}}

{{/*
Return kafka broker url port
*/}}
{{- define "wandb.kafka.brokerPort" -}}
{{- print .Values.global.kafka.brokerPort -}}
{{- end -}}
9 changes: 9 additions & 0 deletions charts/operator-wandb/templates/kafka.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $secretName := (include "wandb.kafka.passwordSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels:
{{- include "wandb.commonLabels" . | nindent 4 }}
data:
KAFKA_CLIENT_PASSWORD: {{ include "wandb.kafka.password" . | b64enc }}
14 changes: 7 additions & 7 deletions charts/operator-wandb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ global:
caCert: ""

kafka:
# The following values are anchored here, and referenced by alias later for the kafka dependency chart.
user: &kafkaUser "user1"
# The following values are anchored here, and referenced by alias later for
# the kafka dependency chart.
user: &kafkaUser "wandb"
password: &kafkaPassword "wandb"
consumerUrl: "wandb-kafka"
consumerPort: 9092
producerUrl: "wandb-kafka-controller-headless-0:9092,wandb-kafka-controller-headless-1:9092,wandb-kafka-controller-headless-2:9092"
brokerUrl: ""
brokerPort: 9092

ingress:
nameOverride: ""
Expand Down Expand Up @@ -191,11 +191,11 @@ kafka:
controller:
password: "controller-pw"
# The client usernames and passwords are alias references from the global values section at the beginning of this file.
# Please update the values there to ensure proper propogation to the application
# Please update the values there to ensure proper propagation to the application
client:
users:
- *kafkaUser
passwords: *kafkaPassword
kraft:
# This field is a UUID. It is *strongly* recommended to supply a new UUID yourself for production installs.
clusterId: "2cee15fc-949d-473c-814e-2bdfa41d4091"
clusterId: "ffFF1H3AQKGdBnsqAbJKew"

0 comments on commit a6940ff

Please sign in to comment.