From 44112b07968dd0997694508fc4c5be3c1ee425e9 Mon Sep 17 00:00:00 2001 From: Sam D <6230696+sambonbonne@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:31:35 +0000 Subject: [PATCH] feat(litmus-agent): allow using existing configuration and secrets (#382) Signed-off-by: Sam --- charts/litmus-agent/Chart.yaml | 2 +- charts/litmus-agent/README.md | 6 +++++- .../templates/infra-config-map-workflow.yaml | 2 ++ .../templates/infra-config-map.yaml | 2 ++ .../litmus-agent/templates/infra-secret.yaml | 2 ++ charts/litmus-agent/templates/secret.yaml | 4 +++- charts/litmus-agent/values.yaml | 21 +++++++++++++++++++ 7 files changed, 36 insertions(+), 3 deletions(-) diff --git a/charts/litmus-agent/Chart.yaml b/charts/litmus-agent/Chart.yaml index 46040248..d7f462db 100644 --- a/charts/litmus-agent/Chart.yaml +++ b/charts/litmus-agent/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "3.8.0" description: A Helm chart to install litmus agent name: litmus-agent -version: 3.8.1 +version: 3.8.2 kubeVersion: ">=1.16.0-0" home: https://litmuschaos.io sources: diff --git a/charts/litmus-agent/README.md b/charts/litmus-agent/README.md index fa8cbd6e..305abdab 100644 --- a/charts/litmus-agent/README.md +++ b/charts/litmus-agent/README.md @@ -1,6 +1,6 @@ # litmus-agent -![Version: 3.8.1](https://img.shields.io/badge/Version-3.8.1-informational?style=flat-square) ![AppVersion: 3.8.0](https://img.shields.io/badge/AppVersion-3.8.0-informational?style=flat-square) +![Version: 3.8.2](https://img.shields.io/badge/Version-3.8.2-informational?style=flat-square) ![AppVersion: 3.8.0](https://img.shields.io/badge/AppVersion-3.8.0-informational?style=flat-square) A Helm chart to install litmus agent @@ -85,6 +85,10 @@ $ helm install litmus-agent litmuschaos/litmus-agent \ | resources.requests.cpu | string | `"100m"` | | | resources.requests.memory | string | `"128Mi"` | | | subscriber.enabled | bool | `true` | | +| useExistingHookSecret | bool | `false` | Use an existing hook Secret instead of creating one with the chart, ref. to templates/secret.yaml | +| useExistingInfraConfigMap | bool | `false` | Use an existing infra ConfigMap instead of creating one with the chart, ref. to templates/infra-config-map.yaml | +| useExistingInfraSecret | bool | `false` | Use an existing infra Secret instead of creating one with the chart, ref. to templates/infra-secret.yaml | +| useExistingWorkflowControllerConfigMap | bool | `false` | Use an existing infra ConfigMap instead of creating one with the chart, ref. to templates/infra-config-map-workflow.yaml | | workflow-controller.crds.create | bool | `true` | | | workflow-controller.enabled | bool | `true` | | diff --git a/charts/litmus-agent/templates/infra-config-map-workflow.yaml b/charts/litmus-agent/templates/infra-config-map-workflow.yaml index ada2ceda..406086d8 100644 --- a/charts/litmus-agent/templates/infra-config-map-workflow.yaml +++ b/charts/litmus-agent/templates/infra-config-map-workflow.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.useExistingWorkflowControllerConfigMap }} apiVersion: v1 kind: ConfigMap metadata: @@ -11,3 +12,4 @@ metadata: "helm.sh/hook-weight": "1" "helm.sh/hook-delete-policy": before-hook-creation,hook-failed data: {} +{{ end }} diff --git a/charts/litmus-agent/templates/infra-config-map.yaml b/charts/litmus-agent/templates/infra-config-map.yaml index 982a49ce..b6b1b594 100644 --- a/charts/litmus-agent/templates/infra-config-map.yaml +++ b/charts/litmus-agent/templates/infra-config-map.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.useExistingInfraConfigMap }} apiVersion: v1 kind: ConfigMap metadata: @@ -11,3 +12,4 @@ metadata: "helm.sh/hook-weight": "1" "helm.sh/hook-delete-policy": before-hook-creation,hook-failed data: {} +{{ end }} diff --git a/charts/litmus-agent/templates/infra-secret.yaml b/charts/litmus-agent/templates/infra-secret.yaml index 41e3b53d..c0af1e9d 100644 --- a/charts/litmus-agent/templates/infra-secret.yaml +++ b/charts/litmus-agent/templates/infra-secret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.useExistingInfraSecret }} apiVersion: v1 kind: Secret type: Opaque @@ -12,3 +13,4 @@ metadata: "helm.sh/hook-weight": "1" "helm.sh/hook-delete-policy": before-hook-creation,hook-failed data: {} +{{ end }} diff --git a/charts/litmus-agent/templates/secret.yaml b/charts/litmus-agent/templates/secret.yaml index f271dd7d..8fe8703a 100644 --- a/charts/litmus-agent/templates/secret.yaml +++ b/charts/litmus-agent/templates/secret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.useExistingHookSecret }} apiVersion: v1 kind: Secret metadata: @@ -21,4 +22,5 @@ data: LITMUS_PASSWORD: {{ .Values.LITMUS_PASSWORD | b64enc | quote }} {{- if .Values.LITMUS_PROJECT_ID }} LITMUS_PROJECT_ID: {{ .Values.LITMUS_PROJECT_ID | b64enc | quote }} - {{ end }} \ No newline at end of file + {{ end }} +{{ end }} diff --git a/charts/litmus-agent/values.yaml b/charts/litmus-agent/values.yaml index 6e9911e2..376a9e95 100644 --- a/charts/litmus-agent/values.yaml +++ b/charts/litmus-agent/values.yaml @@ -48,6 +48,27 @@ resources: cpu: 100m memory: 128Mi +# Existing Secret name should be: +# `{{ include "subscriber.fullname" . }}-hook` +# I.E. `name: litmus-agent-hook` +# -- Use an existing hook Secret instead of creating one with the chart, ref. to templates/secret.yaml +useExistingHookSecret: false + +# Existing ConfigMap name should be equal to .global.infraConfigName +# I.E. `name: subscriber-config` +# -- Use an existing infra ConfigMap instead of creating one with the chart, ref. to templates/infra-config-map.yaml +useExistingInfraConfigMap: false + +# Existing Secret name should be equal to .global.infraSecretName +# I.E. `name: subscriber-secret` +# -- Use an existing infra Secret instead of creating one with the chart, ref. to templates/infra-secret.yaml +useExistingInfraSecret: false + +# Existing ConfigMap name should be: +# `{{ index .Values "workflow-controller" "appSettings" "configmapName" }}` +# -- Use an existing infra ConfigMap instead of creating one with the chart, ref. to templates/infra-config-map-workflow.yaml +useExistingWorkflowControllerConfigMap: false + chaos-operator: enabled: true