From 01a05d1e697a35fcaedd8107575a8b483185a517 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Wed, 9 Jul 2025 11:21:47 +0200 Subject: [PATCH 1/3] feat: Add KUBERNETES_NODE_NAME env var to operator Pods --- .../deploy/helm/[[operator]]/templates/deployment.yaml.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 index 2626c3f2..cb76ba53 100644 --- a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 +++ b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 @@ -48,6 +48,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['internal.stackable.tech/image'] + - name: KUBERNETES_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName {{- if .Values.kubernetesClusterDomain }} - name: KUBERNETES_CLUSTER_DOMAIN value: {{ .Values.kubernetesClusterDomain | quote }} From 52047c181d2b2db7b35180dbc445f93e8561f2d7 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Wed, 9 Jul 2025 12:14:40 +0200 Subject: [PATCH 2/3] docs: Mention clap arguments --- .../deploy/helm/[[operator]]/templates/deployment.yaml.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 index cb76ba53..5659c502 100644 --- a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 +++ b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 @@ -43,6 +43,11 @@ spec: - mountPath: /etc/stackable/{{ include "operator.appname" . }}/config-spec name: config-spec env: + # The following env vars are passed as clap (think CLI) arguments to the operator. + # They are picked up by clap using the structs defied in + # https://github.com/stackabletech/operator-rs/blob/main/crates/stackable-operator/src/cli.rs + # (currently "ProductOperatorRun"). + # You can read there about the expected values and purposes. - name: OPERATOR_IMAGE # Tilt can use annotations as image paths, but not env variables valueFrom: From e6771ad933c5b3499042e5a12f31f16c573a01e3 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Wed, 9 Jul 2025 12:50:53 +0200 Subject: [PATCH 3/3] Update docs --- .../helm/[[operator]]/templates/deployment.yaml.j2 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 index 5659c502..4ff5c593 100644 --- a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 +++ b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 @@ -44,19 +44,25 @@ spec: name: config-spec env: # The following env vars are passed as clap (think CLI) arguments to the operator. - # They are picked up by clap using the structs defied in - # https://github.com/stackabletech/operator-rs/blob/main/crates/stackable-operator/src/cli.rs - # (currently "ProductOperatorRun"). + # They are picked up by clap using the structs defied in the operator. + # (which is turn pulls in https://github.com/stackabletech/operator-rs/blob/main/crates/stackable-operator/src/cli.rs) # You can read there about the expected values and purposes. + + # Sometimes products need to know the operator image, e.g. the opa-bundle-builder OPA + # sidecar uses the operator image. - name: OPERATOR_IMAGE # Tilt can use annotations as image paths, but not env variables valueFrom: fieldRef: fieldPath: metadata.annotations['internal.stackable.tech/image'] + + # Operators need to know the node name they are running on, to e.g. discover the + # Kubernetes domain name from the kubelet API. - name: KUBERNETES_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName + {{- if .Values.kubernetesClusterDomain }} - name: KUBERNETES_CLUSTER_DOMAIN value: {{ .Values.kubernetesClusterDomain | quote }}