ixChartContext -> defaults

This commit is contained in:
Stavros kois
2022-12-01 21:22:53 +02:00
parent a438d493fc
commit 50d9f0fe5b
7 changed files with 18 additions and 18 deletions

View File

@@ -22,7 +22,7 @@ tests:
mountPath: /somepath
asserts:
- failedTemplate:
errorMessage: A storageClassName must be defined in global.ixChartContext.storageClassName
errorMessage: A storageClassName must be defined in global.defaults.storageClassName
- it: should fail with invalid accessMode
set:
@@ -568,7 +568,7 @@ tests:
documentIndex: *pvcDoc
set:
global:
ixChartContext:
defaults:
defaultPVCRetain: true
persistence:
vol1:
@@ -589,7 +589,7 @@ tests:
documentIndex: *pvcDoc
set:
global:
ixChartContext:
defaults:
defaultPVCRetain: true
persistence:
vol1:
@@ -610,7 +610,7 @@ tests:
documentIndex: *pvcDoc
set:
global:
ixChartContext:
defaults:
defaultPVCRetain: false
persistence:
vol1:

View File

@@ -3,9 +3,9 @@
{{- define "ix.v1.common.class.pvc" -}}
{{- $pvcValues := .pvc -}}
{{- $root := .root -}}
{{- $defaultSize := $root.Values.global.ixChartContext.defaultPVCSize -}}
{{- $defaultAccessMode := $root.Values.global.ixChartContext.defaultAccessMode -}}
{{- $defaultRetain := $root.Values.global.ixChartContext.defaultPVCRetain -}}
{{- $defaultSize := $root.Values.global.defaults.defaultPVCSize -}}
{{- $defaultAccessMode := $root.Values.global.defaults.defaultAccessMode -}}
{{- $defaultRetain := $root.Values.global.defaults.defaultPVCRetain -}}
{{- $pvcName := include "ix.v1.common.names.fullname" $root -}}

View File

@@ -3,7 +3,7 @@
{{- define "ix.v1.common.class.service" -}}
{{- $svcValues := .svc -}}
{{- $root := .root -}}
{{- $defaultServiceType := $root.Values.global.ixChartContext.defaultServiceType -}}
{{- $defaultServiceType := $root.Values.global.defaults.defaultServiceType -}}
{{- $svcName := include "ix.v1.common.names.fullname" $root -}}
{{- if and (hasKey $svcValues "nameOverride") $svcValues.nameOverride -}}

View File

@@ -7,7 +7,7 @@ you can specify a size for memory backed volumes.
{{/* Volumes included by the controller. */}}
{{- define "ix.v1.common.controller.volumes" -}}
{{- $root := . -}}
{{- $persistenceDefault := .Values.global.ixChartContext.defaultPersistenceType -}}
{{- $persistenceDefault := .Values.global.defaults.defaultPersistenceType -}}
{{- range $index, $persistence := .Values.persistence -}}
{{- if $persistence.enabled -}}
{{- if not $persistence.type -}} {{/* If persistence type is not defined, fallback to $persistenceDefault */}}

View File

@@ -6,9 +6,9 @@
{{/*
If a storage class is defined on a persistence object:
"-" returns "", which means requesting a PV without class
SCALE-ZFS returns the value set on Values.global.ixChartContext.storageClassName
SCALE-ZFS returns the value set on Values.global.defaults.storageClassName
else return the defined storageClass
Else if there is a storageClass defined in Values.global.ixChartContext.storageClassName, return this
Else if there is a storageClass defined in Values.global.defaults.storageClassName, return this
In any other case, return nothing
*/}}
@@ -17,14 +17,14 @@
{{- if eq "-" $className -}}
{{- print "\"\"" -}}
{{- else if eq "SCALE-ZFS" $className -}}
{{- if not $root.Values.global.ixChartContext.storageClassName -}}
{{- fail "A storageClassName must be defined in global.ixChartContext.storageClassName" -}}
{{- if not $root.Values.global.defaults.storageClassName -}}
{{- fail "A storageClassName must be defined in global.defaults.storageClassName" -}}
{{- end -}}
{{- print $root.Values.global.ixChartContext.storageClassName -}}
{{- print $root.Values.global.defaults.storageClassName -}}
{{- else -}}
{{- print $className -}}
{{- end -}}
{{- else if $root.Values.global.ixChartContext.storageClassName -}}
{{- print $root.Values.global.ixChartContext.storageClassName -}}
{{- else if $root.Values.global.defaults.storageClassName -}}
{{- print $root.Values.global.defaults.storageClassName -}}
{{- end -}}
{{- end -}}

View File

@@ -1,6 +1,6 @@
{{/* Renders the PVC objects */}}
{{- define "ix.v1.common.spawner.pvc" -}}
{{- $defaultType := .Values.global.ixChartContext.defaultPersistenceType -}}
{{- $defaultType := .Values.global.defaults.defaultPersistenceType -}}
{{- range $name, $pvc := .Values.persistence -}}
{{- if and $pvc.enabled (eq (default $defaultType $pvc.type) "pvc") (not ($pvc.existingClaim)) -}}
{{- $pvcValues := $pvc -}}

View File

@@ -69,7 +69,7 @@ stdin: false
# Everything bellow needs documentation
global:
ixChartContext:
defaults:
# If no serviceType is defined, assume this
defaultServiceType: ClusterIP
# If no PVC Size is defined, assume this