mirror of
https://github.com/truenas/charts.git
synced 2024-04-21 15:21:45 +00:00
deployment basic spec
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <type> 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 <labels> 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 <annotations> to be a dictionary, but got [string]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 <strategy> 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 <rollingUpdate> to be a dictionary, but got [string]
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
@@ -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 <type> 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 <labels> to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}}
|
||||
{{- fail (printf "Controller - Expected <annotations> 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 <strategy> 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 <rollingUpdate> to be a dictionary, but got [%v]" (kindOf $rollUp)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -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 -}}
|
||||
|
||||
|
||||
@@ -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: ""
|
||||
|
||||
Reference in New Issue
Block a user