diff --git a/library/common-test/Chart.yaml b/library/common-test/Chart.yaml index 716846a2..68c4d98c 100644 --- a/library/common-test/Chart.yaml +++ b/library/common-test/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "" dependencies: - name: common repository: file://../common - version: ~19.1.0 + version: ~20.0.0 deprecated: false description: Helper chart to test different use cases of the common library home: https://github.com/truecharts/apps/tree/master/charts/library/common-test diff --git a/library/common-test/tests/cnpg/cluster_spec_test.yaml b/library/common-test/tests/cnpg/cluster_spec_test.yaml index bfb427f2..2ceae885 100644 --- a/library/common-test/tests/cnpg/cluster_spec_test.yaml +++ b/library/common-test/tests/cnpg/cluster_spec_test.yaml @@ -73,10 +73,9 @@ tests: global: fallbackDefaults: pgVersion: "15" - fallbackDefaults: - vctAccessModes: - - ReadWriteMany - - ReadWriteOnce + vctAccessModes: + - ReadWriteMany + - ReadWriteOnce cnpg: my-pg: enabled: true diff --git a/library/common-test/tests/persistence/pvc_data_test.yaml b/library/common-test/tests/persistence/pvc_data_test.yaml index 90afd330..41e96949 100644 --- a/library/common-test/tests/persistence/pvc_data_test.yaml +++ b/library/common-test/tests/persistence/pvc_data_test.yaml @@ -159,8 +159,9 @@ tests: - it: should create pvc with storageClass not set, but have fallbackDefaults set set: - fallbackDefaults: - storageClass: some-storage-class + global: + fallbackDefaults: + storageClass: some-storage-class persistence: my-volume1: enabled: true diff --git a/library/common-test/tests/pod/volume_pvc_test.yaml b/library/common-test/tests/pod/volume_pvc_test.yaml index d5ce455b..7684e3dc 100644 --- a/library/common-test/tests/pod/volume_pvc_test.yaml +++ b/library/common-test/tests/pod/volume_pvc_test.yaml @@ -57,9 +57,10 @@ tests: # Failures - it: should fail when DaemonSet and RWO volume from fallback set: - fallbackDefaults: - accessModes: - - ReadWriteOnce + global: + fallbackDefaults: + accessModes: + - ReadWriteOnce workload: workload-name1: enabled: true @@ -76,9 +77,10 @@ tests: - it: should fail when DaemonSet and RWO volume from persistence set: - fallbackDefaults: - accessModes: - - ReadWriteMany + global: + fallbackDefaults: + accessModes: + - ReadWriteMany workload: workload-name1: enabled: true diff --git a/library/common-test/tests/volumeClaimTemplate/vct_data_test.yaml b/library/common-test/tests/volumeClaimTemplate/vct_data_test.yaml index e9a60a39..4ca20ee8 100644 --- a/library/common-test/tests/volumeClaimTemplate/vct_data_test.yaml +++ b/library/common-test/tests/volumeClaimTemplate/vct_data_test.yaml @@ -69,10 +69,11 @@ tests: - it: should create vct with changed fallback accessModes set: - fallbackDefaults: - vctAccessModes: - - ReadWriteMany - - ReadWriteOnce + global: + fallbackDefaults: + vctAccessModes: + - ReadWriteMany + - ReadWriteOnce persistence: my-volume1: enabled: true @@ -220,8 +221,9 @@ tests: - it: should create vct with storageClass not set, but have fallbackDefaults set set: - fallbackDefaults: - storageClass: some-storage-class + global: + fallbackDefaults: + storageClass: some-storage-class persistence: my-volume1: enabled: true diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 478e71b0..08ccf8dc 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,7 +15,7 @@ maintainers: name: common sources: null type: library -version: 19.1.1 +version: 20.0.0 annotations: artifacthub.io/category: "integration-delivery" artifacthub.io/license: "BUSL-1.1" diff --git a/library/common/templates/class/_persistentVolume.tpl b/library/common/templates/class/_persistentVolume.tpl index 7b4de0d9..2305eb79 100644 --- a/library/common/templates/class/_persistentVolume.tpl +++ b/library/common/templates/class/_persistentVolume.tpl @@ -18,14 +18,14 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- $retain := $rootCtx.Values.fallbackDefaults.pvcRetain -}} + {{- $retain := $rootCtx.Values.global.fallbackDefaults.pvcRetain -}} {{- if not (kindIs "invalid" $objectData.retain) -}} {{- $retain = $objectData.retain -}} {{- end -}} {{- $reclaimPolicy := ternary "Retain" "Delete" $retain -}} - {{- $pvcSize := $rootCtx.Values.fallbackDefaults.pvcSize -}} + {{- $pvcSize := $rootCtx.Values.global.fallbackDefaults.pvcSize -}} {{- with $objectData.size -}} {{- $pvcSize = tpl . $rootCtx -}} {{- end }} diff --git a/library/common/templates/class/_pvc.tpl b/library/common/templates/class/_pvc.tpl index 22d40f94..d161125b 100644 --- a/library/common/templates/class/_pvc.tpl +++ b/library/common/templates/class/_pvc.tpl @@ -18,12 +18,12 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- $pvcRetain := $rootCtx.Values.fallbackDefaults.pvcRetain -}} + {{- $pvcRetain := $rootCtx.Values.global.fallbackDefaults.pvcRetain -}} {{- if (kindIs "bool" $objectData.retain) -}} {{- $pvcRetain = $objectData.retain -}} {{- end -}} - {{- $pvcSize := $rootCtx.Values.fallbackDefaults.pvcSize -}} + {{- $pvcSize := $rootCtx.Values.global.fallbackDefaults.pvcSize -}} {{- with $objectData.size -}} {{- $pvcSize = tpl . $rootCtx -}} {{- end }} diff --git a/library/common/templates/class/_service.tpl b/library/common/templates/class/_service.tpl index d1068478..91ec6477 100644 --- a/library/common/templates/class/_service.tpl +++ b/library/common/templates/class/_service.tpl @@ -11,7 +11,7 @@ objectData: The service data, that will be used to render the Service object. {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} - {{- $svcType := $objectData.type | default $rootCtx.Values.fallbackDefaults.serviceType -}} + {{- $svcType := $objectData.type | default $rootCtx.Values.global.fallbackDefaults.serviceType -}} {{/* Init variables */}} {{- $hasHTTPSPort := false -}} diff --git a/library/common/templates/class/cnpg/_cluster.tpl b/library/common/templates/class/cnpg/_cluster.tpl index 7d0a58bf..7af567ad 100644 --- a/library/common/templates/class/cnpg/_cluster.tpl +++ b/library/common/templates/class/cnpg/_cluster.tpl @@ -17,13 +17,13 @@ {{- $inProgress := false -}} {{- $reusePVC := true -}} {{- $preloadLibraries := list -}} - {{- $walSize := $rootCtx.Values.fallbackDefaults.vctSize -}} - {{- $size := $rootCtx.Values.fallbackDefaults.vctSize -}} + {{- $walSize := $rootCtx.Values.global.fallbackDefaults.vctSize -}} + {{- $size := $rootCtx.Values.global.fallbackDefaults.vctSize -}} {{- $primaryUpdateStrategy := "unsupervised" -}} {{- $primaryUpdateMethod := "switchover" -}} {{- $logLevel := "info" -}} - {{- $accessModes := $rootCtx.Values.fallbackDefaults.vctAccessModes -}} - {{- $walAccessModes := $rootCtx.Values.fallbackDefaults.vctAccessModes -}} + {{- $accessModes := $rootCtx.Values.global.fallbackDefaults.vctAccessModes -}} + {{- $walAccessModes := $rootCtx.Values.global.fallbackDefaults.vctAccessModes -}} {{/* Make sure keys exist before try to access any sub keys */}} {{- if not (hasKey $objectData "cluster") -}} diff --git a/library/common/templates/lib/container/_ports.tpl b/library/common/templates/lib/container/_ports.tpl index e243d8f5..451b8e2d 100644 --- a/library/common/templates/lib/container/_ports.tpl +++ b/library/common/templates/lib/container/_ports.tpl @@ -61,7 +61,7 @@ objectData: The object data to be used to render the container. {{- end -}} {{- $tcpProtocols := (list "tcp" "http" "https") -}} - {{- $protocol := tpl ($portValues.protocol | default $rootCtx.Values.fallbackDefaults.serviceProtocol) $rootCtx -}} + {{- $protocol := tpl ($portValues.protocol | default $rootCtx.Values.global.fallbackDefaults.serviceProtocol) $rootCtx -}} {{- if mustHas $protocol $tcpProtocols -}} {{- $protocol = "tcp" -}} {{- end }} diff --git a/library/common/templates/lib/container/_probes.tpl b/library/common/templates/lib/container/_probes.tpl index fc6ee339..a76d9ba7 100644 --- a/library/common/templates/lib/container/_probes.tpl +++ b/library/common/templates/lib/container/_probes.tpl @@ -34,7 +34,7 @@ objectData: The object data to be used to render the container. {{- if $isEnabled -}} - {{- $probeType := $rootCtx.Values.fallbackDefaults.probeType -}} + {{- $probeType := $rootCtx.Values.global.fallbackDefaults.probeType -}} {{- with $probe.type -}} {{- $probeType = tpl . $rootCtx -}} @@ -71,7 +71,7 @@ objectData: The object data to be used to render the container. {{- $objectData := .objectData -}} {{- $probeName := .probeName -}} - {{- $timeouts := mustDeepCopy (get $rootCtx.Values.fallbackDefaults.probeTimeouts $probeName) -}} + {{- $timeouts := mustDeepCopy (get $rootCtx.Values.global.fallbackDefaults.probeTimeouts $probeName) -}} {{- if $objectData.spec -}} {{/* Overwrite with defined timeouts */}} {{- $timeouts = mustMergeOverwrite $timeouts $objectData.spec -}} diff --git a/library/common/templates/lib/endpoint/_ports.tpl b/library/common/templates/lib/endpoint/_ports.tpl index f0f9b937..de9761f3 100644 --- a/library/common/templates/lib/endpoint/_ports.tpl +++ b/library/common/templates/lib/endpoint/_ports.tpl @@ -12,7 +12,7 @@ objectData: The object data of the service {{- $tcpProtocols := (list "tcp" "http" "https") -}} {{- range $name, $portValues := $objectData.ports -}} {{- if $portValues.enabled -}} - {{- $protocol := $rootCtx.Values.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} + {{- $protocol := $rootCtx.Values.global.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} {{- $port := $portValues.targetPort | default $portValues.port -}} {{/* Expand targetPort */}} diff --git a/library/common/templates/lib/endpointSlice/_ports.tpl b/library/common/templates/lib/endpointSlice/_ports.tpl index a323fb8f..726b96d1 100644 --- a/library/common/templates/lib/endpointSlice/_ports.tpl +++ b/library/common/templates/lib/endpointSlice/_ports.tpl @@ -12,7 +12,7 @@ objectData: The object data of the service {{- $tcpProtocols := (list "tcp" "http" "https") -}} {{- range $name, $portValues := $objectData.ports -}} {{- if $portValues.enabled -}} - {{- $protocol := $rootCtx.Values.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} + {{- $protocol := $rootCtx.Values.global.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} {{- $port := $portValues.targetPort | default $portValues.port -}} {{/* Expand targetPort */}} diff --git a/library/common/templates/lib/pod/_volumes.tpl b/library/common/templates/lib/pod/_volumes.tpl index 9e372421..db9b40e7 100644 --- a/library/common/templates/lib/pod/_volumes.tpl +++ b/library/common/templates/lib/pod/_volumes.tpl @@ -49,7 +49,7 @@ objectData: The object data to be used to render the Pod. {{/* If pod selected */}} {{- if $selected -}} {{/* Define the volume based on type */}} - {{- $type := ($persistence.type | default $rootCtx.Values.fallbackDefaults.persistenceType) -}} + {{- $type := ($persistence.type | default $rootCtx.Values.global.fallbackDefaults.persistenceType) -}} {{- include "tc.v1.common.lib.pod.volumes.checkRWO" (dict "rootCtx" $rootCtx "objectData" $objectData "persistence" $persistence diff --git a/library/common/templates/lib/service/_ports.tpl b/library/common/templates/lib/service/_ports.tpl index 76ade34b..521a7fc4 100644 --- a/library/common/templates/lib/service/_ports.tpl +++ b/library/common/templates/lib/service/_ports.tpl @@ -12,7 +12,7 @@ objectData: The object data of the service {{- $tcpProtocols := (list "tcp" "http" "https") -}} {{- range $name, $portValues := $objectData.ports -}} {{- if $portValues.enabled -}} - {{- $protocol := $rootCtx.Values.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} + {{- $protocol := $rootCtx.Values.global.fallbackDefaults.serviceProtocol -}} {{/* Default to fallback protocol, if no protocol is defined */}} {{- $port := $portValues.port -}} {{- $targetPort := $portValues.targetPort -}} {{- $nodePort := $portValues.nodePort -}} diff --git a/library/common/templates/lib/storage/_accessModes.tpl b/library/common/templates/lib/storage/_accessModes.tpl index 0b5ac69f..eb4be8b2 100644 --- a/library/common/templates/lib/storage/_accessModes.tpl +++ b/library/common/templates/lib/storage/_accessModes.tpl @@ -17,7 +17,7 @@ objectData: The object data of the pvc {{- end -}} {{- if not $accessModes -}} - {{- $accessModes = $rootCtx.Values.fallbackDefaults.accessModes -}} + {{- $accessModes = $rootCtx.Values.global.fallbackDefaults.accessModes -}} {{- end -}} {{- $validAccessModes := (list "ReadWriteOnce" "ReadOnlyMany" "ReadWriteMany" "ReadWriteOncePod") -}} diff --git a/library/common/templates/lib/storage/_storageClassName.tpl b/library/common/templates/lib/storage/_storageClassName.tpl index 68e96463..6a50dd52 100644 --- a/library/common/templates/lib/storage/_storageClassName.tpl +++ b/library/common/templates/lib/storage/_storageClassName.tpl @@ -17,7 +17,7 @@ objectData: The object data of the pvc Else if we are in an ixChartContext, always return the storageClassName defined on the ixChartContext - Else if there is a storageClass defined in Values.fallbackDefaults.storageClass, return this + Else if there is a storageClass defined in Values.global.fallbackDefaults.storageClass, return this In any other case, return nothing */}} @@ -43,9 +43,9 @@ objectData: The object data of the pvc {{- end -}} {{- $className = tpl $rootCtx.Values.global.ixChartContext.storageClassName $rootCtx -}} - {{- else if $rootCtx.Values.fallbackDefaults.storageClass -}} + {{- else if $rootCtx.Values.global.fallbackDefaults.storageClass -}} - {{- $className = tpl $rootCtx.Values.fallbackDefaults.storageClass $rootCtx -}} + {{- $className = tpl $rootCtx.Values.global.fallbackDefaults.storageClass $rootCtx -}} {{- end -}} diff --git a/library/common/templates/lib/storage/_volumeClaimTemplates.tpl b/library/common/templates/lib/storage/_volumeClaimTemplates.tpl index 5de62ad5..52fe6e4c 100644 --- a/library/common/templates/lib/storage/_volumeClaimTemplates.tpl +++ b/library/common/templates/lib/storage/_volumeClaimTemplates.tpl @@ -39,13 +39,13 @@ objectData: The object data to be used to render the Pod. {{/* If pod selected */}} {{- if $selected -}} - {{- $vctSize := $rootCtx.Values.fallbackDefaults.vctSize -}} + {{- $vctSize := $rootCtx.Values.global.fallbackDefaults.vctSize -}} {{- with $vct.size -}} {{- $vctSize = tpl . $rootCtx -}} {{- end -}} {{- $_ := set $vct "size" $vctSize -}} - {{- $vctAccessModes := $rootCtx.Values.fallbackDefaults.vctAccessModes -}} + {{- $vctAccessModes := $rootCtx.Values.global.fallbackDefaults.vctAccessModes -}} {{- with $vct.accessModes -}} {{- $vctAccessModes = . -}} {{- end -}} diff --git a/library/common/templates/lib/storage/pvc/_name.tpl b/library/common/templates/lib/storage/pvc/_name.tpl index 44c39b80..97f3d74b 100644 --- a/library/common/templates/lib/storage/pvc/_name.tpl +++ b/library/common/templates/lib/storage/pvc/_name.tpl @@ -19,7 +19,7 @@ objectData: The object data to be used to render the Pod. {{- if $objectData.static -}} {{- if and $objectData.static.mode (mustHas $objectData.static.mode $modes) -}} - {{- $size := $objectData.size | default $rootCtx.Values.fallbackDefaults.pvcSize -}} + {{- $size := $objectData.size | default $rootCtx.Values.global.fallbackDefaults.pvcSize -}} {{/* Create a unique name taking into account server and share, without this, changing one of those values is not possible */}} diff --git a/library/common/templates/lib/storage/pvc/_spec.tpl b/library/common/templates/lib/storage/pvc/_spec.tpl index bd29103a..0a7ef991 100644 --- a/library/common/templates/lib/storage/pvc/_spec.tpl +++ b/library/common/templates/lib/storage/pvc/_spec.tpl @@ -8,7 +8,7 @@ objectData: The object data to be used to render the Pod. {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData -}} -{{- $size := $rootCtx.Values.fallbackDefaults.pvcSize -}} +{{- $size := $rootCtx.Values.global.fallbackDefaults.pvcSize -}} {{- with $objectData.size -}} {{- $size = tpl . $rootCtx -}} {{- end }} diff --git a/library/common/templates/lib/util/_autoperms.tpl b/library/common/templates/lib/util/_autoperms.tpl index 89b2b27a..417a12fe 100644 --- a/library/common/templates/lib/util/_autoperms.tpl +++ b/library/common/templates/lib/util/_autoperms.tpl @@ -14,7 +14,7 @@ {{/* If autoPermissions is enabled...*/}} {{- if $mount.autoPermissions.enabled -}} {{- if or $mount.autoPermissions.chown $mount.autoPermissions.chmod -}} - {{- $type := $.Values.fallbackDefaults.persistenceType -}} + {{- $type := $.Values.global.fallbackDefaults.persistenceType -}} {{- if $mount.type -}} {{- $type = $mount.type -}} {{- end -}} diff --git a/library/common/templates/spawner/_pvc.tpl b/library/common/templates/spawner/_pvc.tpl index b03d039f..3197e42d 100644 --- a/library/common/templates/spawner/_pvc.tpl +++ b/library/common/templates/spawner/_pvc.tpl @@ -17,7 +17,7 @@ {{/* Create a copy of the persistence */}} {{- $objectData := (mustDeepCopy $persistence) -}} - {{- $_ := set $objectData "type" ($objectData.type | default $.Values.fallbackDefaults.persistenceType) -}} + {{- $_ := set $objectData "type" ($objectData.type | default $.Values.global.fallbackDefaults.persistenceType) -}} {{- include "tc.v1.common.lib.util.metaListToDict" (dict "objectData" $objectData) -}} diff --git a/library/common/values.yaml b/library/common/values.yaml index 8af87be2..03152a9a 100644 --- a/library/common/values.yaml +++ b/library/common/values.yaml @@ -8,6 +8,49 @@ global: # TODO: Currently some objects do not support this namespace: "" fallbackDefaults: + # -- Define a storageClassName that will be used for all PVCs + # Can be overruled per PVC + storageClass: + # -- Default probe type + probeType: http + # -- Default Service Protocol + serviceProtocol: tcp + # -- Default Service Type + serviceType: ClusterIP + # -- Default persistence type + persistenceType: pvc + # -- Default Retain PVC + pvcRetain: false + # -- Default PVC Size + pvcSize: 100Gi + # -- Default VCT Size + vctSize: 100Gi + # -- Default PVC Access Modes + accessModes: + - ReadWriteOnce + # -- Default VCT Access Modes + vctAccessModes: + - ReadWriteOnce + # -- Default probe timeouts + probeTimeouts: + liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 1 + readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 5 + successThreshold: 2 + startup: + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 2 + failureThreshold: 60 + successThreshold: 1 # -- Define a postgresql version for CNPG # will be used for all CNPG objects # Can be overruled per CNPG objects @@ -40,51 +83,6 @@ global: # does not include stand-alone pods stopAll: false -fallbackDefaults: - # -- Define a storageClassName that will be used for all PVCs - # Can be overruled per PVC - storageClass: - # -- Default probe type - probeType: http - # -- Default Service Protocol - serviceProtocol: tcp - # -- Default Service Type - serviceType: ClusterIP - # -- Default persistence type - persistenceType: pvc - # -- Default Retain PVC - pvcRetain: false - # -- Default PVC Size - pvcSize: 100Gi - # -- Default VCT Size - vctSize: 100Gi - # -- Default PVC Access Modes - accessModes: - - ReadWriteOnce - # -- Default VCT Access Modes - vctAccessModes: - - ReadWriteOnce - # -- Default probe timeouts - probeTimeouts: - liveness: - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 - successThreshold: 1 - readiness: - initialDelaySeconds: 10 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 5 - successThreshold: 2 - startup: - initialDelaySeconds: 10 - periodSeconds: 5 - timeoutSeconds: 2 - failureThreshold: 60 - successThreshold: 1 - # -- Explicitly set a namespace for this chart only namespace: ""