Skip to content

Commit

Permalink
feat: experimental support for Casc
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed Nov 3, 2024
1 parent e8be09b commit 0eca04a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
local/
/.cr-release-packages
/values.yaml
/casc.yaml
2 changes: 1 addition & 1 deletion charts/ontrack/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.12.0
version: 0.12.1
# 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
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
8 changes: 8 additions & 0 deletions charts/ontrack/templates/casc-config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if and .Values.ontrack.casc.enabled .Values.casc -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ontrack.fullname" . }}-casc
data:
casc.yaml: |-{{ .Values.casc | toYaml | nindent 4 }}
{{- end -}}
31 changes: 22 additions & 9 deletions charts/ontrack/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ spec:
- name: casc-secret
mountPath: "{{ .Values.ontrack.casc.directory }}/secret"
{{- end }}
{{- if .Values.casc }}
- name: casc-values
mountPath: "{{ .Values.ontrack.casc.directory }}/values"
{{- end }}
{{- end }}
{{- if eq .Values.ontrack.config.key_store "secret" }}
- name: ontrack-key-store
Expand Down Expand Up @@ -170,16 +174,19 @@ spec:
{{- if .Values.ontrack.casc.enabled }}
- name: ONTRACK_CONFIG_CASC_ENABLED
value: "true"
{{- if and .Values.ontrack.casc.map .Values.ontrack.casc.secret }}
- name: ONTRACK_CONFIG_CASC_LOCATIONS
value: "file://{{ .Values.ontrack.casc.directory }}/map,file://{{ .Values.ontrack.casc.directory }}/secret"
{{- else if .Values.ontrack.casc.map }}
{{- $locations := list -}}
{{- if .Values.ontrack.casc.map -}}
{{- $locations = append $locations (printf "file://%s/map" .Values.ontrack.casc.directory) -}}
{{- end -}}
{{- if .Values.ontrack.casc.secret -}}
{{- $locations = append $locations (printf "file://%s/secret" .Values.ontrack.casc.directory) -}}
{{- end -}}
{{- if .Values.casc -}}
{{- $locations = append $locations (printf "file://%s/values" .Values.ontrack.casc.directory) -}}
{{- end -}}
{{- $locationsValue := join "," $locations }}
- name: ONTRACK_CONFIG_CASC_LOCATIONS
value: "file://{{ .Values.ontrack.casc.directory }}/map"
{{- else if .Values.ontrack.casc.secret }}
- name: ONTRACK_CONFIG_CASC_LOCATIONS
value: "file://{{ .Values.ontrack.casc.directory }}/secret"
{{- end }}
value: {{ $locationsValue | quote }}
{{- if .Values.ontrack.casc.reloading.enabled }}
- name: ONTRACK_CONFIG_CASC_RELOADING_ENABLED
value: "true"
Expand Down Expand Up @@ -301,6 +308,12 @@ spec:
secretName: {{ .Values.ontrack.casc.secret | quote }}
optional: false
{{- end }}
{{- if and .Values.ontrack.casc.enabled .Values.casc }}
- name: casc-values
configMap:
name: {{ include "ontrack.fullname" . }}-casc
optional: false
{{- end }}
{{- range .Values.ontrack.casc.secrets.names }}
- name: {{ . | quote }}
secret:
Expand Down
9 changes: 9 additions & 0 deletions charts/ontrack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ ontrack:
upload:
# Enabled
enabled: false
# Casc from values
mapValues:
# Enabling the creating & mapping of a config map holding Casc values
# Casc values are expected to be under the root `casc` object, for example
# casc:
# ontrack:
# # ...
# Name of the entry to hold the values
mapEntryName: "casc.yaml"

# Local database for testing purpose
postgresql:
Expand Down

0 comments on commit 0eca04a

Please sign in to comment.