From e48423b07c4d717dda469eead9b233a2b40e4298 Mon Sep 17 00:00:00 2001 From: Dawid Rusnak Date: Wed, 5 Feb 2025 10:34:23 +0100 Subject: [PATCH] feat: add option to install CRDs without the operator (#989) --- charts/testkube-operator/templates/configmap.yaml | 3 ++- charts/testkube-operator/templates/deployment.yaml | 2 ++ charts/testkube-operator/templates/role.yaml | 4 ++-- charts/testkube-operator/templates/rolebinding.yaml | 4 ++-- charts/testkube-operator/templates/service.yaml | 2 ++ charts/testkube-operator/templates/serviceaccount.yaml | 4 ++-- charts/testkube-operator/templates/tests/test-connection.yaml | 2 +- charts/testkube-operator/templates/webhook-cert-create.yaml | 2 +- charts/testkube-operator/templates/webhook-cert-patch.yaml | 2 +- charts/testkube-operator/templates/webhook.yaml | 2 +- charts/testkube-operator/values.yaml | 3 +++ 11 files changed, 19 insertions(+), 11 deletions(-) diff --git a/charts/testkube-operator/templates/configmap.yaml b/charts/testkube-operator/templates/configmap.yaml index 370c7fc88..cb8fcd39d 100644 --- a/charts/testkube-operator/templates/configmap.yaml +++ b/charts/testkube-operator/templates/configmap.yaml @@ -1,4 +1,4 @@ - +{{- if .Values.enabled }} --- apiVersion: v1 data: @@ -18,3 +18,4 @@ kind: ConfigMap metadata: name: testkube-operator-manager-config namespace: {{ include "testkube-operator.namespace" . }} +{{- end }} diff --git a/charts/testkube-operator/templates/deployment.yaml b/charts/testkube-operator/templates/deployment.yaml index 5d856ab67..3d6a7c351 100644 --- a/charts/testkube-operator/templates/deployment.yaml +++ b/charts/testkube-operator/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled }} apiVersion: {{ include "global.capabilities.deployment.apiVersion" . }} kind: Deployment metadata: @@ -143,3 +144,4 @@ spec: nodeSelector: {{- toYaml .Values.global.nodeSelector | nindent 8 }} {{- end }} +{{- end }} diff --git a/charts/testkube-operator/templates/role.yaml b/charts/testkube-operator/templates/role.yaml index f1a822a65..b578df3fd 100644 --- a/charts/testkube-operator/templates/role.yaml +++ b/charts/testkube-operator/templates/role.yaml @@ -1,4 +1,4 @@ -{{ if .Values.rbac.create }} +{{ if and .Values.enabled .Values.rbac.create }} --- apiVersion: {{ include "global.capabilities.rbac.apiVersion" . }} @@ -493,7 +493,7 @@ rules: - watch - deletecollection -{{- if and .Values.webhook.enabled .Values.webhook.patch.enabled }} +{{- if and .Values.enabled (and .Values.webhook.enabled .Values.webhook.patch.enabled) }} --- apiVersion: {{ include "global.capabilities.rbac.apiVersion" . }} kind: ClusterRole diff --git a/charts/testkube-operator/templates/rolebinding.yaml b/charts/testkube-operator/templates/rolebinding.yaml index b760f4026..0a4080480 100644 --- a/charts/testkube-operator/templates/rolebinding.yaml +++ b/charts/testkube-operator/templates/rolebinding.yaml @@ -1,4 +1,4 @@ -{{ if .Values.rbac.create }} +{{ if and .Values.enabled .Values.rbac.create }} --- apiVersion: {{ include "global.capabilities.rbac.apiVersion" . }} @@ -114,7 +114,7 @@ subjects: name: {{ include "testkube-operator.serviceAccountName" . }} namespace: {{ include "testkube-operator.namespace" . }} -{{- if and .Values.webhook.enabled .Values.webhook.patch.enabled }} +{{- if and .Values.enabled (and .Values.webhook.enabled .Values.webhook.patch.enabled) }} --- apiVersion: {{ include "global.capabilities.rbac.apiVersion" . }} kind: ClusterRoleBinding diff --git a/charts/testkube-operator/templates/service.yaml b/charts/testkube-operator/templates/service.yaml index de6545141..ec7e3ae1b 100644 --- a/charts/testkube-operator/templates/service.yaml +++ b/charts/testkube-operator/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled }} apiVersion: v1 kind: Service metadata: @@ -43,3 +44,4 @@ spec: targetPort: 9443 selector: control-plane: controller-manager +{{- end }} diff --git a/charts/testkube-operator/templates/serviceaccount.yaml b/charts/testkube-operator/templates/serviceaccount.yaml index f10f7f39a..0685e3475 100644 --- a/charts/testkube-operator/templates/serviceaccount.yaml +++ b/charts/testkube-operator/templates/serviceaccount.yaml @@ -1,4 +1,4 @@ -{{- if .Values.serviceAccount.create -}} +{{- if and .Values.enabled .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount metadata: @@ -18,7 +18,7 @@ metadata: {{- end }} {{- end }} -{{- if and .Values.webhook.enabled .Values.webhook.patch.enabled }} +{{- if and .Values.enabled (and .Values.webhook.enabled .Values.webhook.patch.enabled) }} --- apiVersion: v1 kind: ServiceAccount diff --git a/charts/testkube-operator/templates/tests/test-connection.yaml b/charts/testkube-operator/templates/tests/test-connection.yaml index 2bd7a4003..6720f3c54 100644 --- a/charts/testkube-operator/templates/tests/test-connection.yaml +++ b/charts/testkube-operator/templates/tests/test-connection.yaml @@ -1,4 +1,4 @@ -{{- if .Values.testConnection.enabled }} +{{- if and .Values.enabled .Values.testConnection.enabled }} apiVersion: v1 kind: Pod metadata: diff --git a/charts/testkube-operator/templates/webhook-cert-create.yaml b/charts/testkube-operator/templates/webhook-cert-create.yaml index 524938a16..0b05562de 100644 --- a/charts/testkube-operator/templates/webhook-cert-create.yaml +++ b/charts/testkube-operator/templates/webhook-cert-create.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.webhook.enabled .Values.webhook.patch.enabled }} +{{- if and .Values.enabled (and .Values.webhook.enabled .Values.webhook.patch.enabled) }} apiVersion: batch/v1 kind: Job metadata: diff --git a/charts/testkube-operator/templates/webhook-cert-patch.yaml b/charts/testkube-operator/templates/webhook-cert-patch.yaml index 7e3c32807..bed039c4e 100644 --- a/charts/testkube-operator/templates/webhook-cert-patch.yaml +++ b/charts/testkube-operator/templates/webhook-cert-patch.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.webhook.enabled .Values.webhook.patch.enabled }} +{{- if and .Values.enabled (and .Values.webhook.enabled .Values.webhook.patch.enabled) }} apiVersion: batch/v1 kind: Job metadata: diff --git a/charts/testkube-operator/templates/webhook.yaml b/charts/testkube-operator/templates/webhook.yaml index 01a3cba9c..3a6627785 100644 --- a/charts/testkube-operator/templates/webhook.yaml +++ b/charts/testkube-operator/templates/webhook.yaml @@ -1,4 +1,4 @@ -{{- if .Values.webhook.enabled }} +{{- if and .Values.enabled .Values.webhook.enabled }} apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: diff --git a/charts/testkube-operator/values.yaml b/charts/testkube-operator/values.yaml index 4a1f0763f..466998f86 100644 --- a/charts/testkube-operator/values.yaml +++ b/charts/testkube-operator/values.yaml @@ -25,6 +25,9 @@ global: ## Kubernetes version (using Helm capabilities if not set) kubeVersion: "" +## Should install the Operator +enabled: true + ## Should we install CRDS - when they can be installed from other Testkube instance installCRD: true