gyfora commented on code in PR #721: URL: https://github.com/apache/flink-kubernetes-operator/pull/721#discussion_r1412161793
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java: ########## @@ -180,13 +190,28 @@ public void reconcile(FlinkResourceContext<CR> ctx) throws Exception { } } - private void applyAutoscaler(FlinkResourceContext<CR> ctx) throws Exception { + private void applyAutoscaler(FlinkResourceContext<CR> ctx, @Nullable String existingOverrides) + throws Exception { var autoScalerCtx = ctx.getJobAutoScalerContext(); boolean autoscalerEnabled = ctx.getResource().getSpec().getJob() != null && ctx.getObserveConfig().getBoolean(AUTOSCALER_ENABLED); autoScalerCtx.getConfiguration().set(AUTOSCALER_ENABLED, autoscalerEnabled); + autoscaler.scale(autoScalerCtx); + + // Check that the overrides actually changed and not merely the String representation + var flinkConfig = ctx.getResource().getSpec().getFlinkConfiguration(); + var newOverrides = flinkConfig.get(PipelineOptions.PARALLELISM_OVERRIDES.key()); Review Comment: It’s not safe to access configs by key directly . We can use the ctx getDeployConfig and getObserveConfig to get the configs and then we can even avoid passing the extra parameter to the method ########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java: ########## @@ -180,13 +190,28 @@ public void reconcile(FlinkResourceContext<CR> ctx) throws Exception { } } - private void applyAutoscaler(FlinkResourceContext<CR> ctx) throws Exception { + private void applyAutoscaler(FlinkResourceContext<CR> ctx, @Nullable String existingOverrides) + throws Exception { var autoScalerCtx = ctx.getJobAutoScalerContext(); boolean autoscalerEnabled = ctx.getResource().getSpec().getJob() != null && ctx.getObserveConfig().getBoolean(AUTOSCALER_ENABLED); autoScalerCtx.getConfiguration().set(AUTOSCALER_ENABLED, autoscalerEnabled); + autoscaler.scale(autoScalerCtx); + + // Check that the overrides actually changed and not merely the String representation + var flinkConfig = ctx.getResource().getSpec().getFlinkConfiguration(); + var newOverrides = flinkConfig.get(PipelineOptions.PARALLELISM_OVERRIDES.key()); Review Comment: It’s not safe to access configs by key directly . We can use the ctx getDeployConfig and getObserveConfig to get the configs and then we can even avoid passing the extra parameter to the method -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org