5353import java .util .Map ;
5454import java .util .Optional ;
5555
56- import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .ABORT_GRACE_PERIOD_MS ;
57- import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .DEPLOYMENT_DELETION_DELAY_MS ;
56+ import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .ABORT_GRACE_PERIOD ;
57+ import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .DEPLOYMENT_DELETION_DELAY ;
5858import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .MIN_ABORT_GRACE_PERIOD_MS ;
59- import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .RECONCILIATION_RESCHEDULING_INTERVAL_MS ;
59+ import static org .apache .flink .kubernetes .operator .api .spec .FlinkBlueGreenDeploymentConfigOptions .RECONCILIATION_RESCHEDULING_INTERVAL ;
6060import static org .apache .flink .kubernetes .operator .controller .FlinkBlueGreenDeploymentUtils .getConfigOption ;
6161import static org .apache .flink .kubernetes .operator .controller .FlinkBlueGreenDeploymentUtils .instantStrToMillis ;
6262import static org .apache .flink .kubernetes .operator .controller .FlinkBlueGreenDeploymentUtils .millisToInstantStr ;
@@ -94,20 +94,6 @@ public List<EventSource<?, FlinkBlueGreenDeployment>> prepareEventSources(
9494 return eventSources ;
9595 }
9696
97- // @Override
98- // public Map<String, EventSource> prepareEventSources(
99- // EventSourceContext<FlinkBlueGreenDeployment> eventSourceContext) {
100- // InformerConfiguration<FlinkDeployment> flinkDeploymentInformerConfig =
101- // InformerConfiguration.from(FlinkDeployment.class, eventSourceContext)
102- // .withSecondaryToPrimaryMapper(Mappers.fromOwnerReference())
103- // .withNamespacesInheritedFromController(eventSourceContext)
104- // .followNamespaceChanges(true)
105- // .build();
106- //
107- // return EventSourceInitializer.nameEventSources(
108- // new InformerEventSource<>(flinkDeploymentInformerConfig, eventSourceContext));
109- // }
110-
11197 @ Override
11298 public UpdateControl <FlinkBlueGreenDeployment > reconcile (
11399 FlinkBlueGreenDeployment bgDeployment , Context <FlinkBlueGreenDeployment > josdkContext )
@@ -186,7 +172,7 @@ private UpdateControl<FlinkBlueGreenDeployment> checkFirstDeployment(
186172 private static void setAbortTimestamp (
187173 FlinkBlueGreenDeployment bgDeployment ,
188174 FlinkBlueGreenDeploymentStatus deploymentStatus ) {
189- Integer abortGracePeriod = getConfigOption (bgDeployment , ABORT_GRACE_PERIOD_MS );
175+ Long abortGracePeriod = getConfigOption (bgDeployment , ABORT_GRACE_PERIOD ). toMillis ( );
190176 abortGracePeriod = Math .max (abortGracePeriod , minimumAbortGracePeriodMs );
191177 deploymentStatus .setAbortTimestamp (
192178 millisToInstantStr (System .currentTimeMillis () + abortGracePeriod ));
@@ -252,19 +238,17 @@ private UpdateControl<FlinkBlueGreenDeployment> canDelete(
252238 Context <FlinkBlueGreenDeployment > josdkContext ,
253239 FlinkDeployment currentDeployment ,
254240 FlinkBlueGreenDeploymentState nextState ) {
255- int deploymentDeletionDelayMs =
256- Math .max (getConfigOption (bgDeployment , DEPLOYMENT_DELETION_DELAY_MS ), 0 );
241+ long deploymentDeletionDelayMs =
242+ Math .max (getConfigOption (bgDeployment , DEPLOYMENT_DELETION_DELAY ). toMillis ( ), 0 );
257243
258244 long deploymentReadyTimestamp =
259245 instantStrToMillis (deploymentStatus .getDeploymentReadyTimestamp ());
260246
261247 if (deploymentReadyTimestamp == 0 ) {
262248 LOG .info (
263- "Deployment marked ready on "
264- + System .currentTimeMillis ()
265- + ", rescheduling reconciliation in "
266- + deploymentDeletionDelayMs
267- + " ms." );
249+ "Deployment marked ready on {}, rescheduling reconciliation in {} ms." ,
250+ System .currentTimeMillis (),
251+ deploymentDeletionDelayMs );
268252 deploymentStatus .setDeploymentReadyTimestamp (Instant .now ().toString ());
269253 return patchStatusUpdateControl (bgDeployment , deploymentStatus , null , null )
270254 .rescheduleAfter (deploymentDeletionDelayMs );
@@ -277,7 +261,7 @@ private UpdateControl<FlinkBlueGreenDeployment> canDelete(
277261 bgDeployment , deploymentStatus , josdkContext , currentDeployment , nextState );
278262 } else {
279263 long delay = deletionTs - System .currentTimeMillis ();
280- LOG .info ("Rescheduling reconciliation (to delete) in " + delay + " ms." );
264+ LOG .info ("Rescheduling reconciliation (to delete) in {} ms." , delay );
281265 return UpdateControl .<FlinkBlueGreenDeployment >noUpdate ().rescheduleAfter (delay );
282266 }
283267 }
@@ -320,10 +304,9 @@ private UpdateControl<FlinkBlueGreenDeployment> shouldAbort(
320304 deploymentStatus .setBlueGreenState (previousState );
321305
322306 LOG .warn (
323- "Aborting deployment '"
324- + deploymentName
325- + "', rolling B/G deployment back to "
326- + previousState );
307+ "Aborting deployment '{}', rolling B/G deployment back to {}" ,
308+ deploymentName ,
309+ previousState );
327310
328311 // If the current running FlinkDeployment is not in RUNNING/STABLE,
329312 // we flag this Blue/Green as FAILING
@@ -332,12 +315,7 @@ private UpdateControl<FlinkBlueGreenDeployment> shouldAbort(
332315 } else {
333316 // RETRY
334317 var delay = abortTimestamp - System .currentTimeMillis ();
335- LOG .info (
336- "Deployment '"
337- + deploymentName
338- + "' not ready yet, retrying in "
339- + delay
340- + " ms" );
318+ LOG .info ("Deployment '{}' not ready yet, retrying in {} ms" , deploymentName , delay );
341319 return patchStatusUpdateControl (bgDeployment , deploymentStatus , null , null )
342320 .rescheduleAfter (delay );
343321 }
@@ -355,11 +333,9 @@ private UpdateControl<FlinkBlueGreenDeployment> deleteAndFinalize(
355333 return UpdateControl .<FlinkBlueGreenDeployment >noUpdate ().rescheduleAfter (500 );
356334 } else {
357335 LOG .info (
358- "Finalizing deployment '"
359- + bgDeployment .getMetadata ().getName ()
360- + "' to "
361- + nextState
362- + " state" );
336+ "Finalizing deployment '{}' to {} state" ,
337+ bgDeployment .getMetadata ().getName (),
338+ nextState );
363339 deploymentStatus .setDeploymentReadyTimestamp (millisToInstantStr (0 ));
364340 deploymentStatus .setAbortTimestamp (millisToInstantStr (0 ));
365341 return patchStatusUpdateControl (
@@ -469,8 +445,11 @@ private UpdateControl<FlinkBlueGreenDeployment> initiateDeployment(
469445
470446 setAbortTimestamp (bgDeployment , deploymentStatus );
471447
472- var reconciliationReschedInterval =
473- Math .max (getConfigOption (bgDeployment , RECONCILIATION_RESCHEDULING_INTERVAL_MS ), 0 );
448+ long reconciliationReschedInterval =
449+ Math .max (
450+ getConfigOption (bgDeployment , RECONCILIATION_RESCHEDULING_INTERVAL )
451+ .toMillis (),
452+ 0 );
474453
475454 return patchStatusUpdateControl (
476455 bgDeployment , deploymentStatus , nextState , JobStatus .RECONCILING )
0 commit comments