From 67f0e63375bb25aff62ad8af3433aaa8f2af38a8 Mon Sep 17 00:00:00 2001 From: ypoplavs <45286051+ypoplavs@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:48:31 +0200 Subject: [PATCH] fix: labels in testkube-operator (#971) * fix: labels in testkube-operator; update NATS uri --- charts/testkube-api/templates/_helpers.tpl | 12 ++++++------ charts/testkube-api/values.yaml | 2 ++ charts/testkube-operator/templates/deployment.yaml | 11 ----------- charts/testkube-operator/templates/rolebinding.yaml | 8 ++++---- charts/testkube-operator/values.yaml | 9 --------- charts/testkube/README.md | 11 +++++++++++ 6 files changed, 23 insertions(+), 30 deletions(-) diff --git a/charts/testkube-api/templates/_helpers.tpl b/charts/testkube-api/templates/_helpers.tpl index 358bf8a70..164b5cd70 100644 --- a/charts/testkube-api/templates/_helpers.tpl +++ b/charts/testkube-api/templates/_helpers.tpl @@ -163,9 +163,10 @@ Define API environment in agent mode {{- end}} - name: "NATS_EMBEDDED" value: "{{ .Values.nats.embedded }}" -{{- if .Values.nats.enabled }} - name: NATS_URI - {{- if .Values.nats.secretName }} + {{- if .Values.nats.uri }} + value: {{ .Values.nats.uri }} + {{- else if .Values.nats.secretName }} valueFrom: secretKeyRef: name: {{ .Values.nats.secretName }} @@ -185,7 +186,6 @@ Define API environment in agent mode value: "{{ .Values.nats.tls.certSecret.baseMountPath }}/{{ .Values.nats.tls.certSecret.caFile }}" {{- end }} {{- end }} -{{- end }} - name: "SCRAPPERENABLED" value: "{{ .Values.storage.scrapperEnabled }}" - name: "COMPRESSARTIFACTS" @@ -265,9 +265,10 @@ Define API environment in standalone mode value: "{{ .Values.mongodb.allowDiskUse }}" - name: "NATS_EMBEDDED" value: "{{ .Values.nats.embedded }}" -{{- if .Values.nats.enabled }} - name: NATS_URI - {{- if .Values.nats.secretName }} + {{- if .Values.nats.uri }} + value: {{ .Values.nats.uri }} + {{- else if .Values.nats.secretName }} valueFrom: secretKeyRef: name: {{ .Values.nats.secretName }} @@ -287,7 +288,6 @@ Define API environment in standalone mode value: "{{ .Values.nats.tls.certSecret.baseMountPath }}/{{ .Values.nats.tls.certSecret.caFile }}" {{- end }} {{- end }} -{{- end }} - name: "STORAGE_ENDPOINT" {{- if .Values.storage.endpoint }} value: "{{ .Values.storage.endpoint }}" diff --git a/charts/testkube-api/values.yaml b/charts/testkube-api/values.yaml index d8a12e980..f3c97b309 100644 --- a/charts/testkube-api/values.yaml +++ b/charts/testkube-api/values.yaml @@ -532,6 +532,8 @@ nats: ## load URI from secrets # secretName: XXX # secretKey: XXX + ## load URI from plain-text + uri: "nats://testkube-nats:4222" ## MINIO parameters minio: diff --git a/charts/testkube-operator/templates/deployment.yaml b/charts/testkube-operator/templates/deployment.yaml index 18a287848..5d856ab67 100644 --- a/charts/testkube-operator/templates/deployment.yaml +++ b/charts/testkube-operator/templates/deployment.yaml @@ -86,17 +86,6 @@ spec: - name: APISERVER_REGISTRY value: {{ .Values.global.imageRegistry }} {{- end }} - {{- if .Values.nats.enabled }} - - name: NATS_URI - {{- if .Values.nats.secretName }} - valueFrom: - secretKeyRef: - name: {{ .Values.nats.secretName }} - key: {{ .Values.nats.secretKey }} - {{- else }} - value: "nats://{{ .Release.Name }}-nats" - {{- end }} - {{- end }} {{- if .Values.purgeExecutions }} - name: APISERVER_PURGE_EXECUTIONS value: "true" diff --git a/charts/testkube-operator/templates/rolebinding.yaml b/charts/testkube-operator/templates/rolebinding.yaml index 32c5d2b04..b760f4026 100644 --- a/charts/testkube-operator/templates/rolebinding.yaml +++ b/charts/testkube-operator/templates/rolebinding.yaml @@ -6,8 +6,8 @@ kind: ClusterRoleBinding metadata: name: {{ .Release.Name }}-operator-manager-rolebinding labels: - {{- if .Values.globalLabels }} - {{- include "global.tplvalues.render" ( dict "value" .Values.globalLabels "context" $ ) | nindent 4 }} + {{- if .Values.global.labels }} + {{- include "global.tplvalues.render" ( dict "value" .Values.global.labels "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.global.annotations }} annotations: {{- include "global.tplvalues.render" ( dict "value" .Values.global.annotations "context" $ ) | nindent 4 }} @@ -29,8 +29,8 @@ kind: ClusterRoleBinding metadata: name: {{ .Release.Name }}-operator-proxy-rolebinding labels: - {{- if .Values.globalLabels }} - {{- include "global.tplvalues.render" ( dict "value" .Values.globalLabels "context" $ ) | nindent 4 }} + {{- if .Values.global.labels }} + {{- include "global.tplvalues.render" ( dict "value" .Values.global.labels "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.global.annotations }} annotations: {{- include "global.tplvalues.render" ( dict "value" .Values.global.annotations "context" $ ) | nindent 4 }} diff --git a/charts/testkube-operator/values.yaml b/charts/testkube-operator/values.yaml index f24e10b8c..4a1f0763f 100644 --- a/charts/testkube-operator/values.yaml +++ b/charts/testkube-operator/values.yaml @@ -318,14 +318,5 @@ testConnection: ## Note: podAffinityPreset, podAntiAffinityPreset, and nodeAffinityPreset will be ignored when it's set affinity: {} -## NATS parameters -## ref: https://github.com/nats-io/nats-server -nats: - ## Deploy NATS server to the cluster - enabled: true - ## load URI from secrets - # secretName: XXX - # secretKey: XXX - ## Pass a custom cronJobTemplate to the Testkube Operator Deployment cronJobTemplate: "" diff --git a/charts/testkube/README.md b/charts/testkube/README.md index d2af72dd2..a9bac0fde 100644 --- a/charts/testkube/README.md +++ b/charts/testkube/README.md @@ -69,7 +69,18 @@ testkube-api: enabled: true skipVerify: true ``` +To use external NATS server, it's possible to configure: +```yaml +testkube-api: + nats: + enabled: false + uri: nats://some-nats-address:4222 + # or providing URI with Kubernetes secret: + # secretName: example-secret + # secretKey: example-key + +``` #### MinIO/S3 Currently, Testkube doesn't support provisioning MinIO with TLS. However, if you use an external MinIO (or any S3-compatible storage)