From b0e37a59ef75150e50cf294de9ef8ca1cf3a757a Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Mon, 30 Jan 2023 11:07:58 +0200 Subject: [PATCH] deployment basic spec --- .../tests/configmap/metadata_test.yaml | 10 +- .../tests/controller/validation_test.yaml | 98 +++++++++++++++++++ .../tests/deployment/metadata_test.yaml | 57 +++++++++++ .../tests/deployment/names_test.yaml | 36 +++++++ .../tests/deployment/spec_test.yaml | 52 ++++++++++ .../tests/deployment/validation_test.yaml | 28 ++++++ .../tests/imagePullSecret/metadata_test.yaml | 10 +- .../tests/secret/metadata_test.yaml | 10 +- library/common/1.0.0/docs/deployment.md | 60 ++++++++++++ .../1.0.0/templates/classes/_deployment.tpl | 38 +++++++ .../lib/controller/_deployementSpec.tpl | 26 +++++ .../templates/lib/controller/_validation.tpl | 94 ++++++++++++++++++ .../1.0.0/templates/spawner/_controller.tpl | 40 ++++++-- library/common/1.0.0/values.yaml | 36 +++---- 14 files changed, 556 insertions(+), 39 deletions(-) create mode 100644 library/common-test/tests/controller/validation_test.yaml create mode 100644 library/common-test/tests/deployment/metadata_test.yaml create mode 100644 library/common-test/tests/deployment/names_test.yaml create mode 100644 library/common-test/tests/deployment/spec_test.yaml create mode 100644 library/common-test/tests/deployment/validation_test.yaml create mode 100644 library/common/1.0.0/docs/deployment.md create mode 100644 library/common/1.0.0/templates/lib/controller/_deployementSpec.tpl create mode 100644 library/common/1.0.0/templates/lib/controller/_validation.tpl diff --git a/library/common-test/tests/configmap/metadata_test.yaml b/library/common-test/tests/configmap/metadata_test.yaml index be96dc0050..b56e511b72 100644 --- a/library/common-test/tests/configmap/metadata_test.yaml +++ b/library/common-test/tests/configmap/metadata_test.yaml @@ -5,7 +5,6 @@ chart: appVersion: &appVer v9.9.9 tests: - it: should pass with configmap created with labels and annotations - documentIndex: &configMapDoc 0 set: label1: label1 label2: global_label2 @@ -30,16 +29,19 @@ tests: data: foo: bar asserts: - - isKind: + - documentIndex: &configMapDoc 0 + isKind: of: ConfigMap - - equal: + - documentIndex: *configMapDoc + equal: path: metadata.annotations value: annotation1: annotation1 annotation2: annotation2 g_annotation1: global_annotation1 g_annotation2: global_annotation2 - - equal: + - documentIndex: *configMapDoc + equal: path: metadata.labels value: app: common-test-1.0.0 diff --git a/library/common-test/tests/controller/validation_test.yaml b/library/common-test/tests/controller/validation_test.yaml new file mode 100644 index 0000000000..7f2a89388d --- /dev/null +++ b/library/common-test/tests/controller/validation_test.yaml @@ -0,0 +1,98 @@ +suite: controller validation test +templates: + - common.yaml +tests: + - it: should fail with name longer than 63 characters + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + other-controller-name-super-long-name-that-is-longer-than-63-characters: + enabled: true + primary: false + type: Deployment + asserts: + - failedTemplate: + errorMessage: Name [release-name-common-test-other-controller-name-super-long-name-that-is-longer-than-63-characters] is not valid. Must start and end with an alphanumeric character. It can contain '-'. And must be at most 63 characters. + + - it: should fail with name starting with underscore + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + _other-controller-name: + enabled: true + primary: false + type: Deployment + asserts: + - failedTemplate: + errorMessage: Name [release-name-common-test-_other-controller-name] is not valid. Must start and end with an alphanumeric character. It can contain '-'. And must be at most 63 characters. + + - it: should fail with invalid type + set: + controllers: + controller-name: + enabled: true + primary: true + type: not-valid-type + asserts: + - failedTemplate: + errorMessage: Controller - Expected to be one of [Deployment, StatefulSet, DaemonSet, Job, CronJob], but got [not-valid-type] + + - it: should fail without primary enabled controller + set: + controllers: + controller-name: + enabled: false + primary: true + type: Deployment + other-controller-name: + enabled: true + primary: false + type: Deployment + asserts: + - failedTemplate: + errorMessage: Controller - At least one enabled controller must be primary + + - it: should fail more than one primary enabled controller + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + other-controller-name: + enabled: true + primary: true + type: Deployment + asserts: + - failedTemplate: + errorMessage: Controller - Only one controller can be primary + + - it: should fail with labels not a dict + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + labels: "not a dict" + asserts: + - failedTemplate: + errorMessage: Controller - Expected to be a dictionary, but got [string] + + - it: should fail with annotations not a dict + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + annotations: "not a dict" + asserts: + - failedTemplate: + errorMessage: Controller - Expected to be a dictionary, but got [string] diff --git a/library/common-test/tests/deployment/metadata_test.yaml b/library/common-test/tests/deployment/metadata_test.yaml new file mode 100644 index 0000000000..d0b30b267a --- /dev/null +++ b/library/common-test/tests/deployment/metadata_test.yaml @@ -0,0 +1,57 @@ +suite: deployment metadata test +templates: + - common.yaml +chart: + appVersion: &appVer v9.9.9 +tests: + - it: should pass with deployment created with labels and annotations + + set: + label1: label1 + label2: global_label2 + annotation1: annotation1 + annotation2: global_annotation2 + global: + labels: + g_label1: global_label1 + g_label2: "{{ .Values.label2 }}" + annotations: + g_annotation1: global_annotation1 + g_annotation2: "{{ .Values.annotation2 }}" + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + labels: + label1: "{{ .Values.label1 }}" + label2: label2 + annotations: + annotation1: "{{ .Values.annotation1 }}" + annotation2: annotation2 + asserts: + - documentIndex: &deploymentDoc 0 + isKind: + of: Deployment + - documentIndex: *deploymentDoc + equal: + path: metadata.annotations + value: + annotation1: annotation1 + annotation2: annotation2 + g_annotation1: global_annotation1 + g_annotation2: global_annotation2 + - documentIndex: *deploymentDoc + equal: + path: metadata.labels + value: + app: common-test-1.0.0 + release: release-name + helm-revision: 0 + helm.sh/chart: common-test-1.0.0 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/version: v9.9.9 + g_label1: global_label1 + g_label2: global_label2 + label1: label1 + label2: label2 diff --git a/library/common-test/tests/deployment/names_test.yaml b/library/common-test/tests/deployment/names_test.yaml new file mode 100644 index 0000000000..7a1bb5a3ba --- /dev/null +++ b/library/common-test/tests/deployment/names_test.yaml @@ -0,0 +1,36 @@ +suite: deployment name test +templates: + - common.yaml +tests: + - it: should generate correct name + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + other-controller-name: + enabled: true + primary: false + type: Deployment + asserts: + - documentIndex: &deploymentDoc 0 + isKind: + of: Deployment + - documentIndex: *deploymentDoc + isAPIVersion: + of: apps/v1 + - documentIndex: *deploymentDoc + equal: + path: metadata.name + value: release-name-common-test + - documentIndex: &deploymentDoc 1 + isKind: + of: Deployment + - documentIndex: *deploymentDoc + isAPIVersion: + of: apps/v1 + - documentIndex: *deploymentDoc + equal: + path: metadata.name + value: release-name-common-test-other-controller-name diff --git a/library/common-test/tests/deployment/spec_test.yaml b/library/common-test/tests/deployment/spec_test.yaml new file mode 100644 index 0000000000..db2bc85495 --- /dev/null +++ b/library/common-test/tests/deployment/spec_test.yaml @@ -0,0 +1,52 @@ +suite: deployment spec test +templates: + - common.yaml +tests: + - it: should pass with controller enabled + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + asserts: + - documentIndex: &deploymentDoc 0 + isKind: + of: Deployment + - documentIndex: *deploymentDoc + isAPIVersion: + of: apps/v1 + - documentIndex: *deploymentDoc + isSubset: + path: spec + content: + replicas: 1 + revisionHistoryLimit: 3 + strategy: + type: Recreate + + - it: should apply spec correctly + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + replicas: 2 + revisionHistoryLimit: 4 + strategy: RollingUpdate + rollingUpdate: + maxSurge: 5 + maxUnavailable: 5 + asserts: + - documentIndex: *deploymentDoc + isSubset: + path: spec + content: + replicas: 2 + revisionHistoryLimit: 4 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 5 + maxUnavailable: 5 diff --git a/library/common-test/tests/deployment/validation_test.yaml b/library/common-test/tests/deployment/validation_test.yaml new file mode 100644 index 0000000000..5a889ed0e6 --- /dev/null +++ b/library/common-test/tests/deployment/validation_test.yaml @@ -0,0 +1,28 @@ +suite: deployment validation test +templates: + - common.yaml +tests: + - it: should fail with invalid strategy + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + strategy: not-a-strategy + asserts: + - failedTemplate: + errorMessage: Deployment - Expected to be one of [Recreate, RollingUpdate], but got [not-a-strategy] + + - it: should fail with rollingUpdate not a dict + set: + controllers: + controller-name: + enabled: true + primary: true + type: Deployment + strategy: RollingUpdate + rollingUpdate: "not a dict" + asserts: + - failedTemplate: + errorMessage: Deployment - Expected to be a dictionary, but got [string] diff --git a/library/common-test/tests/imagePullSecret/metadata_test.yaml b/library/common-test/tests/imagePullSecret/metadata_test.yaml index c01828f32d..ba60cb7eb3 100644 --- a/library/common-test/tests/imagePullSecret/metadata_test.yaml +++ b/library/common-test/tests/imagePullSecret/metadata_test.yaml @@ -5,7 +5,6 @@ chart: appVersion: &appVer v9.9.9 tests: - it: should pass with secret created with labels and annotations - documentIndex: &secretDoc 0 set: label1: label1 label2: global_label2 @@ -33,16 +32,19 @@ tests: password: pass email: mail asserts: - - isKind: + - documentIndex: &secretDoc 0 + isKind: of: Secret - - equal: + - documentIndex: *secretDoc + equal: path: metadata.annotations value: annotation1: annotation1 annotation2: annotation2 g_annotation1: global_annotation1 g_annotation2: global_annotation2 - - equal: + - documentIndex: *secretDoc + equal: path: metadata.labels value: app: common-test-1.0.0 diff --git a/library/common-test/tests/secret/metadata_test.yaml b/library/common-test/tests/secret/metadata_test.yaml index 9acd086283..2e1ea03ef4 100644 --- a/library/common-test/tests/secret/metadata_test.yaml +++ b/library/common-test/tests/secret/metadata_test.yaml @@ -5,7 +5,6 @@ chart: appVersion: &appVer v9.9.9 tests: - it: should pass with secret created with labels and annotations - documentIndex: &secretDoc 0 set: label1: label1 label2: global_label2 @@ -30,16 +29,19 @@ tests: data: foo: bar asserts: - - isKind: + - documentIndex: &secretDoc 0 + isKind: of: Secret - - equal: + - documentIndex: *secretDoc + equal: path: metadata.annotations value: annotation1: annotation1 annotation2: annotation2 g_annotation1: global_annotation1 g_annotation2: global_annotation2 - - equal: + - documentIndex: *secretDoc + equal: path: metadata.labels value: app: common-test-1.0.0 diff --git a/library/common/1.0.0/docs/deployment.md b/library/common/1.0.0/docs/deployment.md new file mode 100644 index 0000000000..5b111c7f8b --- /dev/null +++ b/library/common/1.0.0/docs/deployment.md @@ -0,0 +1,60 @@ +# Deployment + +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :--------: | :------------------------------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `Recreate` | Define the strategy of the controller | +| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate | + +--- + +Appears in: + +- `.Values.controllers` + +--- + +Naming scheme: + +- Primary: `$FullName` (release-name-chart-name) +- Non-Primary: `$FullName-$ControllerName` (release-name-chart-name-controller-name) + +--- + +Examples: + +```yaml +controllers: + controller-name: + enabled: true + primary: true + type: Deployment + labels: {} + annotations: {} + replicas: 1 + revisionHistoryLimit: 3 + strategy: Recreate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + other-controller-name: + enabled: true + primary: false + type: Deployment + labels: {} + annotations: {} + replicas: 1 + revisionHistoryLimit: 3 + strategy: Recreate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 +``` diff --git a/library/common/1.0.0/templates/classes/_deployment.tpl b/library/common/1.0.0/templates/classes/_deployment.tpl index e69de29bb2..9df0bc083f 100644 --- a/library/common/1.0.0/templates/classes/_deployment.tpl +++ b/library/common/1.0.0/templates/classes/_deployment.tpl @@ -0,0 +1,38 @@ +{{/* Deployment Class */}} +{{/* Call this template: +{{ include "ix.v1.common.class.deployment" (dict "objectData" $objectData "rootCtx" $) }} + +rootCtx: The root context of the template. It is used to access the global context. +objectData: + name: The name of the configmap. + labels: The labels of the configmap. + annotations: The annotations of the configmap. + replicas: The number of replicas. + revisionHistoryLimit: The number of old ReplicaSets to retain to allow rollback. + strategy: The deployment strategy. +*/}} + +{{- define "ix.v1.common.class.deployment" -}} + + {{- $rootCtx := .rootCtx -}} + {{- $objectData := .objectData -}} + {{- include "ix.v1.common.lib.controller.deploymentValidation" (dict "objectData" $objectData "rootCtx" $rootCtx) }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $objectData.name }} + {{- $labels := (mustMerge ($objectData.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}} + {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }} + labels: + {{- . | nindent 4 }} + {{- end -}} + {{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "ix.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}} + {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }} + annotations: + {{- . | nindent 4 }} + {{- end }} +spec: + {{- include "ix.v1.common.lib.controller.deploymentSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | nindent 2 }} + +{{- end -}} diff --git a/library/common/1.0.0/templates/lib/controller/_deployementSpec.tpl b/library/common/1.0.0/templates/lib/controller/_deployementSpec.tpl new file mode 100644 index 0000000000..6ed7e31f1e --- /dev/null +++ b/library/common/1.0.0/templates/lib/controller/_deployementSpec.tpl @@ -0,0 +1,26 @@ +{{/* Deployment Spec */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.controller.deploymentSpec" (dict "objectData" $objectData "rootCtx" $rootCtx) -}} +rootCtx: The root context of the template. It is used to access the global context. +objectData: + replicas: The number of replicas. + revisionHistoryLimit: The number of old ReplicaSets to retain to allow rollback. + strategy: The deployment strategy to use to replace existing pods with new ones. +*/}} +{{- define "ix.v1.common.lib.controller.deploymentSpec" -}} + {{- $objectData := .objectData -}} + {{- $rootCtx := .rootCtx -}} +replicas: {{ $objectData.replicas | default 1 }} +revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }} +strategy: + type: {{ $objectData.strategy | default "Recreate" }} + {{- if and (eq $objectData.strategy "RollingUpdate") $objectData.rollingUpdate }} + rollingUpdate: + {{- with $objectData.rollingUpdate.maxUnavailable }} + maxUnavailable: {{ .}} + {{- end -}} + {{- with $objectData.rollingUpdate.maxSurge }} + maxSurge: {{ . }} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/library/common/1.0.0/templates/lib/controller/_validation.tpl b/library/common/1.0.0/templates/lib/controller/_validation.tpl new file mode 100644 index 0000000000..d425cc8d64 --- /dev/null +++ b/library/common/1.0.0/templates/lib/controller/_validation.tpl @@ -0,0 +1,94 @@ +{{/* Controllers Basic Validation */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.controllers.primaryValidation" $ -}} +*/}} +{{- define "ix.v1.common.lib.controllers.primaryValidation" -}} + + {{/* Initialize values */}} + {{- $hasPrimary := false -}} + {{- $hasEnabled := false -}} + + {{/* Go over controllers */}} + {{- range $name, $controller := .Values.controllers -}} + + {{- if not (mustHas $controller.type (list "Deployment" "StatefulSet" "DaemonSet" "Job" "CronJob")) -}} + {{- fail (printf "Controller - Expected to be one of [Deployment, StatefulSet, DaemonSet, Job, CronJob], but got [%s]" $controller.type) -}} + {{- end -}} + + {{/* If controller is enabled */}} + {{- if $controller.enabled -}} + {{- $hasEnabled = true -}} + + {{/* And controller is primary */}} + {{- if and (hasKey $controller "primary") ($controller.primary) -}} + + {{/* Fail if there is already a primary controller */}} + {{- if $hasPrimary -}} + {{- fail "Controller - Only one controller can be primary" -}} + {{- end -}} + + {{- $hasPrimary = true -}} + + {{- end -}} + {{- end -}} + + {{- end -}} + + {{/* Require at least one primary controller, if any enabled */}} + {{- if and $hasEnabled (not $hasPrimary) -}} + {{- fail "Controller - At least one enabled controller must be primary" -}} + {{- end -}} + +{{- end -}} + +{{/* Basic Controller Validation */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.controller.basicValidation" (dict "objectData" $objectData) -}} +rootCtx: The root context of the template. It is used to access the global context. +objectData: + labels: The labels of the object. + annotations: The annotations of the object. +*/}} +{{- define "ix.v1.common.lib.controller.basicValidation" -}} + {{- $objectData := .objectData -}} + + {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} + {{- fail (printf "Controller - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} + {{- end -}} + + {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} + {{- fail (printf "Controller - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} + {{- end -}} + +{{- end -}} + +{{/* Deployment Validation */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.controller.basicValidation" (dict "objectData" $objectData) -}} +rootCtx: The root context of the template. It is used to access the global context. +objectData: + labels: The labels of the object. + annotations: The annotations of the object. +*/}} +{{- define "ix.v1.common.lib.controller.deploymentValidation" -}} + {{- $objectData := .objectData -}} + {{- $rootCtx := .rootCtx -}} + + {{- if $objectData.strategy -}} + {{- $strategy := $objectData.strategy -}} + + {{- if not (mustHas $strategy (list "Recreate" "RollingUpdate")) -}} + {{- fail (printf "Deployment - Expected to be one of [Recreate, RollingUpdate], but got [%v]" $strategy) -}} + {{- end -}} + + {{- end -}} + + {{- if $objectData.rollingUpdate -}} + {{- $rollUp := $objectData.rollingUpdate -}} + + {{- if and $rollUp (not (kindIs "map" $rollUp)) -}} + {{- fail (printf "Deployment - Expected to be a dictionary, but got [%v]" (kindOf $rollUp)) -}} + {{- end -}} + + {{- end -}} +{{- end -}} diff --git a/library/common/1.0.0/templates/spawner/_controller.tpl b/library/common/1.0.0/templates/spawner/_controller.tpl index 2e0e3cac2b..174b087612 100644 --- a/library/common/1.0.0/templates/spawner/_controller.tpl +++ b/library/common/1.0.0/templates/spawner/_controller.tpl @@ -1,21 +1,41 @@ -{{/* Configmap Spawwner */}} +{{/* Controller Spawner */}} {{/* Call this template: -{{ include "ix.v1.common.spawner.configmaps" $ -}} +{{ include "ix.v1.common.spawner.controllers" $ -}} */}} -{{- define "ix.v1.common.spawner.configmaps" -}} +{{- define "ix.v1.common.spawner.controllers" -}} - {{- range $name, $configmap := .Values.configmaps -}} + {{/* Primary validation for enabled controllers. */}} + {{- include "ix.v1.common.lib.controllers.primaryValidation" $ -}} - {{- if $configmap.enabled -}} + {{- range $name, $controller := .Values.controllers -}} - {{/* Create a copy of the configmap */}} - {{- $objectData := (mustDeepCopy $configmap) -}} + {{- if $controller.enabled -}} + + {{/* Create a copy of the controller */}} + {{- $objectData := (mustDeepCopy $controller) -}} + + {{/* Generate the name of the controller */}} + {{- $objectName := include "ix.common.lib.chart.names.fullname" $ -}} + {{- if not $objectData.primary -}} + {{- $objectName = printf "%s-%s" (include "ix.common.lib.chart.names.fullname" $) $name -}} + {{- end -}} + + {{/* Perform validations */}} + {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} + {{- include "ix.v1.common.lib.controller.basicValidation" (dict "objectData" $objectData) -}} + + {{/* Set the name of the controller */}} + {{- $_ := set $objectData "name" $objectName -}} - {{/* Set the name of the configmap */}} - {{- $_ := set $objectData "name" (printf "%s-%s" (include "ix.common.lib.chart.names.fullname" $) $name) -}} {{/* Call class to create the object */}} - {{- include "ix.v1.common.class.configmap" (dict "objectData" $objectData "rootCtx" $) -}} + {{- if eq $objectData.type "Deployment" -}} + {{- include "ix.v1.common.class.deployment" (dict "objectData" $objectData "rootCtx" $) -}} + {{- else if eq $objectData.type "StatefulSet" -}} + {{- else if eq $objectData.type "DaemonSet" -}} + {{- else if eq $objectData.type "Job" -}} + {{- else if eq $objectData.type "CronJob" -}} + {{- end -}} {{- end -}} diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index eb563aba5d..f3b84ed1b3 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -291,7 +291,6 @@ volumeClaimTemplates: subPath: "" mountPropagation: "" - # -- SCALE GPU scaleGPU: - gpu: @@ -373,28 +372,31 @@ controllers: controller-name: # -- Enables the controller enabled: false + # -- Primary controller + primary: true # -- Controller type type: Deployment # -- Controller labels labels: {} # -- Controller annotations annotations: {} - # -- Controller replicas (Deployment and StatefulSet only) - replicas: 1 - # -- Controller revision history limit - revisionHistoryLimit: 10 - # Strategy - strategy: - # -- Controller strategy type - type: RollingUpdate - # -- Controller strategy rolling update - rollingUpdate: - # -- Controller strategy rolling update max unavailable - maxUnavailable: 1 - # -- Controller strategy rolling update max surge - maxSurge: 1 - # -- Controller strategy rolling update partition (StatefulSet only) - partition: 0 + + # # -- Controller replicas (Deployment and StatefulSet only) + # replicas: 1 + # # -- Controller revision history limit + # revisionHistoryLimit: 3 + # # Strategy + # # -- Controller strategy type + # strategy: Recreate + # # -- Controller strategy rolling update + # rollingUpdate: + # # -- Controller strategy rolling update max unavailable + # maxUnavailable: 1 + # # -- Controller strategy rolling update max surge + # maxSurge: 1 + # # -- Controller strategy rolling update partition (StatefulSet only) + # partition: 0 + # -- CronJob # - CronJob schedule schedule: ""