gyfora commented on code in PR #1000:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1000#discussion_r3757245054
##########
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:
this doesn't seem right here, seem like the putRuntimeConfig should also
update the observeConfig or null it out simply.
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java:
##########
@@ -363,7 +363,12 @@ private boolean scale(FlinkResourceContext<CR> ctx,
Configuration deployConfig)
var scaled = ctx.getFlinkService().scale(ctx, deployConfig);
if (scaled) {
- ReconciliationUtils.updateStatusForDeployedSpec(ctx.getResource(),
deployConfig, clock);
Review Comment:
Shouldn't the deploy method also invalidate the runtimeConfig?
--
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]