Skip to content

Commit 606fbc4

Browse files
committed
fix: ignore MachineSets which reference non-existing clusters
The code was assuming that cluster always exists, and was crashing the controller. Signed-off-by: Artem Chernyshev <[email protected]>
1 parent 7cdd62a commit 606fbc4

File tree

1 file changed

+4
-0
lines changed
  • internal/backend/runtime/omni/controllers/omni/internal/machineset

1 file changed

+4
-0
lines changed

internal/backend/runtime/omni/controllers/omni/internal/machineset/machineset.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ func toSlice[T resource.Resource](list safe.List[T]) []T {
3838

3939
// ReconcileMachines creates, updates and tears down the machines using the ReconciliationContext.
4040
func ReconcileMachines(ctx context.Context, r controller.ReaderWriter, logger *zap.Logger, rc *ReconciliationContext) (bool, error) {
41+
if rc.cluster == nil {
42+
return false, xerrors.NewTaggedf[qtransform.SkipReconcileTag]("machine set cluster does not exist")
43+
}
44+
4145
_, locked := rc.cluster.Metadata().Annotations().Get(omni.ClusterLocked)
4246
_, importIsInProgress := rc.cluster.Metadata().Annotations().Get(omni.ClusterImportIsInProgress)
4347

0 commit comments

Comments
 (0)