Browse Source

add extra manifests support (#3421)

Signed-off-by: upodroid <upodroid@users.noreply.github.com>
Co-authored-by: upodroid <upodroid@users.noreply.github.com>
Mahamed Ali 1 year ago
parent
commit
e32bc39425

+ 1 - 0
deploy/charts/external-secrets/README.md

@@ -95,6 +95,7 @@ The command removes all the Kubernetes components associated with the chart and
 | extraArgs | object | `{}` |  |
 | extraArgs | object | `{}` |  |
 | extraContainers | list | `[]` |  |
 | extraContainers | list | `[]` |  |
 | extraEnv | list | `[]` |  |
 | extraEnv | list | `[]` |  |
+| extraObjects | list | `[]` | Extra Kubernetes manifests to deploy with the chart |
 | extraVolumeMounts | list | `[]` |  |
 | extraVolumeMounts | list | `[]` |  |
 | extraVolumes | list | `[]` |  |
 | extraVolumes | list | `[]` |  |
 | fullnameOverride | string | `""` |  |
 | fullnameOverride | string | `""` |  |

+ 12 - 0
deploy/charts/external-secrets/templates/_helpers.tpl

@@ -154,3 +154,15 @@ Determine the image to use, including if using a flavour.
 {{ printf "%s:%s" .image.repository (.image.tag | default .chartAppVersion) }}
 {{ printf "%s:%s" .image.repository (.image.tag | default .chartAppVersion) }}
 {{- end }}
 {{- end }}
 {{- end }}
 {{- end }}
+
+
+{{/*
+Renders a complete tree, even values that contains template.
+*/}}
+{{- define "external-secrets.render" -}}
+  {{- if typeIs "string" .value }}
+    {{- tpl .value .context }}
+  {{ else }}
+    {{- tpl (.value | toYaml) .context }}
+  {{- end }}
+{{- end -}}

+ 4 - 0
deploy/charts/external-secrets/templates/extra-manifests.yaml

@@ -0,0 +1,4 @@
+{{- range .Values.extraObjects }}
+---
+{{ include "external-secrets.render" (dict "value" . "context" $) }}
+{{- end }}

+ 15 - 0
deploy/charts/external-secrets/tests/extra_manifests_test.yaml

@@ -0,0 +1,15 @@
+suite: test adding extra kubernetes objects
+templates:
+  - extra-manifests.yaml
+tests:
+  - it: should load extra manifests
+    set:
+      extraObjects:
+      - apiVersion: v1
+        kind: ServiceAccount
+        metadata:
+          name: random
+    asserts:
+      - equal:
+          path: kind
+          value: ServiceAccount

+ 3 - 0
deploy/charts/external-secrets/values.yaml

@@ -114,6 +114,9 @@ extraArgs: {}
 ## -- Extra volumes to pass to pod.
 ## -- Extra volumes to pass to pod.
 extraVolumes: []
 extraVolumes: []
 
 
+## -- Extra Kubernetes objects to deploy with the helm chart
+extraObjects: []
+
 ## -- Extra volumes to mount to the container.
 ## -- Extra volumes to mount to the container.
 extraVolumeMounts: []
 extraVolumeMounts: []