diff --git a/.github/workflows/common_library_tests.yaml b/.github/workflows/common_library_tests.yaml index db17f638..21b96450 100644 --- a/.github/workflows/common_library_tests.yaml +++ b/.github/workflows/common_library_tests.yaml @@ -23,7 +23,7 @@ jobs: matrix: helm-version: - v3.12.3 - - v3.13.3 + - v3.14.0 steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -56,13 +56,13 @@ jobs: name: Unit Tests runs-on: ubuntu-22.04 env: - helmUnitVersion: 0.3.0 + helmUnitVersion: 0.4.1 strategy: fail-fast: false matrix: helm-version: - v3.12.3 - - v3.13.3 + - v3.14.0 steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -110,7 +110,7 @@ jobs: # We run tests on Helm version of latest SCALE, fluxcd and latest helm release helm-version: - v3.12.3 - - v3.13.3 + - v3.14.0 values: - basic-values.yaml - configmap-values.yaml @@ -215,7 +215,8 @@ jobs: fi if [[ "${{ matrix.values }}" =~ ingress.*-values.yaml ]]; then helm install cert-manager oci://tccr.io/truecharts/cert-manager --namespace cert-manager --create-namespace --wait - helm install traefik oci://tccr.io/truecharts/traefik --namespace traefik --create-namespace --wait + helm install traefik oci://tccr.io/truecharts/traefik --namespace traefik --create-namespace --wait \ + --set service.main.type=ClusterIP --set service.tcp.type=ClusterIP fi - name: Run chart-testing (install) @@ -257,7 +258,7 @@ jobs: # # We run tests on Helm version of latest SCALE release # helm-version: # - v3.12.3 -# - v3.13.3 +# - v3.14.0 # values: # - basic-values.yaml # - configmap-values.yaml @@ -321,7 +322,7 @@ jobs: # # We run tests on Helm version of latest SCALE release # helm-version: # - v3.12.3 -# - v3.13.3 +# - v3.14.0 # values: # - ingress-values.yaml # - metrics-values.yaml @@ -342,7 +343,8 @@ jobs: # run: | # helm install prometheus-operator oci://tccr.io/truecharts/prometheus-operator --namespace prometheus-operator --create-namespace --wait # helm install cloudnative-pg oci://tccr.io/truecharts/cloudnative-pg --namespace cloudnative-pg --create-namespace --wait -# helm install traefik oci://tccr.io/truecharts/traefik --namespace traefik --create-namespace --wait +# helm install traefik oci://tccr.io/truecharts/traefik --namespace traefik --create-namespace --wait \ +# --set service.main.type=ClusterIP --set service.tcp.type=ClusterIP # # - name: Checkout # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -379,7 +381,7 @@ jobs: # # We run tests on Helm version of latest SCALE release # helm-version: # - v3.12.3 -# - v3.13.3 +# - v3.14.0 # values: # - vpn-gluetun-values.yaml # - vpn-tailscale-values.yaml diff --git a/library/common-test/Chart.yaml b/library/common-test/Chart.yaml index dd961968..97e52e85 100644 --- a/library/common-test/Chart.yaml +++ b/library/common-test/Chart.yaml @@ -13,7 +13,7 @@ keywords: - truecharts - common - test -kubeVersion: '>=1.16.0-0' +kubeVersion: '>=1.24.0-0' maintainers: - email: info@truecharts.org name: TrueCharts @@ -23,3 +23,5 @@ sources: - https://github.com/truecharts/apps/tree/master/charts/library/common-test type: application version: 1.0.0 +annotations: + truecharts.org/min_helm_version: "3.12" diff --git a/library/common-test/tests/container/resources_test.yaml b/library/common-test/tests/container/resources_test.yaml index faa506b9..583b1aef 100644 --- a/library/common-test/tests/container/resources_test.yaml +++ b/library/common-test/tests/container/resources_test.yaml @@ -424,7 +424,7 @@ tests: isAPIVersion: of: apps/v1 - documentIndex: *otherDeploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.runtimeClassName - documentIndex: *otherDeploymentDoc isSubset: @@ -488,7 +488,7 @@ tests: isAPIVersion: of: apps/v1 - documentIndex: *deploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.runtimeClassName - documentIndex: *deploymentDoc isSubset: @@ -620,7 +620,7 @@ tests: isAPIVersion: of: apps/v1 - documentIndex: *otherDeploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.runtimeClassName - documentIndex: *otherDeploymentDoc isSubset: diff --git a/library/common-test/tests/initContainer/data_test.yaml b/library/common-test/tests/initContainer/data_test.yaml index c8b489fe..87223e9b 100644 --- a/library/common-test/tests/initContainer/data_test.yaml +++ b/library/common-test/tests/initContainer/data_test.yaml @@ -229,7 +229,7 @@ tests: isAPIVersion: of: apps/v1 - documentIndex: *deploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.initContainers - it: should add NVIDIA_VISIBLE_DEVICES=void to init container without GPU diff --git a/library/common-test/tests/initContainer/data_upgrade_test.yaml b/library/common-test/tests/initContainer/data_upgrade_test.yaml index aafffc79..c7a837c1 100644 --- a/library/common-test/tests/initContainer/data_upgrade_test.yaml +++ b/library/common-test/tests/initContainer/data_upgrade_test.yaml @@ -230,7 +230,7 @@ tests: isAPIVersion: of: apps/v1 - documentIndex: *deploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.initContainers - it: should add NVIDIA_VISIBLE_DEVICES=void to init container without GPU diff --git a/library/common-test/tests/pod/runtime_class_name_test.yaml b/library/common-test/tests/pod/runtime_class_name_test.yaml index 58e79b8a..e1fda1d6 100644 --- a/library/common-test/tests/pod/runtime_class_name_test.yaml +++ b/library/common-test/tests/pod/runtime_class_name_test.yaml @@ -20,7 +20,7 @@ tests: isKind: of: Deployment - documentIndex: *deploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.runtimeClassName - it: should pass with runtimeClassName from "global" @@ -148,7 +148,7 @@ tests: podSpec: {} asserts: - documentIndex: *deploymentDoc - isNull: + isNullOrEmpty: path: spec.template.spec.runtimeClassName - it: should pass with runtimeClassName from ixChartContext without targetSelector (on primary workload) @@ -186,7 +186,7 @@ tests: isKind: of: CronJob - documentIndex: *cronJobDoc - isNull: + isNullOrEmpty: path: spec.jobTemplate.spec.template.spec.runtimeClassName - it: should pass with runtimeClassName not set from ixChartContext without gpu value diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index e6431e53..b9a35702 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -7,7 +7,7 @@ keywords: - truecharts - library-chart - common -kubeVersion: '>=1.16.0-0' +kubeVersion: '>=1.24.0-0' maintainers: - email: info@truecharts.org name: TrueCharts diff --git a/library/common/templates/lib/chart/_check_capabitilies.tpl b/library/common/templates/lib/chart/_check_capabitilies.tpl new file mode 100644 index 00000000..e4f5170f --- /dev/null +++ b/library/common/templates/lib/chart/_check_capabitilies.tpl @@ -0,0 +1,20 @@ +{{- define "tc.v1.common.check.capabilities" -}} + {{- $helmVersion := .Capabilities.HelmVersion.Version -}} + {{- $helmVerCond := ">3.9.4" -}} + + {{- if .Chart.Annotations -}} + {{- $min := index .Chart.Annotations "truecharts.org/min_helm_version" -}} + {{- if $min -}} + {{/* Apply a relaxed version check */}} + {{- $helmVerCond = printf ">=%s" $min -}} + {{- end -}} + {{- end -}} + + {{- if not (semverCompare $helmVerCond $helmVersion) -}} + {{- if .Values.global.ixChartContext -}} + {{- fail (printf "Expected helm version [%s], but found [%s]. Upgrade TrueNAS SCALE OS" $helmVerCond $helmVersion) -}} + {{- else -}} + {{- fail (printf "Expected helm version [%s], but found [%s]. Upgrade helm cli tool." $helmVerCond $helmVersion) -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/library/common/templates/lib/cnpg/scheduledBackup/_validation.tpl b/library/common/templates/lib/cnpg/scheduledBackup/_validation.tpl index 17e477a5..8138b86a 100644 --- a/library/common/templates/lib/cnpg/scheduledBackup/_validation.tpl +++ b/library/common/templates/lib/cnpg/scheduledBackup/_validation.tpl @@ -12,7 +12,7 @@ {{- if (hasKey $objectData.schedData "backupOwnerReference") -}} {{- $validOwnerRefs := (list "none" "self" "cluster") -}} {{- if not (mustHas $objectData.schedData.backupOwnerReference $validOwnerRefs) -}} - {{- fail (printf "CNPG Scheduled Backup - Expected [backupOwnerReference] in [backups.scheduledBackups] entry to be one of [%s], but got [%s] " (join ", " $validOwnerRefs) $objectData.schedData.backupOwnerReference) -}} + {{- fail (printf "CNPG Scheduled Backup - Expected [backupOwnerReference] in [backups.scheduledBackups] entry to be one of [%s], but got [%s]" (join ", " $validOwnerRefs) $objectData.schedData.backupOwnerReference) -}} {{- end -}} {{- end -}} diff --git a/library/common/templates/loader/_init.tpl b/library/common/templates/loader/_init.tpl index aff423a4..5f9f72ac 100644 --- a/library/common/templates/loader/_init.tpl +++ b/library/common/templates/loader/_init.tpl @@ -1,6 +1,8 @@ {{/* Initialiaze values of the chart */}} {{- define "tc.v1.common.loader.init" -}} + {{- include "tc.v1.common.check.capabilities" . -}} + {{/* Merge chart values and the common chart defaults */}} {{- include "tc.v1.common.values.init" . -}}