Skip to content

Commit

Permalink
chore: Revise the default NATS Server address logic (#420)
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <[email protected]>
  • Loading branch information
joonas authored Sep 19, 2024
1 parent 5719f0e commit 5ea118e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: chart

env:
HELM_VERSION: v3.14.0
CHART_TESTING_NAMESPACE: chart-testing

on:
push:
Expand Down Expand Up @@ -56,11 +57,15 @@ jobs:
run: |
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm repo update
helm install nats nats/nats -f charts/wadm/ci/nats.yaml
helm install nats nats/nats -f charts/wadm/ci/nats.yaml --namespace ${{ env.CHART_TESTING_NAMESPACE }} --create-namespace
- name: Run chart-testing (install)
- name: Run chart-testing install / same namespace
run: |
ct install --config charts/wadm/ct.yaml
ct install --config charts/wadm/ct.yaml --namespace ${{ env.CHART_TESTING_NAMESPACE }}
- name: Run chart-testing install / across namespaces
run: |
ct install --config charts/wadm/ct.yaml --helm-extra-set-args "--set=wadm.config.nats.server=nats://nats-headless.${{ env.CHART_TESTING_NAMESPACE }}.svc.cluster.local"
publish:
if: ${{ startsWith(github.ref, 'refs/tags/chart-v') }}
Expand Down
2 changes: 1 addition & 1 deletion charts/wadm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "0.2.6"
version: "0.2.7"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 0 additions & 4 deletions charts/wadm/ci/ct-install-values.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions charts/wadm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ app.kubernetes.io/name: {{ include "wadm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "wadm.nats.server" -}}
- name: WADM_NATS_SERVER
{{- if .Values.wadm.config.nats.server }}
value: {{ .Values.wadm.config.nats.server | quote }}
{{- else }}
value: nats-headless.{{ .Release.Namespace }}.svc.cluster.local
{{- end }}
{{- end }}

{{- define "wadm.nats.auth" -}}
{{- if .Values.wadm.config.nats.creds.secretName -}}
- name: WADM_NATS_CREDS_FILE
Expand Down
3 changes: 1 addition & 2 deletions charts/wadm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ spec:
image: "{{ .Values.wadm.image.repository }}:{{ .Values.wadm.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.wadm.image.pullPolicy }}
env:
- name: WADM_NATS_SERVER
value: {{ .Values.wadm.config.nats.server | quote }}
{{- include "wadm.nats.server" . | nindent 12 }}
{{- include "wadm.nats.auth" . | nindent 12 }}
{{- if .Values.wadm.config.nats.tlsCaFile }}
- name: WADM_NATS_TLS_CA_FILE
Expand Down
2 changes: 1 addition & 1 deletion charts/wadm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wadm:
hostId: ""
logLevel: ""
nats:
server: "127.0.0.1:4222"
server: ""
jetstreamDomain: ""
tlsCaFile: ""
creds:
Expand Down

0 comments on commit 5ea118e

Please sign in to comment.