update selector logic

This commit is contained in:
Stavros kois
2023-01-31 15:35:44 +02:00
parent a1ab2d5960
commit 7abffdd0b0
5 changed files with 55 additions and 50 deletions
@@ -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:
+17 -15
View File
@@ -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
@@ -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 -}}
@@ -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 -}}
+25 -24
View File
@@ -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: {}