diff --git a/library/common/1.0.0/templates/lib/configmap/_validation.tpl b/library/common/1.0.0/templates/lib/configmap/_validation.tpl index c702a51a0e..321d710f7e 100644 --- a/library/common/1.0.0/templates/lib/configmap/_validation.tpl +++ b/library/common/1.0.0/templates/lib/configmap/_validation.tpl @@ -18,12 +18,4 @@ objectData: {{- fail (printf "ConfigMap - Expected to be a dictionary, but got [%v]" (kindOf $objectData.data)) -}} {{- end -}} - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "ConfigMap - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "ConfigMap - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - {{- end -}} diff --git a/library/common/1.0.0/templates/lib/imagePullSecret/_validation.tpl b/library/common/1.0.0/templates/lib/imagePullSecret/_validation.tpl index dd61b88067..80328622e1 100644 --- a/library/common/1.0.0/templates/lib/imagePullSecret/_validation.tpl +++ b/library/common/1.0.0/templates/lib/imagePullSecret/_validation.tpl @@ -18,14 +18,6 @@ objectData: {{- fail (printf "Image Pull Secret - Expected to be a dictionary, but got [%v]" (kindOf $objectData.data)) -}} {{- end -}} - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Image Pull Secret - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Image Pull Secret - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - {{- range $key := (list "username" "password" "registry" "email") -}} {{- if not (get $objectData.data $key) -}} {{- fail (printf "Image Pull Secret - Expected non-empty <%s>" $key) -}} diff --git a/library/common/1.0.0/templates/lib/metadata/_validation.tpl b/library/common/1.0.0/templates/lib/metadata/_validation.tpl new file mode 100644 index 0000000000..4930f95ed2 --- /dev/null +++ b/library/common/1.0.0/templates/lib/metadata/_validation.tpl @@ -0,0 +1,22 @@ +{{/* Metadata Validation */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" $caller) -}} +objectData: + labels: The labels of the configmap. + annotations: The annotations of the configmap. + data: The data of the configmap. +*/}} + +{{- define "ix.v1.common.lib.metadata.validation" -}} + {{- $objectData := .objectData -}} + {{- $caller := .caller -}} + + {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} + {{- fail (printf "%s - Expected to be a dictionary, but got [%v]" $caller (kindOf $objectData.labels)) -}} + {{- end -}} + + {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} + {{- fail (printf "%s - Expected to be a dictionary, but got [%v]" $caller (kindOf $objectData.annotations)) -}} + {{- end -}} + +{{- end -}} diff --git a/library/common/1.0.0/templates/lib/rbac/_validation.tpl b/library/common/1.0.0/templates/lib/rbac/_validation.tpl index aded1d2383..7aa7fffe25 100644 --- a/library/common/1.0.0/templates/lib/rbac/_validation.tpl +++ b/library/common/1.0.0/templates/lib/rbac/_validation.tpl @@ -1,25 +1,3 @@ -{{/* RBAC Validation */}} -{{/* Call this template: -{{ include "ix.v1.common.lib.rbac.validation" (dict "objectData" $objectData) -}} -objectData: - labels: The labels of the rbac. - annotations: The annotations of the rbac. - data: The data of the rbac. -*/}} - -{{- define "ix.v1.common.lib.rbac.validation" -}} - {{- $objectData := .objectData -}} - - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "RBAC - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "RBAC - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - -{{- end -}} - {{/* RBAC Primary Validation */}} {{/* Call this template: {{ include "ix.v1.common.lib.rbac.primaryValidation" $ -}} diff --git a/library/common/1.0.0/templates/lib/secret/_validation.tpl b/library/common/1.0.0/templates/lib/secret/_validation.tpl index 643e35d3ab..410b612f3b 100644 --- a/library/common/1.0.0/templates/lib/secret/_validation.tpl +++ b/library/common/1.0.0/templates/lib/secret/_validation.tpl @@ -22,12 +22,4 @@ objectData: {{- fail (printf "Secret - Found key, but it's empty") -}} {{- end -}} - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Secret - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Secret - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - {{- end -}} diff --git a/library/common/1.0.0/templates/lib/service/_validation.tpl b/library/common/1.0.0/templates/lib/service/_validation.tpl index ba41924242..584b8ad534 100644 --- a/library/common/1.0.0/templates/lib/service/_validation.tpl +++ b/library/common/1.0.0/templates/lib/service/_validation.tpl @@ -10,14 +10,6 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Service - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Service - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - {{- if and $objectData.targetSelector (not (kindIs "string" $objectData.targetSelector)) -}} {{- fail (printf "Service - Expected to be [string], but got [%s]" (kindOf $objectData.targetSelector)) -}} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/serviceAccount/_validation.tpl b/library/common/1.0.0/templates/lib/serviceAccount/_validation.tpl index 9bd594f91e..62b40a5d04 100644 --- a/library/common/1.0.0/templates/lib/serviceAccount/_validation.tpl +++ b/library/common/1.0.0/templates/lib/serviceAccount/_validation.tpl @@ -1,24 +1,3 @@ -{{/* Service Account Validation */}} -{{/* Call this template: -{{ include "ix.v1.common.lib.serviceAccount.validation" (dict "objectData" $objectData) -}} -objectData: - labels: The labels of the serviceAccount. - annotations: The annotations of the serviceAccount. -*/}} - -{{- define "ix.v1.common.lib.serviceAccount.validation" -}} - {{- $objectData := .objectData -}} - - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Service Account - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Service Account - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - -{{- end -}} - {{/* Service Account Primary Validation */}} {{/* Call this template: {{ include "ix.v1.common.lib.serviceAccount.primaryValidation" $ -}} diff --git a/library/common/1.0.0/templates/lib/storage/_validation.tpl b/library/common/1.0.0/templates/lib/storage/_validation.tpl index 9e4831ff61..c7b77db47a 100644 --- a/library/common/1.0.0/templates/lib/storage/_validation.tpl +++ b/library/common/1.0.0/templates/lib/storage/_validation.tpl @@ -10,14 +10,6 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Persistence - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Persistence - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - {{- $types := (list "pvc" "emptyDir" "nfs" "hostPath" "ixVolume" "secret" "configmap") -}} {{- if not (mustHas $objectData.type $types) -}} {{- fail (printf "Persistence - Expected to be one of [%s], but got [%s]" (join ", " $types) $objectData.type) -}} diff --git a/library/common/1.0.0/templates/lib/workload/validation/_workloadValidation.tpl b/library/common/1.0.0/templates/lib/workload/validation/_workloadValidation.tpl index 1d9b5dada1..f80b0a8baf 100644 --- a/library/common/1.0.0/templates/lib/workload/validation/_workloadValidation.tpl +++ b/library/common/1.0.0/templates/lib/workload/validation/_workloadValidation.tpl @@ -41,24 +41,3 @@ {{- end -}} {{- end -}} - -{{/* Workload Basic Validation */}} -{{/* Call this template: -{{ include "ix.v1.common.lib.workload.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.workload.basicValidation" -}} - {{- $objectData := .objectData -}} - - {{- if and $objectData.labels (not (kindIs "map" $objectData.labels)) -}} - {{- fail (printf "Workload - Expected to be a dictionary, but got [%v]" (kindOf $objectData.labels)) -}} - {{- end -}} - - {{- if and $objectData.annotations (not (kindIs "map" $objectData.annotations)) -}} - {{- fail (printf "Workload - Expected to be a dictionary, but got [%v]" (kindOf $objectData.annotations)) -}} - {{- end -}} - -{{- end -}} diff --git a/library/common/1.0.0/templates/loader/_apply.tpl b/library/common/1.0.0/templates/loader/_apply.tpl index d479b34039..75cf211aed 100644 --- a/library/common/1.0.0/templates/loader/_apply.tpl +++ b/library/common/1.0.0/templates/loader/_apply.tpl @@ -4,6 +4,9 @@ {{/* Render ConfigMap(s) */}} {{- include "ix.v1.common.spawner.configmap" . | nindent 0 -}} + {{/* Render Certificate(s) */}} + {{- include "ix.v1.common.spawner.certificate" . | nindent 0 -}} + {{/* Render Secret(s) */}} {{- include "ix.v1.common.spawner.secret" . | nindent 0 -}} diff --git a/library/common/1.0.0/templates/spawner/_configmap.tpl b/library/common/1.0.0/templates/spawner/_configmap.tpl index 96635f10f6..53df70d0f8 100644 --- a/library/common/1.0.0/templates/spawner/_configmap.tpl +++ b/library/common/1.0.0/templates/spawner/_configmap.tpl @@ -16,6 +16,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} {{- include "ix.v1.common.lib.configmap.validation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "ConfigMap") -}} {{/* Set the name of the configmap */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/templates/spawner/_imagePullSecret.tpl b/library/common/1.0.0/templates/spawner/_imagePullSecret.tpl index e9d3c78558..19a8817601 100644 --- a/library/common/1.0.0/templates/spawner/_imagePullSecret.tpl +++ b/library/common/1.0.0/templates/spawner/_imagePullSecret.tpl @@ -17,6 +17,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} {{- include "ix.v1.common.lib.imagePullSecret.validation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Image Pull Secret") -}} {{- $data := include "ix.v1.common.lib.imagePullSecret.createData" (dict "rootCtx" $ "objectData" $objectData) -}} {{/* Update the data */}} diff --git a/library/common/1.0.0/templates/spawner/_pvc.tpl b/library/common/1.0.0/templates/spawner/_pvc.tpl index 87ac6f884c..4ca2f77488 100644 --- a/library/common/1.0.0/templates/spawner/_pvc.tpl +++ b/library/common/1.0.0/templates/spawner/_pvc.tpl @@ -16,6 +16,7 @@ {{/* Perform general validations */}} {{- include "ix.v1.common.lib.persistence.validation" (dict "rootCtx" $ "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Persistence") -}} {{/* Only spawn PVC if it's enabled and type of "pvc" */}} {{- if and (eq "pvc" $objectData.type) (not $objectData.existingClaim) -}} diff --git a/library/common/1.0.0/templates/spawner/_rbac.tpl b/library/common/1.0.0/templates/spawner/_rbac.tpl index 8b28bb9e20..3f0902fb75 100644 --- a/library/common/1.0.0/templates/spawner/_rbac.tpl +++ b/library/common/1.0.0/templates/spawner/_rbac.tpl @@ -22,7 +22,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} - {{- include "ix.v1.common.lib.rbac.validation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "RBAC") -}} {{/* Set the name of the rbac */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/templates/spawner/_secret.tpl b/library/common/1.0.0/templates/spawner/_secret.tpl index 9e01f46f4a..b8f53f1d18 100644 --- a/library/common/1.0.0/templates/spawner/_secret.tpl +++ b/library/common/1.0.0/templates/spawner/_secret.tpl @@ -16,6 +16,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} {{- include "ix.v1.common.lib.secret.validation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Secret") -}} {{/* Set the name of the secret */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/templates/spawner/_service.tpl b/library/common/1.0.0/templates/spawner/_service.tpl index 5c155a3b27..9cb233c7da 100644 --- a/library/common/1.0.0/templates/spawner/_service.tpl +++ b/library/common/1.0.0/templates/spawner/_service.tpl @@ -23,6 +23,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} {{- include "ix.v1.common.lib.service.validation" (dict "rootCtx" $ "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Service") -}} {{/* Set the name of the service account */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/templates/spawner/_serviceAccount.tpl b/library/common/1.0.0/templates/spawner/_serviceAccount.tpl index 2ad1be6a37..4851fefd8d 100644 --- a/library/common/1.0.0/templates/spawner/_serviceAccount.tpl +++ b/library/common/1.0.0/templates/spawner/_serviceAccount.tpl @@ -22,7 +22,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} - {{- include "ix.v1.common.lib.serviceAccount.validation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Service Account") -}} {{/* Set the name of the service account */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/templates/spawner/_workload.tpl b/library/common/1.0.0/templates/spawner/_workload.tpl index d4c716a265..16a3031082 100644 --- a/library/common/1.0.0/templates/spawner/_workload.tpl +++ b/library/common/1.0.0/templates/spawner/_workload.tpl @@ -23,7 +23,7 @@ {{/* Perform validations */}} {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}} - {{- include "ix.v1.common.lib.workload.basicValidation" (dict "objectData" $objectData) -}} + {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Workload") -}} {{/* Set the name of the workload */}} {{- $_ := set $objectData "name" $objectName -}} diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index 8ca52c8d15..5a1f15a4a3 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -31,6 +31,9 @@ fallbackDefaults: pvcAccessModes: - ReadWriteOnce +# -- Timezone used everywhere applicable +TIMEZONE: UTC + # -- Injected from SCALE middleware # Only for reference here ixExternalInterfacesConfiguration: [] @@ -54,8 +57,6 @@ image: # -- Image pull policy pullPolicy: IfNotPresent -# TODO: Docs -TIMEZONE: UTC # TODO: Docs # -- Security Context @@ -300,11 +301,13 @@ scaleGPU: # -- SCALE Certificate -scaleCert: +scaleCertificate: # -- Certificate name cert-name: # -- Enables the certificate enabled: false + labels: {} + annotations: {} # -- Certificate ID (Comes from SCALE) id: 1 # -- Default Paths that will be used on all defined containers