From e29e874970730f546574853f6fdd738c62dbaba4 Mon Sep 17 00:00:00 2001 From: Andrew Dunn <146740128+standrewd@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:32:52 -0400 Subject: [PATCH] Orchestrator Configmap Override (#33) **Description** This adds the ability to use a custom configmap instead of the baseConfig and customConfig in the values files. This allows passing in templated values (Ex: `{{ printf "{{ env.TEST_ENV_VAR}}" }}` ) to the orchestrator without having to do any escaping. Example of using a custom configmap ``` customConfig: useCustomConfigMap: name: orch-configmap-custom ``` Example of generating a configmap from a custom config yaml file. `kubectl create configmap orch-configmap-custom --from-file=maverics.yaml=customConfig.yaml` Example customConfig.yaml ``` version: 0.0.3 logger: level: debug http: address: {{ env.MAVERICS_HTTP_ADDRESS}} ``` **Testing** Tested locally using `helm template` to validate the output is as expected under different scenarios of values. **Scenario 1** useCustomConfigMap defined ``` customConfig: useCustomConfigMap: name: orch-configmap-custom ``` Results in ``` volumes: - name: orchestrator-config configMap: name: orch-configmap-custom ``` **Scenario 2** customConfig defined ``` customConfig: version: 0.0.3 logger: level: debug ``` Results in ``` volumes: - name: orchestrator-config configMap: name: release-name-orchestrator-config ``` **Scenario 3** No customConfig defined Results in ``` volumes: - name: orchestrator-config configMap: name: release-name-orchestrator-config ``` **Documentation** No additional documentation added. --------- Signed-off-by: Andrew Dunn <146740128+standrewd@users.noreply.github.com> --- README.md | 4 ++++ charts/orchestrator/Chart.yaml | 2 +- charts/orchestrator/README.md | 16 +++++++++++++++ charts/orchestrator/example-values/README.md | 20 ++++++++++++++++--- ...minimal-orchestrator-custom-configmap.yaml | 12 +++++++++++ charts/orchestrator/templates/configmap.yaml | 2 ++ .../orchestrator/templates/statefulset.yaml | 6 +++++- charts/orchestrator/values.schema.json | 3 +++ charts/orchestrator/values.yaml | 4 ++++ 9 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 charts/orchestrator/example-values/minimal-orchestrator-custom-configmap.yaml diff --git a/README.md b/README.md index 937b584..27f3329 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,7 @@ The documentation for the Maverics Orchestrator Helm Chart is available ## Support If you run into an issue, bug or have a question, please reach out to the [Strata Identity team](https://www.strata.io/company/contact/). + +## Testing +Tested locally using `helm template` to validate the output is as expected under different scenarios of values. +`helm template charts/orchestrator --values charts/orchestrator/example-values/minimal-orchestrator-custom-configmap.yaml` \ No newline at end of file diff --git a/charts/orchestrator/Chart.yaml b/charts/orchestrator/Chart.yaml index fe506b4..3ea10a9 100644 --- a/charts/orchestrator/Chart.yaml +++ b/charts/orchestrator/Chart.yaml @@ -20,7 +20,7 @@ type: application # This is the chart version. This version number should be incremented each time we # make changes to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.12 +version: 0.1.13 # This is the version number of the application being deployed. This version number # should be incremented each time we make changes to the application. Versions are diff --git a/charts/orchestrator/README.md b/charts/orchestrator/README.md index 771d68f..832918e 100644 --- a/charts/orchestrator/README.md +++ b/charts/orchestrator/README.md @@ -19,6 +19,8 @@ manager. - [FAQs](#faqs) - [Deployment Options](#deployment-options) - [Configuration](#configuration) + - [Troubleshooting](#troubleshooting) + - [Pod Won't Start](#pod-wont-start) ## Prerequisites @@ -73,3 +75,17 @@ See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_h ```console helm show values strata/orchestrator ``` + +## Troubleshooting +### Pod Won't Start +If the pod will not start you can validate the reason using the following command +```console +kubectl describe pod [RELEASE_NAME]-orchestrator-0 +``` + +At the bottom under `Events:` you should be able to see output similiar to below +```console + Type Reason Age From Message + ---- ------ ---- ---- ------- + Warning FailedMount 119s (x10 over 6m9s) kubelet MountVolume.SetUp failed for volume "orchestrator-config" : configmap "myCustomConfig" not found +``` \ No newline at end of file diff --git a/charts/orchestrator/example-values/README.md b/charts/orchestrator/example-values/README.md index 905263d..1ff79a0 100644 --- a/charts/orchestrator/example-values/README.md +++ b/charts/orchestrator/example-values/README.md @@ -3,10 +3,24 @@ The YAML files in this directory provide basic example configurations for common Orchestrator deployment scenarios on Kubernetes. -* [minimal-orchestrator-openshift.yaml](./minimal-orchestrator-openshift.yaml) TODO +* [minimal-orchestrator-openshift.yaml](./minimal-orchestrator-openshift.yaml) + + TODO -* [minimal-orchestrator-standalone-cloud-local-config.yaml](./minimal-orchestrator-standalone-cloud-local-config.yaml) TODO +* [minimal-orchestrator-standalone-cloud-local-config.yaml](./minimal-orchestrator-standalone-cloud-local-config.yaml) + + TODO * [minimal-orchestrator-standalone.yaml](./minimal-orchestrator-standalone.yaml) -installs a bare-minimal single instance Orchestrator. This is useful as a basic + + This examplee installs a bare-minimal single instance Orchestrator. This is useful as a basic starter template. + +* [minimal-orchestrator-custom-configmap.yaml](./minimal-orchestrator-custom-configmap.yaml) + + This example describes how to link an ConfigMap which contains Maverics Orchestrator yaml configuration. + + Example of generating a ConfigMap from a custom ConfigMap object from a local config file. + + ```kubectl create configmap mycustomconfig --from-file=maverics.yml=/etc/maverics/maverics-k8s.yaml``` + diff --git a/charts/orchestrator/example-values/minimal-orchestrator-custom-configmap.yaml b/charts/orchestrator/example-values/minimal-orchestrator-custom-configmap.yaml new file mode 100644 index 0000000..0a5df2c --- /dev/null +++ b/charts/orchestrator/example-values/minimal-orchestrator-custom-configmap.yaml @@ -0,0 +1,12 @@ +image: + repository: alpine + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: latest + +replicaCount: 1 + +orchestrator: + # The name of the ConfigMap to use for the custom Maverics Orchestrator configuration. + # If defined, it will be used instead of the baseConfig and customConfig. + customConfigMapName: mycustomconfig \ No newline at end of file diff --git a/charts/orchestrator/templates/configmap.yaml b/charts/orchestrator/templates/configmap.yaml index 0187fd4..acf6e33 100644 --- a/charts/orchestrator/templates/configmap.yaml +++ b/charts/orchestrator/templates/configmap.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.orchestrator.customConfigMapName }} apiVersion: v1 kind: ConfigMap metadata: @@ -7,6 +8,7 @@ metadata: data: maverics.yml: | {{- include "orchestrator.deploymentConfig" . | nindent 4 -}} +{{- end}} --- {{ if and .Values.cloud.enabled (and .Values.cloud.config.createConfig) }} apiVersion: v1 diff --git a/charts/orchestrator/templates/statefulset.yaml b/charts/orchestrator/templates/statefulset.yaml index d593019..a75b8f2 100644 --- a/charts/orchestrator/templates/statefulset.yaml +++ b/charts/orchestrator/templates/statefulset.yaml @@ -142,7 +142,11 @@ spec: volumes: - name: orchestrator-config configMap: - name: {{ template "orchestrator.fullname" . }}-config + {{- if .Values.orchestrator.customConfigMapName }} + name: {{ .Values.orchestrator.customConfigMapName }} + {{- else }} + name: {{ template "orchestrator.fullname" . }}-config + {{- end }} {{- if .Values.cloud.enabled }} - name: cloud-config configMap: diff --git a/charts/orchestrator/values.schema.json b/charts/orchestrator/values.schema.json index db4233e..2579052 100644 --- a/charts/orchestrator/values.schema.json +++ b/charts/orchestrator/values.schema.json @@ -248,6 +248,9 @@ "customConfig": { "type": "object" }, + "customConfigMapName": { + "type": "string" + }, "groups": { "type": "object", "properties": { diff --git a/charts/orchestrator/values.yaml b/charts/orchestrator/values.yaml index 7d2583f..5b994bd 100644 --- a/charts/orchestrator/values.yaml +++ b/charts/orchestrator/values.yaml @@ -216,6 +216,10 @@ orchestrator: # baseConfig. customConfig: {} + # The name of the ConfigMap to use for the custom Maverics Orchestrator configuration. + # If defined, it will be used instead of the baseConfig and customConfig. + customConfigMapName: "" + nodeSelector: {} tolerations: []