From 22524c613c8d1cfa612e5ae99c5ade71b5850f67 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Wed, 9 Nov 2022 13:42:03 +0200 Subject: [PATCH] start some overrall docs + expand the common pipe --- library/common-test/templates/common.yaml | 2 +- library/common-test/tests/pods/deployment-test.yaml | 7 +++++++ library/common/1.0.0/README.md | 13 +++++++++++++ .../common/1.0.0/templates/lib/values/_values.tpl | 9 +++++++++ library/common/1.0.0/templates/loader/_init.tpl | 3 ++- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 library/common/1.0.0/README.md create mode 100644 library/common/1.0.0/templates/lib/values/_values.tpl diff --git a/library/common-test/templates/common.yaml b/library/common-test/templates/common.yaml index 7907dbadf5..8b11432b96 100644 --- a/library/common-test/templates/common.yaml +++ b/library/common-test/templates/common.yaml @@ -1 +1 @@ -{{ include "ix.v1.common.deployment" . }} +{{ include "ix.v1.common.loader.all" . }} diff --git a/library/common-test/tests/pods/deployment-test.yaml b/library/common-test/tests/pods/deployment-test.yaml index dd0565b77a..1a21b4beb4 100644 --- a/library/common-test/tests/pods/deployment-test.yaml +++ b/library/common-test/tests/pods/deployment-test.yaml @@ -36,3 +36,10 @@ tests: documentIndex: *deploymentDoc path: metadata.name value: RELEASE-NAME-globalOverrodeName + + - it: should pass with controller disabled + set: + controller.enabled: false + asserts: + - hasDocuments: + count: 0 diff --git a/library/common/1.0.0/README.md b/library/common/1.0.0/README.md new file mode 100644 index 0000000000..5934aab15a --- /dev/null +++ b/library/common/1.0.0/README.md @@ -0,0 +1,13 @@ +# Common Library + +## Values flow + +Values are applied with this order, the last overrides the previous. + +- common/values.yaml +- chart/ix-values.yaml +- chart/questions.yaml + +This is so we can set some sane defaults values on the common library, but have the option +to override those when developing a new chart. And lastly, end user can override those, based +on the interface we create on the `questions.yaml` diff --git a/library/common/1.0.0/templates/lib/values/_values.tpl b/library/common/1.0.0/templates/lib/values/_values.tpl new file mode 100644 index 0000000000..8a452bcc24 --- /dev/null +++ b/library/common/1.0.0/templates/lib/values/_values.tpl @@ -0,0 +1,9 @@ +{{/* Merge the local chart values and the common chart defaults */}} +{{- define "ix.v1.common.values.init" -}} + {{- if .Values.common -}} + {{- $defaultValues := deepCopy .Values.common -}} + {{- $userValues := deepCopy (omit .Values "common") -}} + {{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}} + {{- $_ := set . "Values" (deepCopy $mergedValues) -}} + {{- end -}} +{{- end -}} diff --git a/library/common/1.0.0/templates/loader/_init.tpl b/library/common/1.0.0/templates/loader/_init.tpl index c6d9622832..8fa61fcabb 100644 --- a/library/common/1.0.0/templates/loader/_init.tpl +++ b/library/common/1.0.0/templates/loader/_init.tpl @@ -1,3 +1,4 @@ {{- define "ix.v1.common.loader.init" -}} - + {{- /* Merge the local chart values and the common chart defaults */ -}} + {{- include "ix.v1.common.values.init" . }} {{- end -}}