Skip to content

Commit

Permalink
feat(charts): allow using custom configuration schema (#1868)
Browse files Browse the repository at this point in the history
* feat(charts): allow using custom configuration schema

Signed-off-by: iromli <[email protected]>

* docs: revert unnecessary changes to cn-istio-ingress subchart

Signed-off-by: iromli <[email protected]>

---------

Signed-off-by: iromli <[email protected]>
Signed-off-by: Isman Firmansyah <[email protected]>
  • Loading branch information
iromli authored Oct 30, 2024
1 parent f4ce1c3 commit ef07a96
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 82 deletions.
5 changes: 2 additions & 3 deletions charts/gluu-all-in-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ Kubernetes: `>=v1.22.0-0`
| cnAwsSecretsReplicaRegionsFile | string | `"/etc/jans/conf/aws_secrets_replica_regions"` | |
| cnAwsSharedCredentialsFile | string | `"/etc/jans/conf/aws_shared_credential_file"` | |
| cnConfiguratorConfigurationFile | string | `"/etc/jans/conf/configuration.json"` | Path to configuration schema file |
| cnConfiguratorCustomSchema | object | `{"secretName":""}` | Use custom configuration schema in existing secrets. Note, the secrets has to contain the key configuration.json or any basename as specified in cnConfiguratorConfigurationFile. |
| cnConfiguratorCustomSchema.secretName | string | `""` | The name of the secrets used for storing custom configuration schema. |
| cnConfiguratorDumpFile | string | `"/etc/jans/conf/configuration.out.json"` | Path to dumped configuration schema file |
| cnCouchbasePasswordFile | string | `"/etc/jans/conf/couchbase_password"` | Path to Couchbase password file |
| cnCouchbaseSuperuserPasswordFile | string | `"/etc/jans/conf/couchbase_superuser_password"` | Path to Couchbase superuser password file |
Expand Down Expand Up @@ -386,6 +388,3 @@ Kubernetes: `>=v1.22.0-0`
| usrEnvs.secret | object | `{}` | Add custom secret envs to the service variable1: value1 |
| volumeMounts | list | `[]` | Configure any additional volumesMounts that need to be attached to the containers |
| volumes | list | `[]` | Configure any additional volumes that need to be attached to the pod |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
16 changes: 16 additions & 0 deletions charts/gluu-all-in-one/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,19 @@ Create AWS config.
{{- end }}
{{- printf "[%s]\nregion = %s\n" $profile .Values.configmap.cnAwsDefaultRegion }}
{{- end }}

{{/*
Create configuration schema-related objects.
*/}}
{{- define "flex-all-in-one.config.schema" -}}
{{- $commonName := (printf "%s-configuration-file" .Release.Name) -}}
{{- $secretName := .Values.cnConfiguratorCustomSchema.secretName | default $commonName -}}
volumes:
- name: {{ $commonName }}
secret:
secretName: {{ $secretName }}
volumeMounts:
- name: {{ $commonName }}
mountPath: {{ .Values.cnConfiguratorConfigurationFile }}
subPath: {{ .Values.cnConfiguratorConfigurationFile | base }}
{{- end -}}
12 changes: 6 additions & 6 deletions charts/gluu-all-in-one/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ spec:
{{- with (index .Values "auth-server-key-rotation" "volumeMounts") }}
{{- toYaml . | nindent 16 }}
{{- end }}
- mountPath: {{ .Values.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.cnConfiguratorConfigurationFile | base }}
{{- with (include "flex-all-in-one.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-config-cm
Expand All @@ -91,9 +91,9 @@ spec:
{{- with (index .Values "auth-server-key-rotation" "volumes") }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "flex-all-in-one.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
{{- end }}

Expand Down
12 changes: 6 additions & 6 deletions charts/gluu-all-in-one/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: {{ .Values.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.cnConfiguratorConfigurationFile | base }}
{{- with (include "flex-all-in-one.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: /scripts/tls_generator.py
name: {{ include "flex-all-in-one.name" . }}-tls-script
subPath: tls_generator.py
Expand Down Expand Up @@ -141,9 +141,9 @@ spec:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "flex-all-in-one.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ include "flex-all-in-one.name" . }}-tls-script
configMap:
name: {{ include "flex-all-in-one.fullname" . }}-tls-script
Expand Down
3 changes: 3 additions & 0 deletions charts/gluu-all-in-one/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if not .Values.cnConfiguratorCustomSchema.secretName -}}
apiVersion: v1
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -60,6 +62,7 @@ stringData:
"encoded_salt": {{ .Values.salt | quote }}
}
}
{{- end }}

{{- if .Values.saml.enabled }}
---
Expand Down
4 changes: 4 additions & 0 deletions charts/gluu-all-in-one/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ kcAdminCredentialsFile: /etc/jans/conf/kc_admin_creds
cnConfiguratorConfigurationFile: /etc/jans/conf/configuration.json
# -- Path to dumped configuration schema file
cnConfiguratorDumpFile: /etc/jans/conf/configuration.out.json
# -- Use custom configuration schema in existing secrets. Note, the secrets has to contain the key configuration.json or any basename as specified in cnConfiguratorConfigurationFile.
cnConfiguratorCustomSchema:
# -- The name of the secrets used for storing custom configuration schema.
secretName: ""

# ingress properties
istio:
Expand Down
7 changes: 3 additions & 4 deletions charts/gluu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ Kubernetes: `>=v1.21.0-0`
| global.casa.ingress.casaLabels | object | `{}` | Casa ingress resource labels. key app is taken |
| global.cloud.testEnviroment | bool | `false` | Boolean flag if enabled will strip resources requests and limits from all services. |
| global.cnConfiguratorConfigurationFile | string | `"/etc/jans/conf/configuration.json"` | Path to configuration schema file |
| global.cnConfiguratorCustomSchema | object | `{"secretName":""}` | Use custom configuration schema in existing secrets. Note, the secrets has to contain the key configuration.json or any basename as specified in cnConfiguratorConfigurationFile. |
| global.cnConfiguratorCustomSchema.secretName | string | `""` | The name of the secrets used for storing custom configuration schema. |
| global.cnConfiguratorDumpFile | string | `"/etc/jans/conf/configuration.out.json"` | Path to dumped configuration schema file |
| global.cnCouchbasePasswordFile | string | `"/etc/jans/conf/couchbase_password"` | Path to Couchbase password file |
| global.cnCouchbaseSuperuserPasswordFile | string | `"/etc/jans/conf/couchbase_superuser_password"` | Path to Couchbase superuser password file |
Expand Down Expand Up @@ -658,7 +660,4 @@ Kubernetes: `>=v1.21.0-0`
| scim.usrEnvs.normal | object | `{}` | Add custom normal envs to the service variable1: value1 |
| scim.usrEnvs.secret | object | `{}` | Add custom secret envs to the service variable1: value1 |
| scim.volumeMounts | list | `[]` | Configure any additional volumesMounts that need to be attached to the containers |
| scim.volumes | list | `[]` | Configure any additional volumes that need to be attached to the pod |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| scim.volumes | list | `[]` | Configure any additional volumes that need to be attached to the pod |
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-config-cm
Expand All @@ -91,7 +91,7 @@ spec:
{{- with .Values.volumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
12 changes: 6 additions & 6 deletions charts/gluu/charts/auth-server/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ spec:
- name: {{ include "auth-server.fullname" .}}-updatelbip
mountPath: "/scripts"
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 10 }}
readinessProbe:
Expand Down Expand Up @@ -225,6 +225,6 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
12 changes: 6 additions & 6 deletions charts/gluu/charts/casa/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if and (not .Values.global.isFqdnRegistered ) (or (eq .Values.global.storageClass.provisioner "kubernetes.io/aws-ebs") (eq .Values.global.storageClass.provisioner "openebs.io/local")) }}
- name: {{ include "casa.fullname" .}}-updatelbip
mountPath: "/scripts"
Expand All @@ -136,9 +136,9 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not .Values.global.isFqdnRegistered }}
hostAliases:
- ip: {{ .Values.global.lbIp }}
Expand Down
9 changes: 6 additions & 3 deletions charts/gluu/charts/config-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ spec:
- name: {{ include "config-api.name" . }}-updatelbip
mountPath: /scripts
{{- end }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
Expand All @@ -123,9 +126,9 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not .Values.global.isFqdnRegistered }}
hostAliases:
- ip: {{ .Values.global.lbIp }}
Expand Down
12 changes: 6 additions & 6 deletions charts/gluu/charts/config/templates/load-init-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ spec:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ include "config.fullname" . }}-tls-script
configMap:
name: {{ include "config.fullname" . }}-tls-script
Expand All @@ -62,9 +62,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: /scripts/tls_generator.py
name: {{ include "config.fullname" . }}-tls-script
subPath: tls_generator.py
Expand Down
2 changes: 2 additions & 0 deletions charts/gluu/charts/config/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.global.cnConfiguratorCustomSchema.secretName -}}
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -60,6 +61,7 @@ stringData:
"encoded_salt": {{ .Values.salt | quote }}
}
}
{{- end -}}

