Skip to content

Commit c25f0bd

Browse files
fix an issue where shoots would be migrated to flow during cp-migration (#930)
1 parent 694c7a3 commit c25f0bd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/webhook/infrastructure/flow.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
extensionswebhook "github.com/gardener/gardener/extensions/pkg/webhook"
1313
extensionscontextwebhook "github.com/gardener/gardener/extensions/pkg/webhook/context"
1414
"github.com/gardener/gardener/pkg/apis/core/v1beta1"
15+
v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
1516
"github.com/gardener/gardener/pkg/apis/core/v1beta1/helper"
1617
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
1718
"github.com/go-logr/logr"
@@ -94,6 +95,13 @@ func (m *flowMutator) Mutate(ctx context.Context, new, old client.Object) error
9495
}
9596

9697
func (m *flowMutator) isInMigrationOrRestorePhase(infra *extensionsv1alpha1.Infrastructure) bool {
98+
// During the restore phase, the infrastructure object is created without status or state (including the operation type information).
99+
// Instead, the object is annotated to indicate that the status and state information will be patched in a subsequent operation.
100+
// Therefore, while the GardenerOperationWaitForState annotation exists, do nothing.
101+
if infra.GetAnnotations()[v1beta1constants.GardenerOperation] == v1beta1constants.GardenerOperationWaitForState {
102+
return true
103+
}
104+
97105
operationType := helper.ComputeOperationType(infra.ObjectMeta, infra.Status.LastOperation)
98106

99107
return operationType == v1beta1.LastOperationTypeMigrate || operationType == v1beta1.LastOperationTypeRestore

0 commit comments

Comments
 (0)