Skip to content

Commit 2b1185b

Browse files
authored
Merge pull request #48 from jujaga/bugfix/helm-config-decouple
Bugfix: Offer decoupled configmap generation in Helm chart
2 parents c8cf21a + d28b094 commit 2b1185b

File tree

10 files changed

+40
-24
lines changed

10 files changed

+40
-24
lines changed

charts/coms/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: common-object-management-service
33
# This is the chart version. This version number should be incremented each time you make changes
44
# to the chart and its templates, including the app version.
55
# Versions are expected to follow Semantic Versioning (https://semver.org/)
6-
version: 0.0.1
6+
version: 0.0.2
77
kubeVersion: ">= 1.13.0"
88
description: A microservice for managing access control to S3 Objects
99
# A chart can be either an 'application' or a 'library' chart.

charts/coms/templates/NOTES.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
1. Get the application URL by running these commands:
1+
{{- $configMapName := printf "%s-%s" (include "coms.configname" .) "config" }}
2+
{{- $configMap := (lookup "v1" "ConfigMap" .Release.Namespace $configMapName ) }}
3+
Get the application URL by running these commands:
24
{{- if .Values.route.enabled }}
35
http{{ if $.Values.route.tls }}s{{ end }}://{{ .Values.route.host }}{{ .Values.route.path }}
46
{{- else if contains "NodePort" .Values.service.type }}
@@ -16,3 +18,7 @@
1618
echo "Visit http://127.0.0.1:8080 to use your application"
1719
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
1820
{{- end }}
21+
{{- if not $configMap }}
22+
23+
Make sure that ConfigMap "{{ $configMapName }}" is defined in the namespace; the deployment will fail to run without it!
24+
{{- end }}

charts/coms/templates/configmap.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{{- if .Values.config.enabled -}}
1+
{{- if .Values.config.enabled }}
2+
---
23
apiVersion: v1
34
kind: ConfigMap
45
metadata:

charts/coms/templates/deploymentconfig.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
{{- toYaml .Values.resources | nindent 6 }}
2525
rollingParams:
2626
timeoutSeconds: 600
27-
{{- if .Values.config.configMap.DB_ENABLED }}
27+
{{- if or .Values.patroni.enabled .Values.config.configMap.DB_ENABLED }}
2828
pre:
2929
failurePolicy: {{ .Values.failurePolicy }}
3030
execNewPod:
@@ -98,7 +98,7 @@ spec:
9898
env:
9999
- name: NODE_ENV
100100
value: production
101-
{{- if .Values.config.configMap.BASICAUTH_ENABLED }}
101+
{{- if or .Values.features.basicAuth .Values.config.configMap.BASICAUTH_ENABLED }}
102102
- name: BASICAUTH_USERNAME
103103
valueFrom:
104104
secretKeyRef:
@@ -110,7 +110,7 @@ spec:
110110
key: password
111111
name: {{ include "coms.configname" . }}-basicauth
112112
{{- end }}
113-
{{- if .Values.config.configMap.DB_ENABLED }}
113+
{{- if or .Values.patroni.enabled .Values.config.configMap.DB_ENABLED }}
114114
- name: DB_DATABASE
115115
valueFrom:
116116
secretKeyRef:
@@ -129,7 +129,7 @@ spec:
129129
key: app-db-password
130130
name: {{ include "patroni.fullname" .Subcharts.patroni }}
131131
{{- end }}
132-
{{- if .Values.config.configMap.KC_ENABLED }}
132+
{{- if or .Values.features.oidcAuth .Values.config.configMap.KC_ENABLED }}
133133
- name: KC_CLIENTID
134134
valueFrom:
135135
secretKeyRef:

charts/coms/templates/hpa.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.autoscaling.enabled }}
2+
---
23
apiVersion: autoscaling/v2beta2
34
kind: HorizontalPodAutoscaler
45
metadata:

charts/coms/templates/route.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.route.enabled -}}
2+
---
23
apiVersion: route.openshift.io/v1
34
kind: Route
45
metadata:

charts/coms/templates/secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{- $password := (randAlphaNum 32) | b64enc }}
22
{{- $username := (randAlphaNum 32) | b64enc }}
33

4-
{{- $secretName := printf "%s-%s" (include "coms.fullname" .) "basicauth" }}
4+
{{- $secretName := printf "%s-%s" (include "coms.configname" .) "basicauth" }}
55
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName ) }}
66
{{- if not $secret }}
77
---

charts/coms/templates/service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: v1
23
kind: Service
34
metadata:

charts/coms/templates/serviceaccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.serviceAccount.enabled -}}
2+
---
23
apiVersion: v1
34
kind: ServiceAccount
45
metadata:

charts/coms/values.yaml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,31 +95,36 @@ resources:
9595
cpu: 50m
9696
memory: 128Mi
9797

98-
# These values will be wholesale added to the configmap as is; refer to the coms
99-
# documentation for what each of these values mean and whether you need them defined.
100-
# Ensure that all values are represented explicitly as strings, as non-string values will
101-
# not translate over as expected into container environment variables.
102-
# For configuration keys named `*_ENABLED`, either leave them commented/undefined, or set them
103-
# to string value "true".
98+
features:
99+
basicAuth: false
100+
oidcAuth: false
101+
104102
config:
105-
enabled: true
103+
# Set to true if you want to let Helm manage and overwrite your configmaps.
104+
enabled: false
106105

107106
# This should be set to true if and only if you require configmaps and secrets to be release
108107
# scoped. In the event you want all instances in the same namespace to share a similar
109-
# configuration, this should be set to true
110-
releaseScoped: true
111-
108+
# configuration, this should be set to false
109+
releaseScoped: false
110+
111+
# These values will be wholesale added to the configmap as is; refer to the coms
112+
# documentation for what each of these values mean and whether you need them defined.
113+
# Ensure that all values are represented explicitly as strings, as non-string values will
114+
# not translate over as expected into container environment variables.
115+
# For configuration keys named `*_ENABLED`, either leave them commented/undefined, or set them
116+
# to string value "true".
112117
configMap:
113118
# BASICAUTH_ENABLED: "true"
114119

115120
# DB_ENABLED: "true"
116-
# DB_PORT: "5432"
121+
DB_PORT: "5432"
117122

118123
# KC_ENABLED: "true"
119-
# KC_IDENTITYKEY: ~
120-
# KC_PUBLICKEY: ~
121-
# KC_REALM: ~
122-
# KC_SERVERURL: ~
124+
KC_IDENTITYKEY: ~
125+
KC_PUBLICKEY: ~
126+
KC_REALM: ~
127+
KC_SERVERURL: ~
123128

124129
OBJECTSTORAGE_BUCKET: ~
125130
OBJECTSTORAGE_TEMP_EXPIRESIN: "300"
@@ -140,7 +145,7 @@ objectStorageSecretOverride: ~
140145
# Patroni subchart configuration overrides
141146
patroni:
142147
# Controls whether to enable managing a Patroni db dependency as a part of the helm release
143-
enabled: true
148+
enabled: false
144149

145150
# replicaCount: 3
146151
# resources: {}

0 commit comments

Comments
 (0)