diff --git a/.github/ct-install-config/ct-lint.yaml b/.github/ct-install-config/ct-lint.yaml index a6a2e88c..67c6b681 100644 --- a/.github/ct-install-config/ct-lint.yaml +++ b/.github/ct-install-config/ct-lint.yaml @@ -1,6 +1,6 @@ remote: origin target-branch: master -helm-extra-args: --debug +helm-extra-args: --debug --set crd.verify.enabled=false chart-yaml-schema: .github/ct-install-config/chart_schema.yaml chart-dirs: - library diff --git a/.github/workflows/common_library_tests.yaml b/.github/workflows/common_library_tests.yaml index 6462a747..d485e938 100644 --- a/.github/workflows/common_library_tests.yaml +++ b/.github/workflows/common_library_tests.yaml @@ -92,7 +92,7 @@ jobs: # Run tests cd library/common-test/ helm dependency update - helm unittest -f "tests/**/*.yaml" . + helm unittest -f "tests/**/*.yaml" . --set crd.verify.enabled=false install: needs: diff --git a/library/common/templates/class/cert-manager/_certificate.tpl b/library/common/templates/class/cert-manager/_certificate.tpl index a2c81fa7..10ae8486 100644 --- a/library/common/templates/class/cert-manager/_certificate.tpl +++ b/library/common/templates/class/cert-manager/_certificate.tpl @@ -14,7 +14,7 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "ertificates.cert-manager.io" "missing" "Cert-Manager") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "ertificates.cert-manager.io" "missing" "Cert-Manager") }} --- apiVersion: cert-manager.io/v1 diff --git a/library/common/templates/class/cnpg/_backup.tpl b/library/common/templates/class/cnpg/_backup.tpl index 4d06ee1f..2c1b8200 100644 --- a/library/common/templates/class/cnpg/_backup.tpl +++ b/library/common/templates/class/cnpg/_backup.tpl @@ -18,7 +18,7 @@ {{- $backupAnnotations := $objectData.backupAnnotations | default dict -}} {{- $backupAnnotations = mustMerge $backupAnnotations $objAnnotations $globalBackupAnnotations }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "backups.postgresql.cnpg.io" "missing" "CloudNative-PG") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "backups.postgresql.cnpg.io" "missing" "CloudNative-PG") }} --- apiVersion: postgresql.cnpg.io/v1 diff --git a/library/common/templates/class/cnpg/_cluster.tpl b/library/common/templates/class/cnpg/_cluster.tpl index 0d845724..ac1bc214 100644 --- a/library/common/templates/class/cnpg/_cluster.tpl +++ b/library/common/templates/class/cnpg/_cluster.tpl @@ -123,7 +123,7 @@ {{- $walSize = . -}} {{- end }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "clusters.postgresql.cnpg.io" "missing" "CloudNative-PG") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "clusters.postgresql.cnpg.io" "missing" "CloudNative-PG") }} --- apiVersion: postgresql.cnpg.io/v1 diff --git a/library/common/templates/class/cnpg/_pooler.tpl b/library/common/templates/class/cnpg/_pooler.tpl index 78bc8f48..4291d1b6 100644 --- a/library/common/templates/class/cnpg/_pooler.tpl +++ b/library/common/templates/class/cnpg/_pooler.tpl @@ -22,7 +22,7 @@ {{- $instances = 0 -}} {{- end }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "poolers.postgresql.cnpg.io" "missing" "CloudNative-PG") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "poolers.postgresql.cnpg.io" "missing" "CloudNative-PG") }} --- apiVersion: postgresql.cnpg.io/v1 diff --git a/library/common/templates/class/cnpg/_scheduledBackup.tpl b/library/common/templates/class/cnpg/_scheduledBackup.tpl index acbac8ce..af107439 100644 --- a/library/common/templates/class/cnpg/_scheduledBackup.tpl +++ b/library/common/templates/class/cnpg/_scheduledBackup.tpl @@ -31,7 +31,7 @@ {{- $immediate = $objectData.schedData.immediate -}} {{- end }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "scheduledbackups.postgresql.cnpg.io" "missing" "CloudNative-PG") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "scheduledbackups.postgresql.cnpg.io" "missing" "CloudNative-PG") }} --- apiVersion: postgresql.cnpg.io/v1 diff --git a/library/common/templates/class/velero/_backupStorageLocation.tpl b/library/common/templates/class/velero/_backupStorageLocation.tpl index 9bd601d8..2841411b 100644 --- a/library/common/templates/class/velero/_backupStorageLocation.tpl +++ b/library/common/templates/class/velero/_backupStorageLocation.tpl @@ -15,7 +15,7 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "backupstoragelocations.velero.io" "missing" "Velero") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "backupstoragelocations.velero.io" "missing" "Velero") }} --- apiVersion: velero.io/v1 diff --git a/library/common/templates/class/velero/_schedule.tpl b/library/common/templates/class/velero/_schedule.tpl index 6706be9c..f6cfac86 100644 --- a/library/common/templates/class/velero/_schedule.tpl +++ b/library/common/templates/class/velero/_schedule.tpl @@ -26,7 +26,7 @@ objectData: {{- $namespace = ($lookupBSL.items | first).metadata.namespace -}} {{- end }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "schedules.velero.io" "missing" "Velero") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "schedules.velero.io" "missing" "Velero") }} --- apiVersion: velero.io/v1 diff --git a/library/common/templates/class/velero/_volumeSnapshotLocation.tpl b/library/common/templates/class/velero/_volumeSnapshotLocation.tpl index 71c81171..6b416f9a 100644 --- a/library/common/templates/class/velero/_volumeSnapshotLocation.tpl +++ b/library/common/templates/class/velero/_volumeSnapshotLocation.tpl @@ -15,7 +15,7 @@ objectData: {{- $rootCtx := .rootCtx -}} {{- $objectData := .objectData }} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "volumesnapshotlocations.velero.io" "missing" "Velero") }} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "volumesnapshotlocations.velero.io" "missing" "Velero") }} --- apiVersion: velero.io/v1 diff --git a/library/common/templates/lib/ingress/integrations/_traefik.tpl b/library/common/templates/lib/ingress/integrations/_traefik.tpl index aa9926d9..27ca3d3a 100644 --- a/library/common/templates/lib/ingress/integrations/_traefik.tpl +++ b/library/common/templates/lib/ingress/integrations/_traefik.tpl @@ -54,7 +54,7 @@ {{- fail (printf "Ingress - Combined traefik entrypoints contain duplicates [%s]" (join ", " $entrypoints)) -}} {{- end -}} - {{- include "tc.v1.common.lib.util.verifycrd" (dict "crd" "middlewares.traefik.io" "missing" "Traefik") -}} + {{- include "tc.v1.common.lib.util.verifycrd" (dict "rootCtx" $rootCtx "crd" "middlewares.traefik.io" "missing" "Traefik") -}} {{- $lookupMiddlewares := list -}} {{- $parsedMiddlewares := list -}} diff --git a/library/common/templates/lib/util/_verify_crd.tpl b/library/common/templates/lib/util/_verify_crd.tpl index f408b883..b230b1a7 100644 --- a/library/common/templates/lib/util/_verify_crd.tpl +++ b/library/common/templates/lib/util/_verify_crd.tpl @@ -1,12 +1,14 @@ {{- define "tc.v1.common.lib.util.verifycrd" -}} {{- $crd := .crd -}} {{- $missing := .missing | default (printf "Missing CRDs for %s" $crd) -}} + {{- $rootCtx := .rootCtx -}} - {{- $lookupMiddlewares := (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" $crd) -}} - - {{/* If there are items, re-assign the variable */}} - {{- if $lookupMiddlewares -}} - {{- else -}} - {{- fail (printf "%s have to be installed first" $missing) -}} + {{- if $rootCtx.crd.verify.enabled -}} + {{- $lookupMiddlewares := (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" $crd) -}} + {{/* If there are items, re-assign the variable */}} + {{- if $lookupMiddlewares -}} + {{- else -}} + {{- fail (printf "%s has to be installed first" $missing) -}} + {{- end -}} {{- end -}} {{- end -}} diff --git a/library/common/values.yaml b/library/common/values.yaml index 38027a52..48dbfadd 100644 --- a/library/common/values.yaml +++ b/library/common/values.yaml @@ -855,6 +855,10 @@ metrics: # # list to support adding rules via the SCALE GUI without overwrithing the rules # additionalrules: [] +crd: + verify: + enabled: true + # -- Contains specific settings for helm charts containing or using operators operator: # -- Adds a configmap to the operator to register this chart as an operator