From b902b39b9597c4bfcb03ea263c633cb0ffbf99e7 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Sat, 4 Feb 2023 22:26:04 +0200 Subject: [PATCH] simplify labels and update tests --- library/common-test/default-values.yaml | 7 + .../tests/configmap/metadata_test.yaml | 2 +- .../tests/cronjob/metadata_test.yaml | 10 +- .../tests/daemonset/metadata_test.yaml | 16 +- .../tests/deployment/metadata_test.yaml | 16 +- .../tests/imagePullSecret/metadata_test.yaml | 2 +- .../common-test/tests/job/metadata_test.yaml | 10 +- .../common-test/tests/rbac/metadata_test.yaml | 8 +- .../tests/secret/metadata_test.yaml | 2 +- .../tests/service/metadata_test.yaml | 63 +++++++- .../tests/serviceAccount/metadata_test.yaml | 2 +- .../tests/statefulset/metadata_test.yaml | 16 +- library/common-test/values.yaml | 22 ++- library/common/1.0.0/docs/configmap.md | 16 +- library/common/1.0.0/docs/imagePullSecret.md | 28 ++-- library/common/1.0.0/docs/rbac.md | 44 +++--- library/common/1.0.0/docs/secret.md | 18 +-- library/common/1.0.0/docs/serviceAccount.md | 20 +-- library/common/1.0.0/docs/workload.md | 76 ++++------ .../1.0.0/templates/classes/_cronjob.tpl | 2 +- .../1.0.0/templates/classes/_daemonset.tpl | 4 +- .../1.0.0/templates/classes/_deployment.tpl | 4 +- .../common/1.0.0/templates/classes/_job.tpl | 2 +- .../1.0.0/templates/classes/_statefulset.tpl | 4 +- .../templates/lib/metadata/_allLabels.tpl | 2 +- library/common/1.0.0/values.yaml | 143 +++++++++--------- 26 files changed, 306 insertions(+), 233 deletions(-) create mode 100644 library/common-test/default-values.yaml diff --git a/library/common-test/default-values.yaml b/library/common-test/default-values.yaml new file mode 100644 index 0000000000..a3988fa8d7 --- /dev/null +++ b/library/common-test/default-values.yaml @@ -0,0 +1,7 @@ +workload: + main: + enabled: true + +service: + main: + enabled: true diff --git a/library/common-test/tests/configmap/metadata_test.yaml b/library/common-test/tests/configmap/metadata_test.yaml index c3a5084ab6..c171750a22 100644 --- a/library/common-test/tests/configmap/metadata_test.yaml +++ b/library/common-test/tests/configmap/metadata_test.yaml @@ -45,7 +45,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm diff --git a/library/common-test/tests/cronjob/metadata_test.yaml b/library/common-test/tests/cronjob/metadata_test.yaml index 2c6cf9f95f..3b8722f0fb 100644 --- a/library/common-test/tests/cronjob/metadata_test.yaml +++ b/library/common-test/tests/cronjob/metadata_test.yaml @@ -53,7 +53,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -66,9 +66,9 @@ tests: equal: path: spec.jobTemplate.spec.template.metadata.labels value: - pod.name: release-name-common-test + pod.name: workload-name app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: common-test @@ -111,7 +111,7 @@ tests: isSubset: path: spec.jobTemplate.spec.template.metadata.labels content: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test - documentIndex: &otherCronJobDoc 1 @@ -125,6 +125,6 @@ tests: isSubset: path: spec.jobTemplate.spec.template.metadata.labels content: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test diff --git a/library/common-test/tests/daemonset/metadata_test.yaml b/library/common-test/tests/daemonset/metadata_test.yaml index 753a8aafeb..c58b56bda4 100644 --- a/library/common-test/tests/daemonset/metadata_test.yaml +++ b/library/common-test/tests/daemonset/metadata_test.yaml @@ -52,7 +52,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -65,16 +65,16 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *daemonSetDoc equal: path: spec.template.metadata.labels value: - pod.name: release-name-common-test + pod.name: workload-name app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: common-test @@ -115,14 +115,14 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *daemonSetDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test - documentIndex: &otherDaemonSetDoc 1 @@ -136,13 +136,13 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *otherDaemonSetDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test diff --git a/library/common-test/tests/deployment/metadata_test.yaml b/library/common-test/tests/deployment/metadata_test.yaml index cf506f77d5..71e00df6b0 100644 --- a/library/common-test/tests/deployment/metadata_test.yaml +++ b/library/common-test/tests/deployment/metadata_test.yaml @@ -52,7 +52,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -65,16 +65,16 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *deploymentDoc equal: path: spec.template.metadata.labels value: - pod.name: release-name-common-test + pod.name: workload-name app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: common-test @@ -115,14 +115,14 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *deploymentDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test - documentIndex: &otherDeploymentDoc 1 @@ -136,13 +136,13 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *otherDeploymentDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test diff --git a/library/common-test/tests/imagePullSecret/metadata_test.yaml b/library/common-test/tests/imagePullSecret/metadata_test.yaml index 4eb3b99136..a23244265b 100644 --- a/library/common-test/tests/imagePullSecret/metadata_test.yaml +++ b/library/common-test/tests/imagePullSecret/metadata_test.yaml @@ -48,7 +48,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm diff --git a/library/common-test/tests/job/metadata_test.yaml b/library/common-test/tests/job/metadata_test.yaml index b4dda69ddb..a1e91b7561 100644 --- a/library/common-test/tests/job/metadata_test.yaml +++ b/library/common-test/tests/job/metadata_test.yaml @@ -52,7 +52,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -65,9 +65,9 @@ tests: equal: path: spec.template.metadata.labels value: - pod.name: release-name-common-test + pod.name: workload-name app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: common-test @@ -108,7 +108,7 @@ tests: isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test - documentIndex: &otherJobDoc 1 @@ -122,6 +122,6 @@ tests: isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test diff --git a/library/common-test/tests/rbac/metadata_test.yaml b/library/common-test/tests/rbac/metadata_test.yaml index 53bcd1dd2c..6c8af8c353 100644 --- a/library/common-test/tests/rbac/metadata_test.yaml +++ b/library/common-test/tests/rbac/metadata_test.yaml @@ -77,7 +77,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -102,7 +102,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -127,7 +127,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -152,7 +152,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm diff --git a/library/common-test/tests/secret/metadata_test.yaml b/library/common-test/tests/secret/metadata_test.yaml index 722d057666..6ec6099825 100644 --- a/library/common-test/tests/secret/metadata_test.yaml +++ b/library/common-test/tests/secret/metadata_test.yaml @@ -45,7 +45,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm diff --git a/library/common-test/tests/service/metadata_test.yaml b/library/common-test/tests/service/metadata_test.yaml index 59ac41bd0c..d676fe35bb 100644 --- a/library/common-test/tests/service/metadata_test.yaml +++ b/library/common-test/tests/service/metadata_test.yaml @@ -54,7 +54,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -95,3 +95,64 @@ tests: content: metallb.universe.tf/allow-shared-ip: release-name-common-test traefik.ingress.kubernetes.io/service.serversscheme: https + + - it: should pass with correct selector without targetSelector + set: + service: + my-service1: + enabled: true + primary: true + ports: + port-name: + enabled: true + primary: true + workload: + my-workload: + enabled: true + primary: true + type: Deployment + podSpec: {} + my-workload2: + enabled: true + type: StatefulSet + podSpec: {} + asserts: + - documentIndex: *serviceDoc + isKind: + of: Service + - documentIndex: *serviceDoc + equal: + path: selector + value: + pod.name: my-workload + app.kubernetes.io/name: common-test + app.kubernetes.io/instance: RELEASE-NAME + + - it: should pass with correct selector with targetSelector + set: + service: + my-service1: + enabled: true + primary: true + targetSelector: my-workload + ports: + port-name: + enabled: true + primary: true + workload: + my-workload: + enabled: true + primary: true + type: Deployment + podSpec: {} + asserts: + - documentIndex: *serviceDoc + isKind: + of: Service + - documentIndex: *serviceDoc + equal: + path: selector + value: + pod.name: my-workload + app.kubernetes.io/name: common-test + app.kubernetes.io/instance: RELEASE-NAME diff --git a/library/common-test/tests/serviceAccount/metadata_test.yaml b/library/common-test/tests/serviceAccount/metadata_test.yaml index a25f0ae50c..f827c4ff66 100644 --- a/library/common-test/tests/serviceAccount/metadata_test.yaml +++ b/library/common-test/tests/serviceAccount/metadata_test.yaml @@ -44,7 +44,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm diff --git a/library/common-test/tests/statefulset/metadata_test.yaml b/library/common-test/tests/statefulset/metadata_test.yaml index 85a32d663f..f47b9b4d10 100644 --- a/library/common-test/tests/statefulset/metadata_test.yaml +++ b/library/common-test/tests/statefulset/metadata_test.yaml @@ -52,7 +52,7 @@ tests: path: metadata.labels value: app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME helm-revision: 0 helm.sh/chart: common-test-1.0.0 app.kubernetes.io/managed-by: Helm @@ -65,16 +65,16 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *statefulSetDoc equal: path: spec.template.metadata.labels value: - pod.name: release-name-common-test + pod.name: workload-name app: common-test-1.0.0 - release: release-name + release: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: common-test @@ -115,14 +115,14 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *statefulSetDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test-other-workload-name + pod.name: other-workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test - documentIndex: &otherStatefulSetDoc 1 @@ -136,13 +136,13 @@ tests: equal: path: spec.selector.matchLabels value: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/name: common-test app.kubernetes.io/instance: RELEASE-NAME - documentIndex: *otherStatefulSetDoc isSubset: path: spec.template.metadata.labels content: - pod.name: release-name-common-test + pod.name: workload-name app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/name: common-test diff --git a/library/common-test/values.yaml b/library/common-test/values.yaml index 65160ce923..0ebdbfc549 100644 --- a/library/common-test/values.yaml +++ b/library/common-test/values.yaml @@ -1,7 +1,7 @@ -# As we have by default enabled -# a "main" workload and service" for all charts -# We disable it so tests run with their defined -# values (Tests use a different named values) +# This file disables all defaults for the common-test chart. +# This is to have common test cases without getting affected +# by any default values. + workload: main: enabled: false @@ -9,3 +9,17 @@ workload: service: main: enabled: false + +# The above just disables the "main" objects, +# every other config is stays as it is set in common's values.yaml. +# Tests need to use a different name, other than `main`, +# so they don't "inherit" values from common. +# The above just makes it easier to test with specific values, +# set on each test case, without having to worry about pre-defined values. + +# It will be a test case using a different values.yaml (default-values.yaml), +# that do not disable any objects. So we can make sure that defaults apply. + +# Everything disabled above, must be explicitly enabled in the default-values.yaml +# As helm first applies values.yaml and then the specified values file, +# in this case default-values.yaml diff --git a/library/common/1.0.0/docs/configmap.md b/library/common/1.0.0/docs/configmap.md index 3ebb5c9876..afa7df2b16 100644 --- a/library/common/1.0.0/docs/configmap.md +++ b/library/common/1.0.0/docs/configmap.md @@ -1,13 +1,13 @@ # ConfigMap -| Key | Type | Required | Helm Template | Default | Description | -| :------------------------------------- | :-------: | :------: | :-----------: | :-----: | :----------------------------------- | -| configmap | `dict` | ❌ | ❌ | `{}` | Define the configMaps as dicts | -| configmap.[configmap-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | -| configmap.[configmap-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the configMap | -| configmap.[configmap-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for configmap | -| configmap.[configmap-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for configmap | -| configmap.[configmap-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the configmap | +| Key | Type | Required | Helm Template | Default | Description | +| :------------------------------------- | :-------: | :------: | :----------------: | :-----: | :----------------------------------- | +| configmap | `dict` | ❌ | ❌ | `{}` | Define the configMaps as dicts | +| configmap.[configmap-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | +| configmap.[configmap-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the configMap | +| configmap.[configmap-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for configmap | +| configmap.[configmap-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for configmap | +| configmap.[configmap-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the configmap | --- diff --git a/library/common/1.0.0/docs/imagePullSecret.md b/library/common/1.0.0/docs/imagePullSecret.md index dc897252ab..22669985ec 100644 --- a/library/common/1.0.0/docs/imagePullSecret.md +++ b/library/common/1.0.0/docs/imagePullSecret.md @@ -1,19 +1,19 @@ # Image Pull Secret -| Key | Type | Required | Helm Template | Default | Description | -| :------------------------------------------------- | :-------: | :------: | :-----------: | :-----: | :---------------------------------------------- | -| imagePullSecret | `dict` | ❌ | ❌ | `{}` | Define the image pull secret as dicts | -| imagePullSecret.[pull-secret-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | -| imagePullSecret.[pull-secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the image pull secret | -| imagePullSecret.[pull-secret-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for image pull secret | -| imagePullSecret.[pull-secret-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for image pull secret | -| imagePullSecret.[pull-secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the image pull secret | -| imagePullSecret.[pull-secret-name].data.registry | `string` | ✅ | ✅ | `""` | Define the registry of the image pull secret | -| imagePullSecret.[pull-secret-name].data.username | `string` | ✅ | ✅ | `""` | Define the username of the image pull secret | -| imagePullSecret.[pull-secret-name].data.password | `string` | ✅ | ✅ | `""` | Define the password of the image pull secret | -| imagePullSecret.[pull-secret-name].data.email | `string` | ✅ | ✅ | `""` | Define the email of the image pull secret | -| imagePullSecret.[pull-secret-name].targetSelectAll | `boolean` | ❌ | ❌ | | Whether to assign the secret to all pods or not | -| imagePullSecret.[pull-secret-name].targetSelector | `list` | ❌ | ❌ | `[]` | Define the pod(s) to assign the secret | +| Key | Type | Required | Helm Template | Default | Description | +| :------------------------------------------------- | :-------: | :------: | :----------------: | :-----: | :---------------------------------------------- | +| imagePullSecret | `dict` | ❌ | ❌ | `{}` | Define the image pull secret as dicts | +| imagePullSecret.[pull-secret-name] | `dict` | ✅ | ❌ | `{}` | Holds configMap definition | +| imagePullSecret.[pull-secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the image pull secret | +| imagePullSecret.[pull-secret-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for image pull secret | +| imagePullSecret.[pull-secret-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for image pull secret | +| imagePullSecret.[pull-secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the image pull secret | +| imagePullSecret.[pull-secret-name].data.registry | `string` | ✅ | ✅ | `""` | Define the registry of the image pull secret | +| imagePullSecret.[pull-secret-name].data.username | `string` | ✅ | ✅ | `""` | Define the username of the image pull secret | +| imagePullSecret.[pull-secret-name].data.password | `string` | ✅ | ✅ | `""` | Define the password of the image pull secret | +| imagePullSecret.[pull-secret-name].data.email | `string` | ✅ | ✅ | `""` | Define the email of the image pull secret | +| imagePullSecret.[pull-secret-name].targetSelectAll | `boolean` | ❌ | ❌ | | Whether to assign the secret to all pods or not | +| imagePullSecret.[pull-secret-name].targetSelector | `list` | ❌ | ❌ | `[]` | Define the pod(s) to assign the secret | > When `targetSelectAll` is `true`, it will assign the secret to all pods (`targetSelector` is ignored in this case) > When `targetSelector` is a list, each entry is a string, referencing the pod(s) name that will be assigned. diff --git a/library/common/1.0.0/docs/rbac.md b/library/common/1.0.0/docs/rbac.md index 1d9c42fa82..6c87fe13ab 100644 --- a/library/common/1.0.0/docs/rbac.md +++ b/library/common/1.0.0/docs/rbac.md @@ -1,27 +1,27 @@ # RBAC -| Key | Type | Required | Helm Template | Default | Description | -| :--------------------------------------- | :-------: | :------: | :-----------: | :-----: | :------------------------------------------------------------------------ | -| rbac | `dict` | ❌ | ❌ | `{}` | Define the rbac as dicts | -| rbac.[rbac-name] | `dict` | ✅ | ❌ | `{}` | Holds rbac definition | -| rbac.[rbac-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the rbac | -| rbac.[rbac-name].primary | `boolean` | ❌ | ❌ | `false` | Sets the rbac as primary | -| rbac.[rbac-name].clusterWide | `boolean` | ❌ | ❌ | `false` | Sets the rbac as cluster wide (ClusterRole, ClusterRoleBinding) | -| rbac.[rbac-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for rbac | -| rbac.[rbac-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for rbac | -| rbac.[rbac-name].allServiceAccounts | `boolean` | ❌ | ❌ | | Whether to assign all service accounts or not to the (Cluster)RoleBinding | -| rbac.[rbac-name].serviceAccounts | `list` | ❌ | ❌ | `[]` | Define the service account(s) to assign the (Cluster)RoleBinding | -| rbac.[rbac-name].rules | `list` | ✅ | ❌ | `[]` | Define the `rules` for the (Cluster)Role | -| rbac.[rbac-name].rules.apiGroups | `list` | ✅ | ❌ | `[]` | Define the `apiGroups` list for the `rules` for the (Cluster)Role | -| rbac.[rbac-name].rules.apiGroups.[entry] | `string` | ✅ | ✅ | | Entry of the `apiGroups` | -| rbac.[rbac-name].rules.resources | `list` | ✅ | ❌ | `[]` | Define the `resources` list for the `rules` for the (Cluster)Role | -| rbac.[rbac-name].rules.resources.[entry] | `string` | ✅ | ✅ | | Entry of the `resources` | -| rbac.[rbac-name].rules.verbs | `list` | ✅ | ❌ | `[]` | Define the `verbs` list for the `rules` for the (Cluster)Role | -| rbac.[rbac-name].rules.verbs.[entry] | `string` | ✅ | ✅ | | Entry of the `verbs` | -| rbac.[rbac-name].subjects | `list` | ❌ | ❌ | `[]` | Define `subjects` for (Cluster)RoleBinding | -| rbac.[rbac-name].subjects.kind | `string` | ✅ | ✅ | `""` | Define the `kind` of `subjects` entry | -| rbac.[rbac-name].subjects.name | `string` | ✅ | ✅ | `""` | Define the `name` of `subjects` entry | -| rbac.[rbac-name].subjects.apiGroup | `string` | ✅ | ✅ | `""` | Define the `apiGroup` of `subjects` entry | +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------- | :-------: | :------: | :----------------: | :-----: | :------------------------------------------------------------------------ | +| rbac | `dict` | ❌ | ❌ | `{}` | Define the rbac as dicts | +| rbac.[rbac-name] | `dict` | ✅ | ❌ | `{}` | Holds rbac definition | +| rbac.[rbac-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the rbac | +| rbac.[rbac-name].primary | `boolean` | ❌ | ❌ | `false` | Sets the rbac as primary | +| rbac.[rbac-name].clusterWide | `boolean` | ❌ | ❌ | `false` | Sets the rbac as cluster wide (ClusterRole, ClusterRoleBinding) | +| rbac.[rbac-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for rbac | +| rbac.[rbac-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for rbac | +| rbac.[rbac-name].allServiceAccounts | `boolean` | ❌ | ❌ | | Whether to assign all service accounts or not to the (Cluster)RoleBinding | +| rbac.[rbac-name].serviceAccounts | `list` | ❌ | ❌ | `[]` | Define the service account(s) to assign the (Cluster)RoleBinding | +| rbac.[rbac-name].rules | `list` | ✅ | ❌ | `[]` | Define the `rules` for the (Cluster)Role | +| rbac.[rbac-name].rules.apiGroups | `list` | ✅ | ❌ | `[]` | Define the `apiGroups` list for the `rules` for the (Cluster)Role | +| rbac.[rbac-name].rules.apiGroups.[entry] | `string` | ✅ | ✅ | | Entry of the `apiGroups` | +| rbac.[rbac-name].rules.resources | `list` | ✅ | ❌ | `[]` | Define the `resources` list for the `rules` for the (Cluster)Role | +| rbac.[rbac-name].rules.resources.[entry] | `string` | ✅ | ✅ | | Entry of the `resources` | +| rbac.[rbac-name].rules.verbs | `list` | ✅ | ❌ | `[]` | Define the `verbs` list for the `rules` for the (Cluster)Role | +| rbac.[rbac-name].rules.verbs.[entry] | `string` | ✅ | ✅ | | Entry of the `verbs` | +| rbac.[rbac-name].subjects | `list` | ❌ | ❌ | `[]` | Define `subjects` for (Cluster)RoleBinding | +| rbac.[rbac-name].subjects.kind | `string` | ✅ | ✅ | `""` | Define the `kind` of `subjects` entry | +| rbac.[rbac-name].subjects.name | `string` | ✅ | ✅ | `""` | Define the `name` of `subjects` entry | +| rbac.[rbac-name].subjects.apiGroup | `string` | ✅ | ✅ | `""` | Define the `apiGroup` of `subjects` entry | > When `allServiceAccounts` is `true`, it will assign the all the serviceAccount(s) to the (Cluster)RoleBinding (`serviceAccounts` is ignored in this case) > When `serviceAccounts` is a list, each entry is a string, referencing the serviceAccount(s) name that will be assigned to the (Cluster)RoleBinding. diff --git a/library/common/1.0.0/docs/secret.md b/library/common/1.0.0/docs/secret.md index a43fe4f381..98d15eeb10 100644 --- a/library/common/1.0.0/docs/secret.md +++ b/library/common/1.0.0/docs/secret.md @@ -1,14 +1,14 @@ # Secret -| Key | Type | Required | Helm Template | Default | Description | -| :------------------------------- | :-------: | :------: | :-----------: | :------: | :-------------------------------- | -| secret | `dict` | ❌ | ❌ | `{}` | Define the secret as dicts | -| secret.[secret-name] | `dict` | ✅ | ❌ | `{}` | Holds secret definition | -| secret.[secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the secret | -| secret.[secret-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for secret | -| secret.[secret-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for secret | -| secret.[secret-name].type | `string` | ❌ | ✅ | `Opaque` | Custom secret type | -| secret.[secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the secret | +| Key | Type | Required | Helm Template | Default | Description | +| :------------------------------- | :-------: | :------: | :----------------: | :------: | :-------------------------------- | +| secret | `dict` | ❌ | ❌ | `{}` | Define the secret as dicts | +| secret.[secret-name] | `dict` | ✅ | ❌ | `{}` | Holds secret definition | +| secret.[secret-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the secret | +| secret.[secret-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for secret | +| secret.[secret-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for secret | +| secret.[secret-name].type | `string` | ❌ | ✅ | `Opaque` | Custom secret type | +| secret.[secret-name].data | `dict` | ✅ | ✅ | `{}` | Define the data of the secret | --- diff --git a/library/common/1.0.0/docs/serviceAccount.md b/library/common/1.0.0/docs/serviceAccount.md index 1add4202b1..074f0e595a 100644 --- a/library/common/1.0.0/docs/serviceAccount.md +++ b/library/common/1.0.0/docs/serviceAccount.md @@ -1,15 +1,15 @@ # Service Account -| Key | Type | Required | Helm Template | Default | Description | -| :--------------------------------------- | :-------: | :------: | :-----------: | :-----: | :------------------------------------------------------ | -| serviceAccount | `dict` | ❌ | ❌ | `{}` | Define the serviceAccount as dicts | -| serviceAccount.[sa-name] | `dict` | ✅ | ❌ | `{}` | Holds service account definition | -| serviceAccount.[sa-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the service account | -| serviceAccount.[sa-name].primary | `boolean` | ❌ | ❌ | `false` | Sets the service account as primary | -| serviceAccount.[sa-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for service account | -| serviceAccount.[sa-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for service account | -| serviceAccount.[sa-name].targetSelectAll | `boolean` | ❌ | ❌ | | Whether to assign the serviceAccount to all pods or not | -| serviceAccount.[sa-name].targetSelector | `list` | ❌ | ❌ | `[]` | Define the pod(s) to assign the serviceAccount | +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------- | :-------: | :------: | :----------------: | :-----: | :------------------------------------------------------ | +| serviceAccount | `dict` | ❌ | ❌ | `{}` | Define the serviceAccount as dicts | +| serviceAccount.[sa-name] | `dict` | ✅ | ❌ | `{}` | Holds service account definition | +| serviceAccount.[sa-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the service account | +| serviceAccount.[sa-name].primary | `boolean` | ❌ | ❌ | `false` | Sets the service account as primary | +| serviceAccount.[sa-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for service account | +| serviceAccount.[sa-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for service account | +| serviceAccount.[sa-name].targetSelectAll | `boolean` | ❌ | ❌ | | Whether to assign the serviceAccount to all pods or not | +| serviceAccount.[sa-name].targetSelector | `list` | ❌ | ❌ | `[]` | Define the pod(s) to assign the serviceAccount | > When `targetSelectAll` is `true`, it will assign the serviceAccount to all pods (`targetSelector` is ignored in this case) > When `targetSelector` is a list, each entry is a string, referencing the pod(s) name that will be assigned. diff --git a/library/common/1.0.0/docs/workload.md b/library/common/1.0.0/docs/workload.md index 6e80dd4873..433563c76c 100644 --- a/library/common/1.0.0/docs/workload.md +++ b/library/common/1.0.0/docs/workload.md @@ -1,48 +1,38 @@ # workload -| Key | Type | Required | Helm Template | Default | Description | -| :----------------------------------------------------------------- | :-------: | :------: | :-----------: | :-------------------------------------------------------------: | :--------------------------------------------------------------------------------- | -| workload | `dict` | ❌ | ❌ | `{}` | Define the workload as dicts | -| workload.[workload-name] | `dict` | ✅ | ❌ | `{}` | Holds workload definition | -| workload.[workload-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the workload | -| workload.[workload-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the workload as primary | -| workload.[workload-name].labels | `dict` | ❌ | ❌ | `{}` | Additional labels for workload | -| workload.[workload-name].labels.[key-name] | `string` | ❌ | ❌ | | [Key] of the additional label | -| workload.[workload-name].labels.[key-name].[value] | `string` | ❌ | ✅ | | [Value] for [key] of the additional label | -| workload.[workload-name].annotations | `dict` | ❌ | ❌ | `{}` | Additional annotations for workload | -| workload.[workload-name].annotations.[key-name] | `string` | ❌ | ❌ | | [Key] of the additional annotation | -| workload.[workload-name].annotations.[key-name].[value] | `string` | ❌ | ✅ | | [Value] for [key] of the additional annotation | -| workload.[workload-name].type | `string` | ✅ | ❌ | `""` | Define the kind of the workload (Deployment, DaemonSet, StatefulSet, CronJob, Job) | -| workload.[workload-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| workload.[workload-name].podSpec.labels | `dict` | ❌ | ❌ | `{}` | Additional Pod Labels | -| workload.[workload-name].podSpec.labels.[key-name] | `string` | ❌ | ❌ | | [Key] of the additional label | -| workload.[workload-name].podSpec.labels.[key-name].[value] | `string` | ❌ | ✅ | | [Value] for [key] of the additional label | -| workload.[workload-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | -| workload.[workload-name].podSpec.annotations.[key-name] | `string` | ❌ | ❌ | | [Key] of the additional annotation | -| workload.[workload-name].podSpec.annotations.[key-name].[value] | `string` | ❌ | ✅ | | [Value] of [key] of the additional annotation | -| workload.[workload-name].podSpec.automountServiceAccountToken | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.automountServiceAccoutnToken }}` (false) | Pod's automountServiceAccountToken | -| workload.[workload-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | -| workload.[workload-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | -| workload.[workload-name].podSpec.restartPolicy | `string` | ❌ | ✅ | `{{ .Values.podOptions.restartPolicy }}` (Always) | Pod's restartPolicy. (Always, Never, OnFailure) | -| workload.[workload-name].podSpec.schedulerName | `string` | ❌ | ✅ | `{{ .Values.podOptions.schedulerName }}` ("") | Pod's schedulerName | -| workload.[workload-name].podSpec.priorityClassName | `string` | ❌ | ✅ | `{{ .Values.podOptions.priorityClassName }}` ("") | Pod's priorityClassName | -| workload.[workload-name].podSpec.hostname | `string` | ❌ | ✅ | `""` | Pod's hostname | -| workload.[workload-name].podSpec.terminationGracePeriodSeconds | `int` | ❌ | ✅ | `{{ .Values.podOptions.terminationGracePeriodSeconds }}` (120) | Pod's terminationGracePeriodSeconds | -| workload.[workload-name].podSpec.nodeSelector | `dict` | ❌ | ❌ | `{{ .Values.podOptions.nodeSelector }}` ({}) | Pod's nodeSelector | -| workload.[workload-name].podSpec.nodeSelector.[key-name] | `string` | ❌ | ❌ | | [Key] for nodeSelector | -| workload.[workload-name].podSpec.nodeSelector.[key-name].[value] | `string` | ❌ | ✅ | | [Value] for [key] for nodeSelector | -| workload.[workload-name].podSpec.hostAliases | `list` | ❌ | ❌ | | Pod's host aliases | -| workload.[workload-name].podSpec.hostAliases.ip | `string` | ❌ | ✅ | | Value for `ip` in hosts aliases | -| workload.[workload-name].podSpec.hostAliases.hostnames | `list` | ❌ | ❌ | | Hostnames for the `ip` in hosts aliases | -| workload.[workload-name].podSpec.hostAliases.hostnames.[host-name] | `string` | ❌ | ✅ | | [Value] for `hostnames` for the `ip` in hosts aliases | -| workload.[workload-name].podSpec.dnsPolicy | `string` | ❌ | ✅ | `{{ .Values.podOptions.dnsPolicy }}` (ClusterFirst) | Pod's DNS Policy (ClusterFirst, ClusterFirstWithHostNet, Default, None). | -| workload.[workload-name].podSpec.tolerations | `list` | ❌ | ❌ | `{{ .Values.podOptions.tolerations }}` ([]) | Pod's Tolerations | -| workload.[workload-name].podSpec.tolerations.operator | `string` | ✅ | ✅ | | Toleration's `operator` (Equal, Exists) | -| workload.[workload-name].podSpec.tolerations.key | `string` | ❌/✅ | ✅ | | Toleration's `key`. Required only when `operator` = `Equal` | -| workload.[workload-name].podSpec.tolerations.value | `string` | ❌/✅ | ✅ | | Toleration's `value`. Required only when `operator` = `Equal` | -| workload.[workload-name].podSpec.tolerations.effect | `string` | ❌ | ✅ | | Toleration's `effect`.(NoExecute, NoSchedule, PreferNoSchedule) | -| workload.[workload-name].podSpec.tolerations.tolerationSeconds | `int` | ❌ | ❌ | | Toleration's `tolerationSeconds`. | -| workload.[workload-name].podSpec.runtimeClassName | `string` | ✅ | ❌ | `{{ .Values.podOptions.runtimeClassName }}` ("") | Pod's runtimeClassName | +| Key | Type | Required | Helm Template | Default | Description | +| :----------------------------------------------------------------- | :-------: | :------: | :----------------: | :-------------------------------------------------------------: | :--------------------------------------------------------------------------------- | +| workload | `dict` | ❌ | ❌ | `{}` | Define the workload as dicts | +| workload.[workload-name] | `dict` | ✅ | ❌ | `{}` | Holds workload definition | +| workload.[workload-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the workload | +| workload.[workload-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the workload as primary | +| workload.[workload-name].labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional labels for workload | +| workload.[workload-name].annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Additional annotations for workload | +| workload.[workload-name].type | `string` | ✅ | ❌ | `""` | Define the kind of the workload (Deployment, DaemonSet, StatefulSet, CronJob, Job) | +| workload.[workload-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| workload.[workload-name].podSpec.labels | `dict` | ❌ | ✅ (On value only) | `{}` | Additional Pod Labels | +| workload.[workload-name].podSpec.annotations | `dict` | ❌ | ✅ (On value only) | `{}` | Pod Annotations | +| workload.[workload-name].podSpec.automountServiceAccountToken | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.automountServiceAccoutnToken }}` (false) | Pod's automountServiceAccountToken | +| workload.[workload-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| workload.[workload-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | +| workload.[workload-name].podSpec.restartPolicy | `string` | ❌ | ✅ | `{{ .Values.podOptions.restartPolicy }}` (Always) | Pod's restartPolicy. (Always, Never, OnFailure) | +| workload.[workload-name].podSpec.schedulerName | `string` | ❌ | ✅ | `{{ .Values.podOptions.schedulerName }}` ("") | Pod's schedulerName | +| workload.[workload-name].podSpec.priorityClassName | `string` | ❌ | ✅ | `{{ .Values.podOptions.priorityClassName }}` ("") | Pod's priorityClassName | +| workload.[workload-name].podSpec.hostname | `string` | ❌ | ✅ | `""` | Pod's hostname | +| workload.[workload-name].podSpec.terminationGracePeriodSeconds | `int` | ❌ | ✅ | `{{ .Values.podOptions.terminationGracePeriodSeconds }}` (120) | Pod's terminationGracePeriodSeconds | +| workload.[workload-name].podSpec.nodeSelector | `dict` | ❌ | ✅ (On value only) | `{{ .Values.podOptions.nodeSelector }}` ({}) | Pod's nodeSelector | +| workload.[workload-name].podSpec.hostAliases | `list` | ❌ | ❌ | | Pod's host aliases | +| workload.[workload-name].podSpec.hostAliases.ip | `string` | ❌ | ✅ | | Value for `ip` in hosts aliases | +| workload.[workload-name].podSpec.hostAliases.hostnames | `list` | ❌ | ❌ | | Hostnames for the `ip` in hosts aliases | +| workload.[workload-name].podSpec.hostAliases.hostnames.[host-name] | `string` | ❌ | ✅ | | [Value] for `hostnames` for the `ip` in hosts aliases | +| workload.[workload-name].podSpec.dnsPolicy | `string` | ❌ | ✅ | `{{ .Values.podOptions.dnsPolicy }}` (ClusterFirst) | Pod's DNS Policy (ClusterFirst, ClusterFirstWithHostNet, Default, None). | +| workload.[workload-name].podSpec.tolerations | `list` | ❌ | ❌ | `{{ .Values.podOptions.tolerations }}` ([]) | Pod's Tolerations | +| workload.[workload-name].podSpec.tolerations.operator | `string` | ✅ | ✅ | | Toleration's `operator` (Equal, Exists) | +| workload.[workload-name].podSpec.tolerations.key | `string` | ❌/✅ | ✅ | | Toleration's `key`. Required only when `operator` = `Equal` | +| workload.[workload-name].podSpec.tolerations.value | `string` | ❌/✅ | ✅ | | Toleration's `value`. Required only when `operator` = `Equal` | +| workload.[workload-name].podSpec.tolerations.effect | `string` | ❌ | ✅ | | Toleration's `effect`.(NoExecute, NoSchedule, PreferNoSchedule) | +| workload.[workload-name].podSpec.tolerations.tolerationSeconds | `int` | ❌ | ❌ | | Toleration's `tolerationSeconds`. | +| workload.[workload-name].podSpec.runtimeClassName | `string` | ✅ | ❌ | `{{ .Values.podOptions.runtimeClassName }}` ("") | Pod's runtimeClassName | --- diff --git a/library/common/1.0.0/templates/classes/_cronjob.tpl b/library/common/1.0.0/templates/classes/_cronjob.tpl index 4892689075..3552ccb226 100644 --- a/library/common/1.0.0/templates/classes/_cronjob.tpl +++ b/library/common/1.0.0/templates/classes/_cronjob.tpl @@ -33,7 +33,7 @@ spec: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) (include "ix.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml) - (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | fromYaml)) -}} + (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | fromYaml)) -}} {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} labels: {{- . | nindent 12 }} diff --git a/library/common/1.0.0/templates/classes/_daemonset.tpl b/library/common/1.0.0/templates/classes/_daemonset.tpl index f1880156c3..24e02ca5e7 100644 --- a/library/common/1.0.0/templates/classes/_daemonset.tpl +++ b/library/common/1.0.0/templates/classes/_daemonset.tpl @@ -30,13 +30,13 @@ spec: {{- include "ix.v1.common.lib.workload.daemonsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} selector: matchLabels: - {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | nindent 6 }} + {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | nindent 6 }} template: metadata: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) (include "ix.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml) - (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | fromYaml)) -}} + (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | fromYaml)) -}} {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} labels: {{- . | nindent 8 }} diff --git a/library/common/1.0.0/templates/classes/_deployment.tpl b/library/common/1.0.0/templates/classes/_deployment.tpl index 895dc067ff..ef307df33c 100644 --- a/library/common/1.0.0/templates/classes/_deployment.tpl +++ b/library/common/1.0.0/templates/classes/_deployment.tpl @@ -30,13 +30,13 @@ spec: {{- include "ix.v1.common.lib.workload.deploymentSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} selector: matchLabels: - {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | nindent 6 }} + {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | nindent 6 }} template: metadata: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) (include "ix.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml) - (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | fromYaml)) -}} + (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | fromYaml)) -}} {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} labels: {{- . | nindent 8 }} diff --git a/library/common/1.0.0/templates/classes/_job.tpl b/library/common/1.0.0/templates/classes/_job.tpl index 18569075f0..815a9eabd2 100644 --- a/library/common/1.0.0/templates/classes/_job.tpl +++ b/library/common/1.0.0/templates/classes/_job.tpl @@ -33,7 +33,7 @@ spec: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) (include "ix.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml) - (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | fromYaml)) -}} + (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | fromYaml)) -}} {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} labels: {{- . | nindent 8 }} diff --git a/library/common/1.0.0/templates/classes/_statefulset.tpl b/library/common/1.0.0/templates/classes/_statefulset.tpl index 1cb6cc87ec..a8f70ed6c0 100644 --- a/library/common/1.0.0/templates/classes/_statefulset.tpl +++ b/library/common/1.0.0/templates/classes/_statefulset.tpl @@ -30,13 +30,13 @@ spec: {{- include "ix.v1.common.lib.workload.statefulsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} selector: matchLabels: - {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | nindent 6 }} + {{- include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | nindent 6 }} template: metadata: {{- $labels := (mustMerge ($objectData.podSpec.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) (include "ix.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml) - (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.name) | fromYaml)) -}} + (include "ix.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "podName" $objectData.shortName) | fromYaml)) -}} {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} labels: {{- . | nindent 8 }} diff --git a/library/common/1.0.0/templates/lib/metadata/_allLabels.tpl b/library/common/1.0.0/templates/lib/metadata/_allLabels.tpl index 838ae80835..eceea568c9 100644 --- a/library/common/1.0.0/templates/lib/metadata/_allLabels.tpl +++ b/library/common/1.0.0/templates/lib/metadata/_allLabels.tpl @@ -8,6 +8,6 @@ helm-revision: {{ .Release.Revision | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} app: {{ include "ix.v1.common.lib.chart.names.chart" . }} -release: {{ .Release.Name | lower }} +release: {{ .Release.Name }} {{- include "ix.v1.common.lib.metadata.globalLabels" . }} {{- end -}} diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index 342a6e502e..e21eeb72be 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -39,53 +39,6 @@ image: # -- Image pull policy pullPolicy: IfNotPresent -# -- Service Account: -serviceAccount: - sa-name: - # -- Enables the service account - enabled: false - # -- Primary service account - primary: true - # -- Service account labels - labels: {} - # -- Service account annotations - annotations: {} - targetSelectAll: false - targetSelector: - - pod-name - -# -- RBAC -rbac: - rbac-name: - # -- Enables the RBAC - enabled: false - # -- Primary RBAC - primary: true - # -- RBAC labels - labels: {} - # -- RBAC annotations - annotations: {} - # -- ClusterWide - clusterWide: false - # -- Select all service accounts - allServiceAccounts: false - # -- Service accounts to select - serviceAccounts: - - sa-name2 - # -- RBAC rules - rules: - - apiGroups: - - "" - resources: - - pods - verbs: - - get - # -- RBAC subjects - subjects: - - kind: a-kind - name: a-name - apiGroup: a-group - # -- Security Context securityContext: # -- Container security context for all containers @@ -257,7 +210,7 @@ service: # -- Service name main: # -- Enables the service - enabled: false + enabled: true # -- Primary service primary: true # -- Service labels @@ -265,7 +218,7 @@ service: # -- Service annotations annotations: {} # -- Pod to connect - targetSelector: main + # targetSelector: main # -- Ports ports: port-name: @@ -485,7 +438,7 @@ workload: # -- Containers containers: # -- Container name - container-name: + main: # -- Enables the container enabled: true # -- Container image @@ -555,29 +508,30 @@ workload: # TODO: portal: {} +# Done # -- Image Pull Secrets -imagePullSecret: +imagePullSecret: [] # -- 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 + # 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: + # - main # -- ConfigMaps (docs/configmap.md) configmap: {} @@ -606,3 +560,50 @@ secret: {} # data: # # -- Secret data (stringData) # key: value + +# -- Service Account: +serviceAccount: {} + # main: + # # -- Enables the service account + # enabled: false + # # -- Primary service account + # primary: true + # # -- Service account labels + # labels: {} + # # -- Service account annotations + # annotations: {} + # targetSelectAll: false + # targetSelector: + # - main + +# -- RBAC +rbac: {} + # main: + # # -- Enables the RBAC + # enabled: false + # # -- Primary RBAC + # primary: true + # # -- RBAC labels + # labels: {} + # # -- RBAC annotations + # annotations: {} + # # -- ClusterWide + # clusterWide: false + # # -- Select all service accounts + # allServiceAccounts: false + # # -- Service accounts to select + # serviceAccounts: + # - main + # # -- RBAC rules + # rules: + # - apiGroups: + # - "" + # resources: + # - pods + # verbs: + # - get + # # -- RBAC subjects + # subjects: + # - kind: a-kind + # name: a-name + # apiGroup: a-group