Repository navigation
HIVE-30210: Introduce configurable namespace scoping for K8s operator - #6983
tanishq-chugh wants to merge 6 commits into
Conversation
|
Hi @ayushtkn |
There was a problem hiding this comment.
🟡 Changes recommended
Approval is blocked by a critical Helm template rendering error that produces invalid YAML and a moderate deployment configuration gap that prevents documented raw-manifest users from configuring cross-namespace watching.
2 open issues
What changed in this PR
Adds configurable namespace scoping for the Hive Kubernetes operator, allowing it to watch the release namespace, selected namespaces, or all namespaces through Helm configuration and environment variables.
Changes:
- Added namespace configuration parsing and operator watch-scope setup.
- Added the
operator.watchNamespacesHelm value and deployment wiring. - Documented the supported namespace configuration formats.
| File | Description |
|---|---|
| packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/HiveOperatorMain.java | Parses namespace configuration and applies the corresponding operator watch scope. |
| packaging/src/kubernetes/README.md | Documents the new Helm namespace configuration option. |
| packaging/src/kubernetes/helm/hive-operator/values.yaml | Defines the default and supported operator.watchNamespaces formats. |
| packaging/src/kubernetes/helm/hive-operator/templates/deployment.yaml | Passes the configured namespace list to the operator through an environment variable. |
Review effort: Lite
| {{- with .Values.operator.watchNamespaces }} | ||
| env: | ||
| - name: HIVE_OPERATOR_WATCH_NAMESPACES | ||
| value: {{ join "," . | quote }} | ||
| {{- end }} |
There was a problem hiding this comment.
This is invalid. This would have occurred in case - trimming had been used even with the ending delimiter {{.
With the current patch, it is rendered correctly:
tanishqchugh@D7JR63VVY6 hive % helm template test packaging/src/kubernetes/helm/hive-operator \
--set 'operator.watchNamespaces={ns1,ns2}' \
-s templates/deployment.yaml
---
# Source: hive-operator/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-hive-operator
namespace: default
labels:
app.kubernetes.io/name: hive-kubernetes-operator
app.kubernetes.io/instance: test
app.kubernetes.io/version: "4.3.0-SNAPSHOT"
app.kubernetes.io/managed-by: Helm
helm.sh/chart: hive-operator-4.3.0-SNAPSHOT
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: hive-kubernetes-operator
app.kubernetes.io/instance: test
template:
metadata:
labels:
app.kubernetes.io/name: hive-kubernetes-operator
app.kubernetes.io/instance: test
spec:
serviceAccountName: test-hive-operator
containers:
- name: operator
image: "apache/hive:operator-4.3.0-SNAPSHOT"
imagePullPolicy: IfNotPresent
env:
- name: HIVE_OPERATOR_WATCH_NAMESPACES
value: "ns1,ns2"
resources:
limits:
memory: 512Mi
requests:
cpu: 200m
memory: 256Mi
tanishqchugh@D7JR63VVY6 hive %
| String watchNamespaces = System.getenv(WATCH_NAMESPACES_ENV_KEY); | ||
| String watchNsValue = watchNamespaces == null ? "" : watchNamespaces.trim(); |
|





What changes were proposed in this pull request?
Introduces a configuration to allow specifying the K8s namespaces to be monitored by the Hive K8s operator
Why are the changes needed?
To enable the Hive K8s Operator to manage Hive clusters across different namespaces, rather than only namespace where operator is deployed.
Does this PR introduce any user-facing change?
Yes, the end-user can now configure the namespaces which the K8s hive operator will watch for HiveCluster resources.
How was this patch tested?
Manual Testing