diff --git a/library/common-test/tests/pod/image_pull_secret_test.yaml b/library/common-test/tests/pod/image_pull_secret_test.yaml index bbfc385618..46a91b41fa 100644 --- a/library/common-test/tests/pod/image_pull_secret_test.yaml +++ b/library/common-test/tests/pod/image_pull_secret_test.yaml @@ -73,7 +73,7 @@ tests: username: user password: pass email: mail - targetSelector: all + targetSelectAll: true pull-secret2: enabled: true data: @@ -81,7 +81,7 @@ tests: username: user password: pass email: mail - targetSelector: all + targetSelectAll: true asserts: - documentIndex: &deploymentDoc 2 isKind: diff --git a/library/common/1.0.0/docs/imagePullSecrets.md b/library/common/1.0.0/docs/imagePullSecrets.md index 5f4422e90e..b260551acb 100644 --- a/library/common/1.0.0/docs/imagePullSecrets.md +++ b/library/common/1.0.0/docs/imagePullSecrets.md @@ -1,22 +1,24 @@ # Image Pull Secrets -| Key | Type | Required | Helm Template | Default | Description | -| :------------------------------------------------- | :-----------: | :------: | :-----------: | :-----: | :------------------------------------------- | -| imagePullSecrets | `dict` | ❌ | ❌ | `{}` | Define the image pull secrets as dicts | -| imagePullSecrets.[pull-secret-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | -| imagePullSecrets.[pull-secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the image pull secret | -| imagePullSecrets.[pull-secret-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for image pull secret | -| imagePullSecrets.[pull-secret-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for image pull secret | -| imagePullSecrets.[pull-secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the image pull secret | -| imagePullSecrets.[pull-secret-name].data.registry | `string` | ✅ | ✅ | `""` | Define the registry of the image pull secret | -| imagePullSecrets.[pull-secret-name].data.username | `string` | ✅ | ✅ | `""` | Define the username of the image pull secret | -| imagePullSecrets.[pull-secret-name].data.password | `string` | ✅ | ✅ | `""` | Define the password of the image pull secret | -| imagePullSecrets.[pull-secret-name].data.email | `string` | ✅ | ✅ | `""` | Define the email of the image pull secret | -| imagePullSecrets.[pull-secret-name].targetSelector | `string/list` | ❌ | ❌ | `""` | Define the pod(s) to assign the secret | +| Key | Type | Required | Helm Template | Default | Description | +| :-------------------------------------------------- | :-------: | :------: | :-----------: | :-----: | :---------------------------------------------- | +| imagePullSecrets | `dict` | ❌ | ❌ | `{}` | Define the image pull secrets as dicts | +| imagePullSecrets.[pull-secret-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | +| imagePullSecrets.[pull-secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the image pull secret | +| imagePullSecrets.[pull-secret-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for image pull secret | +| imagePullSecrets.[pull-secret-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for image pull secret | +| imagePullSecrets.[pull-secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the image pull secret | +| imagePullSecrets.[pull-secret-name].data.registry | `string` | ✅ | ✅ | `""` | Define the registry of the image pull secret | +| imagePullSecrets.[pull-secret-name].data.username | `string` | ✅ | ✅ | `""` | Define the username of the image pull secret | +| imagePullSecrets.[pull-secret-name].data.password | `string` | ✅ | ✅ | `""` | Define the password of the image pull secret | +| imagePullSecrets.[pull-secret-name].data.email | `string` | ✅ | ✅ | `""` | Define the email of the image pull secret | +| imagePullSecrets.[pull-secret-name].targetSelectAll | `boolean` | ❌ | ❌ | | Whether to assign the secret to all pods or not | +| imagePullSecrets.[pull-secret-name].targetSelector | `list` | ❌ | ❌ | `""` | Define the pod(s) to assign the secret | -> When `targetSelector` is string, it only accepts the keyword `all` which will assign the secret to all pods +> When `targetSelectAll` is `true`, it will assign the secret to all pods (`targetSelector` is ignored in this case) > When `targetSelector` is a list, it's entry is a string, referencing the pod(s) name that will be assigned. > When `targetSelector` is a empty, it will assign the secret to the primary pod + --- Appears in: @@ -49,7 +51,7 @@ imagePullSecrets: username: my_user password: my_pass email: my_mail@example.com - targetSelector: all + targetSelectAll: true other-pull-secret-name: enabled: true diff --git a/library/common/1.0.0/templates/lib/chart/_notes.tpl b/library/common/1.0.0/templates/lib/chart/_notes.tpl index b7b6a34450..6745605966 100644 --- a/library/common/1.0.0/templates/lib/chart/_notes.tpl +++ b/library/common/1.0.0/templates/lib/chart/_notes.tpl @@ -11,9 +11,11 @@ {{- define "ix.v1.common.lib.chart.header" -}} {{- tpl $.Values.notes.header $ | nindent 0 }} {{- end -}} + {{- define "ix.v1.common.lib.chart.custom" -}} - {{- tpl $.Values.notes.header $ | nindent 0 }} + {{- tpl $.Values.notes.custom $ | nindent 0 }} {{- end -}} + {{- define "ix.v1.common.lib.chart.footer" -}} - {{- tpl $.Values.notes.header $ | nindent 0 }} + {{- tpl $.Values.notes.footer $ | nindent 0 }} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/pod/_imagePullSecrets.tpl b/library/common/1.0.0/templates/lib/pod/_imagePullSecrets.tpl index 32a42571f6..151f5c9ddc 100644 --- a/library/common/1.0.0/templates/lib/pod/_imagePullSecrets.tpl +++ b/library/common/1.0.0/templates/lib/pod/_imagePullSecrets.tpl @@ -15,17 +15,17 @@ objectData: The object data to be used to render the Pod. {{- $pullName := (printf "%s-%s" (include "ix.v1.common.lib.chart.names.fullname" $rootCtx) $name) -}} {{- if $imgPull.enabled -}} - {{- if $imgPull.targetSelector -}} + {{/* If targetSelectAll is true */}} + {{- if $imgPull.targetSelectAll -}} + {{- $imgPullSecrets = mustAppend $imgPullSecrets $pullName -}} - {{- if and (kindIs "string" $imgPull.targetSelector) (eq $imgPull.targetSelector "all") -}} + {{/* Else if targetSelector is a list */}} + {{- else if (kindIs "slice" $imgPull.targetSelector) -}} + {{- if (mustHas $objectData.shortName $imgPull.targetSelector) -}} {{- $imgPullSecrets = mustAppend $imgPullSecrets $pullName -}} - {{- else -}} - {{- if (mustHas $objectData.shortName $imgPull.targetSelector) -}} - {{- $imgPullSecrets = mustAppend $imgPullSecrets $pullName -}} - {{- end -}} {{- end -}} - {{/* If not targetSelector, but is the primary pod */}} + {{/* If not targetSelectAll or targetSelector, but is the primary pod */}} {{- else if $objectData.primary -}} {{- $imgPullSecrets = mustAppend $imgPullSecrets $pullName -}} {{- end -}} diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index e77f4e3170..97b53a69ca 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -360,7 +360,8 @@ devices: notes: header: | # Welcome to SCALE - Thank you for installing {{ .Chart.Name }}. + Thank you for installing <{{ .Chart.Name }}>. + # custom: "{{ toYaml $.Values }}" custom: "" footer: | # Documentation @@ -529,29 +530,29 @@ controllers: # TODO: portal: {} -# # -- Image Pull Secrets -# imagePullSecrets: -# # -- Image Pull Secret name -# image-secret-name: -# # -- Enables the Image Pull Secret -# enabled: false -# # -- Labels -# labels: {} -# # -- Annotations -# annotations: {} -# # -- Image Pull Secret Data -# data: -# # -- Registry -# registry: "" -# # -- Username -# username: "" -# # -- Password -# password: "" -# # -- Email -# email: "" -# # targetSelector: all -# targetSelector: -# - pod-name +# -- Image Pull Secrets +imagePullSecrets: + # -- Image Pull Secret name + image-secret-name: + # -- Enables the Image Pull Secret + enabled: false + # -- Labels + labels: {} + # -- Annotations + annotations: {} + # -- Image Pull Secret Data + data: + # -- Registry + registry: "" + # -- Username + username: "" + # -- Password + password: "" + # -- Email + email: "" + targetSelectAll: true + targetSelector: + - pod-name # -- ConfigMaps (docs/configmaps.md) configmaps: {}