Copilot commented on code in PR #6983:
URL: https://github.com/apache/hive/pull/6983#discussion_r4671253477
##########
packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/HiveOperatorMain.java:
##########
@@ -47,11 +54,33 @@ public static void main(String[] args) {
ControllerConfiguration<HiveCluster> baseConfig =
operator.getConfigurationService().getConfigurationFor(reconciler);
- // Watch only our own namespace: cluster-wide, a HiveCluster elsewhere
using a field this
+ // By Default watch only our own namespace: cluster-wide, a HiveCluster
elsewhere using a field this
// build does not know fails to deserialise in the informer, which stops
the process.
- baseConfig = ControllerConfigurationOverrider.override(baseConfig)
- .watchingOnlyCurrentNamespace().build();
- LOG.info("Watching only this operator's own namespace");
+ // Watching other namespaces is configurable via
HIVE_OPERATOR_WATCH_NAMESPACES: a comma-separated
+ // list of namespaces, or "*" for all namespaces.
+ String watchNamespaces = System.getenv(WATCH_NAMESPACES_ENV_KEY);
+ String watchNsValue = watchNamespaces == null ? "" :
watchNamespaces.trim();
Review Comment:
This adds the only code path that reads `HIVE_OPERATOR_WATCH_NAMESPACES`,
but the documented raw-manifest deployment (`config/operator/deployment.yaml`,
used by the README's “Deploy via Operator Only” flow) does not project this
variable into the container. Exporting it before `envsubst` therefore has no
effect, so non-Helm users cannot configure cross-namespace watching; wire the
variable into that deployment as well and document how to set it.
##########
packaging/src/kubernetes/helm/hive-operator/templates/deployment.yaml:
##########
@@ -37,5 +37,10 @@ spec:
- name: operator
image: "{{ .Values.operator.image.repository }}:{{
.Values.operator.image.tag }}"
imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
+ {{- with .Values.operator.watchNamespaces }}
+ env:
+ - name: HIVE_OPERATOR_WATCH_NAMESPACES
+ value: {{ join "," . | quote }}
+ {{- end }}
Review Comment:
The `{{-` trim markers remove the newline before `with` and before `end`.
When `watchNamespaces` is non-empty, the rendered manifest therefore
concatenates `env:` onto `imagePullPolicy` and `resources:` onto the last env
value, producing invalid YAML (for example, `imagePullPolicy:
IfNotPresentenv:`). Use non-trimming actions here so the conditional block
remains on separate YAML lines.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]