nishita-09 commented on code in PR #1000:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1000#discussion_r3757660680
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/JobStatusObserver.java:
##########
@@ -111,6 +112,38 @@ public boolean observe(FlinkResourceContext<R> ctx) {
return false;
}
+ private void fetchAndCacheRuntimeConfig(
+ FlinkResourceContext<R> ctx, JobStatusMessage clusterJobStatus) {
+ // Skip only globally-terminal states (FINISHED/CANCELED/FAILED) where
the JM REST API is
+ // gone; non-terminal transitional states (INITIALIZING, RESTARTING,
RECONCILING, etc.)
+ // still expose reachable config endpoints and any REST failure is
caught below.
+ if (clusterJobStatus.getJobState().isGloballyTerminalState()) {
+ return;
+ }
+
+ if (ctx.getRuntimeConfig().isPresent()) {
+ LOG.debug("Runtime configuration already cached");
+ return;
+ }
+
+ LOG.debug("Fetching runtime configuration");
+ var jobStatus = ctx.getResource().getStatus().getJobStatus();
+ try {
+ var runtimeConfig =
+ ctx.getFlinkService()
+ .getRuntimeConfiguration(
+ ctx.getObserveConfig(),
+ JobID.fromHexString(jobStatus.getJobId()));
+ ctx.putRuntimeConfig(runtimeConfig);
+ var currentObserveConfig = ctx.getObserveConfig();
+ if (currentObserveConfig != null) {
+ runtimeConfig.forEach(currentObserveConfig::setString);
+ }
Review Comment:
Thanks @gyfora This makes sense.
`FlinkResourceContext.putRuntimeConfig` now nulls the memoized
observeConfig so the next getObserveConfig() rebuilds it and picks up the
runtime overrides through the existing composition path in getObserveConfig().
This replaces the manual re-apply loop in
`JobStatusObserver.fetchAndCacheRuntimeConfig`, which is removed
--
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]