Dennis-Mircea opened a new pull request, #1121:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1121

   ## What is the purpose of the change
   
   `FlinkBlueGreenDeploymentController` had accumulated a handful of small but 
real issues:
   - The logger was instantiated against `FlinkDeploymentController.class` 
(wrong category for every log line emitted by the blue/green path).
   - The JavaDoc state machine and orchestration sections were collapsed into 
single paragraphs that did not render as lists.
   - The `InformerEventSource` for `FlinkDeployment` was built inline in 
`prepareEventSources` instead of being centralized in `EventSourceUtils` like 
every other controller
   - The `BlueGreenContext` was constructed inline in `reconcile` instead of 
going through `FlinkResourceContextFactory` like every other context type.
   - A `logAndThrow(String)` helper existed that did not log and just wrapped 
`throw new RuntimeException(message)` without adding anything.
   
   This PR fixes all of the above and also cleans up a few warnings in 
`FlinkResourceContextFactory`.
   
   ## Brief change log
   
     - Fixed the SLF4J logger category in `FlinkBlueGreenDeploymentController` 
(`FlinkDeploymentController.class` → 
`FlinkBlueGreenDeploymentController.class`).
     - Rewrote the controller-level JavaDoc to use proper `<h2>` headings and 
`<ol>` lists for the state machine and orchestration sections, with `{@link}` 
references to the relevant types.
     - Added 
`EventSourceUtils.getBlueGreenFlinkDeploymentInformerEventSource(...)` 
(parallels the existing `getBlueGreenIngressInformerEventSource`) and switched 
`prepareEventSources` to use it. The inline `InformerEventSourceConfiguration` 
/ `InformerEventSource` / `Mappers` code in the controller is gone.
     - Added `FlinkResourceContextFactory.getBlueGreenContext(...)` (parallels 
`getFlinkStateSnapshotContext`) and switched both branches of `reconcile` to 
use it instead of constructing `BlueGreenContext` inline.
     - Removed `FlinkBlueGreenDeploymentController.logAndThrow(String)`. 
Replaced its three call sites in 
`FlinkBlueGreenDeployments.fromSecondaryResources` with direct `throw new 
RuntimeException(...)` statements.
     - In `FlinkResourceContextFactory`: collapsed the `instanceof 
FlinkDeployment` / `instanceof FlinkSessionJob` checks into pattern-matching 
`instanceof`, converted the deployment-mode `switch` into a switch expression, 
removed the dead `jobId` / `flinkDepJobId` / `flinkSessionJobId` locals, 
tightened the `getResourceContext` generic to `Context<CR>`, and added 
`@SuppressWarnings("unchecked")` for the down-cast.
     - Pruned the now-unused imports from the controller (`FlinkDeployment`, 
`InformerEventSourceConfiguration`, `InformerEventSource`, `Mappers`).
   
   ## Verifying this change
   
   This change is already covered by existing tests, such as 
`FlinkBlueGreenDeploymentControllerTest`, `BlueGreenUtilsTest`, 
`BlueGreenIngressIT`, `FlinkDeploymentControllerTest`, 
`FlinkSessionJobControllerTest`, `FlinkStateSnapshotControllerTest`, 
`ApplicationReconcilerTest`, and `SessionJobReconcilerTest`.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changes to the `CustomResourceDescriptors`: 
no
     - Core observer or reconciler logic that is regularly executed: yes 
(control flow in `FlinkBlueGreenDeploymentController#reconcile` and 
`#prepareEventSources` was restructured. Behavior is unchanged, the call sites 
just go through `EventSourceUtils` and 
`FlinkResourceContextFactory.getBlueGreenContext` instead of inline 
construction.)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable


-- 
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]

Reply via email to