{{- if .Values.global.saml.enabled }}
---
Expand Down
12 changes: 6 additions & 6 deletions charts/gluu/charts/fido2/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ spec:
- name: {{ include "fido2.fullname" .}}-updatelbip
mountPath: "/scripts"
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 10 }}
readinessProbe:
Expand All @@ -137,6 +137,6 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
12 changes: 6 additions & 6 deletions charts/gluu/charts/kc-scheduler/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-config-cm
Expand All @@ -85,9 +85,9 @@ spec:
{{- with .Values.volumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
{{- if not .Values.global.isFqdnRegistered }}
hostAliases:
Expand Down
12 changes: 6 additions & 6 deletions charts/gluu/charts/link/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ spec:
- name: {{ include "link.name" . }}-updatelbip
mountPath: /scripts
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.global.cloud.testEnviroment }}
resources: {}
{{- else }}
Expand All @@ -122,9 +122,9 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not .Values.global.isFqdnRegistered }}
hostAliases:
- ip: {{ .Values.global.lbIp }}
Expand Down
12 changes: 6 additions & 6 deletions charts/gluu/charts/persistence/templates/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ spec:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
12 changes: 6 additions & 6 deletions charts/gluu/charts/saml/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ spec:
- name: {{ include "saml.fullname" .}}-updatelbip
mountPath: "/scripts"
{{- end }}
- mountPath: {{ .Values.global.cnConfiguratorConfigurationFile }}
name: {{ .Release.Name }}-configuration-file
subPath: {{ .Values.global.cnConfiguratorConfigurationFile | base }}
{{- with (include "cn.config.schema" . | fromYaml).volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
Expand All @@ -142,9 +142,9 @@ spec:
configMap:
name: {{ .Release.Name }}-updatelbip
{{- end }}
- name: {{ .Release.Name }}-configuration-file
secret:
secretName: {{ .Release.Name }}-configuration-file
{{- with (include "cn.config.schema" . | fromYaml).volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not .Values.global.isFqdnRegistered }}
hostAliases:
- ip: {{ .Values.global.lbIp }}
Expand Down
Loading

0 comments on commit ef07a96

Please sign in to comment.