@@ -203,7 +203,7 @@ func createPlan(ctx context.Context, log zerolog.Logger, apiObject k8sutil.APIOb
203203
204204 // Update status
205205 if plan .IsEmpty () {
206- plan = pb .Apply ( createEncryptionKeyStatusUpdate )
206+ plan = pb .ApplySubPlan ( createEncryptionKeyStatusPropagatedFieldUpdate , createEncryptionKeyStatusUpdate )
207207 }
208208
209209 if plan .IsEmpty () {
@@ -226,19 +226,19 @@ func createPlan(ctx context.Context, log zerolog.Logger, apiObject k8sutil.APIOb
226226
227227 // Add keys
228228 if plan .IsEmpty () {
229- plan = pb .Apply ( createEncryptionKey )
229+ plan = pb .ApplySubPlan ( createEncryptionKeyStatusPropagatedFieldUpdate , createEncryptionKey )
230230 }
231231
232232 if plan .IsEmpty () {
233233 plan = pb .Apply (createJWTKeyUpdate )
234234 }
235235
236236 if plan .IsEmpty () {
237- plan = pb .Apply ( createCARenewalPlan )
237+ plan = pb .ApplySubPlan ( createTLSStatusPropagatedFieldUpdate , createCARenewalPlan )
238238 }
239239
240240 if plan .IsEmpty () {
241- plan = pb .Apply ( createCAAppendPlan )
241+ plan = pb .ApplySubPlan ( createTLSStatusPropagatedFieldUpdate , createCAAppendPlan )
242242 }
243243
244244 if plan .IsEmpty () {
@@ -251,25 +251,31 @@ func createPlan(ctx context.Context, log zerolog.Logger, apiObject k8sutil.APIOb
251251 }
252252
253253 if plan .IsEmpty () {
254- plan = pb .Apply ( createRotateTLSServerSNIPlan )
254+ plan = pb .ApplySubPlan ( createTLSStatusPropagatedFieldUpdate , createRotateTLSServerSNIPlan )
255255 }
256256
257257 if plan .IsEmpty () {
258258 plan = pb .Apply (createRestorePlan )
259259 }
260260
261261 if plan .IsEmpty () {
262- plan = pb .Apply ( createEncryptionKeyCleanPlan )
262+ plan = pb .ApplySubPlan ( createEncryptionKeyStatusPropagatedFieldUpdate , createEncryptionKeyCleanPlan )
263263 }
264264
265265 if plan .IsEmpty () {
266- plan = pb .Apply ( createCACleanPlan )
266+ plan = pb .ApplySubPlan ( createTLSStatusPropagatedFieldUpdate , createCACleanPlan )
267267 }
268268
269269 if plan .IsEmpty () {
270270 plan = pb .Apply (createClusterOperationPlan )
271271 }
272272
273+ // Final
274+
275+ if plan .IsEmpty () {
276+ plan = pb .Apply (createTLSStatusPropagated )
277+ }
278+
273279 // Return plan
274280 return plan , true
275281}
@@ -296,6 +302,11 @@ type planBuilder func(ctx context.Context,
296302 spec api.DeploymentSpec , status api.DeploymentStatus ,
297303 cachedStatus inspector.Inspector , context PlanBuilderContext ) api.Plan
298304
305+ type planBuilderSubPlan func (ctx context.Context ,
306+ log zerolog.Logger , apiObject k8sutil.APIObject ,
307+ spec api.DeploymentSpec , status api.DeploymentStatus ,
308+ cachedStatus inspector.Inspector , context PlanBuilderContext , w WithPlanBuilder , plans ... planBuilder ) api.Plan
309+
299310func NewWithPlanBuilder (ctx context.Context ,
300311 log zerolog.Logger , apiObject k8sutil.APIObject ,
301312 spec api.DeploymentSpec , status api.DeploymentStatus ,
@@ -313,6 +324,7 @@ func NewWithPlanBuilder(ctx context.Context,
313324
314325type WithPlanBuilder interface {
315326 Apply (p planBuilder ) api.Plan
327+ ApplySubPlan (p planBuilderSubPlan , plans ... planBuilder ) api.Plan
316328}
317329
318330type withPlanBuilder struct {
@@ -325,6 +337,10 @@ type withPlanBuilder struct {
325337 context PlanBuilderContext
326338}
327339
340+ func (w withPlanBuilder ) ApplySubPlan (p planBuilderSubPlan , plans ... planBuilder ) api.Plan {
341+ return p (w .ctx , w .log , w .apiObject , w .spec , w .status , w .cachedStatus , w .context , w , plans ... )
342+ }
343+
328344func (w withPlanBuilder ) Apply (p planBuilder ) api.Plan {
329345 return p (w .ctx , w .log , w .apiObject , w .spec , w .status , w .cachedStatus , w .context )
330346}
0 commit comments