Skip to content

Commit 2db8de5

Browse files
Merge pull request #614 from vshn/fix/init-maint
Fix race condition in initial-maintenance job creation
2 parents d1e6a2e + 0ca7838 commit 2db8de5

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)