Skip to content

Commit 1f65b0d

Browse files
committed
Fix race condition in initial-maintenance job creation
1 parent 01c5b67 commit 1f65b0d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/comp-functions/functions/common/maintenance/maintenance.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ func (m *Maintenance) Run(ctx context.Context) *xfnproto.Result {
160160
// Handle initial maintenance job
161161
// Keep the job in desired state until 30 minutes after completion
162162
if !m.resource.GetInitialMaintenanceRan() {
163+
if m.resource.GetName() == "" {
164+
log.Info("Composite resource not yet fully populated, deferring initial maintenance job")
165+
return runtime.NewNormalResult("Composite resource not yet fully populated, deferring initial maintenance job")
166+
}
167+
163168
// Job hasn't been created yet, create it
164169
if err := m.createInitialMaintenanceJob(ctx); err != nil {
165170
log.Error(err, "Failed to create initial maintenance job")

0 commit comments

Comments
 (0)