From 8e50d3b3afc3f150f04242f0136906c90520b557 Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Tue, 25 Nov 2025 16:55:22 -0800 Subject: [PATCH 1/2] rename updaterun state Signed-off-by: Ryan Zhang --- apis/placement/v1beta1/stageupdate_types.go | 32 ++++++------- ...etes-fleet.io_clusterstagedupdateruns.yaml | 48 +++++++++---------- ....kubernetes-fleet.io_stagedupdateruns.yaml | 48 +++++++++---------- 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/apis/placement/v1beta1/stageupdate_types.go b/apis/placement/v1beta1/stageupdate_types.go index 9491f3ec6..2974f4c5f 100644 --- a/apis/placement/v1beta1/stageupdate_types.go +++ b/apis/placement/v1beta1/stageupdate_types.go @@ -154,27 +154,27 @@ type State string const ( // StateNotStarted describes user intent to initialize but not execute the update run. // This is the default state when an update run is created. - StateNotStarted State = "NotStarted" + StateNotStarted State = "Initialize" // StateStarted describes user intent to execute (or resume execution if paused). - // Users can subsequently set the state to Stopped or Abandoned. - StateStarted State = "Started" + // Users can subsequently set the state to Pause or Abandon. + StateStarted State = "Execute" // StateStopped describes user intent to pause the update run. - // Users can subsequently set the state to Started or Abandoned. - StateStopped State = "Stopped" + // Users can subsequently set the state to Execute or Abandon. + StateStopped State = "Pause" // StateAbandoned describes user intent to abandon the update run. // This is a terminal state; once set, it cannot be changed. - StateAbandoned State = "Abandoned" + StateAbandoned State = "Abandon" ) // UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated. // It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object. -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'NotStarted' || self.state != 'Stopped'",message="invalid state transition: cannot transition from NotStarted to Stopped" -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Started' || self.state != 'NotStarted'",message="invalid state transition: cannot transition from Started to NotStarted" -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Stopped' || self.state != 'NotStarted'",message="invalid state transition: cannot transition from Stopped to NotStarted" -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Abandoned' || self.state == 'Abandoned'",message="invalid state transition: Abandoned is a terminal state and cannot transition to any other state" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Initialize' || self.state != 'Pause'",message="invalid state transition: cannot transition from Initialize to Pause" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Execute' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Execute to Initialize" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Pause' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Pause to Initialize" +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Abandon' || self.state == 'Abandon'",message="invalid state transition: Abandon is a terminal state and cannot transition to any other state" type UpdateRunSpec struct { // PlacementName is the name of placement that this update run is applied to. // There can be multiple active update runs for each placement, but @@ -199,13 +199,13 @@ type UpdateRunSpec struct { StagedUpdateStrategyName string `json:"stagedRolloutStrategyName"` // State indicates the desired state of the update run. - // NotStarted: The update run is initialized but execution has not started (default). - // Started: The update run should execute or resume execution. - // Stopped: The update run should pause execution. - // Abandoned: The update run should be abandoned and terminated. + // Initialize: The update run should be initialized but execution should not start (default). + // Execute: The update run should execute or resume execution. + // Pause: The update run should pause execution. + // Abandon: The update run should be abandoned and terminated. // +kubebuilder:validation:Optional - // +kubebuilder:default=NotStarted - // +kubebuilder:validation:Enum=NotStarted;Started;Stopped;Abandoned + // +kubebuilder:default=Initialize + // +kubebuilder:validation:Enum=Initialize;Execute;Pause;Abandon State State `json:"state,omitempty"` } diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml index 0bf83da28..b725960cc 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml @@ -1185,40 +1185,40 @@ spec: - message: stagedRolloutStrategyName is immutable rule: self == oldSelf state: - default: NotStarted + default: Initialize description: |- State indicates the desired state of the update run. - NotStarted: The update run is initialized but execution has not started (default). - Started: The update run should execute or resume execution. - Stopped: The update run should pause execution. - Abandoned: The update run should be abandoned and terminated. + Initialize: The update run should be initialized but execution should not start (default). + Execute: The update run should execute or resume execution. + Pause: The update run should pause execution. + Abandon: The update run should be abandoned and terminated. enum: - - NotStarted - - Started - - Stopped - - Abandoned + - Initialize + - Execute + - Pause + - Abandon type: string required: - placementName - stagedRolloutStrategyName type: object x-kubernetes-validations: - - message: 'invalid state transition: cannot transition from NotStarted - to Stopped' - rule: '!has(oldSelf.state) || oldSelf.state != ''NotStarted'' || self.state - != ''Stopped''' - - message: 'invalid state transition: cannot transition from Started to - NotStarted' - rule: '!has(oldSelf.state) || oldSelf.state != ''Started'' || self.state - != ''NotStarted''' - - message: 'invalid state transition: cannot transition from Stopped to - NotStarted' - rule: '!has(oldSelf.state) || oldSelf.state != ''Stopped'' || self.state - != ''NotStarted''' - - message: 'invalid state transition: Abandoned is a terminal state and + - message: 'invalid state transition: cannot transition from Initialize + to Pause' + rule: '!has(oldSelf.state) || oldSelf.state != ''Initialize'' || self.state + != ''Pause''' + - message: 'invalid state transition: cannot transition from Execute to + Initialize' + rule: '!has(oldSelf.state) || oldSelf.state != ''Execute'' || self.state + != ''Initialize''' + - message: 'invalid state transition: cannot transition from Pause to + Initialize' + rule: '!has(oldSelf.state) || oldSelf.state != ''Pause'' || self.state + != ''Initialize''' + - message: 'invalid state transition: Abandon is a terminal state and cannot transition to any other state' - rule: '!has(oldSelf.state) || oldSelf.state != ''Abandoned'' || self.state - == ''Abandoned''' + rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state + == ''Abandon''' status: description: The observed status of ClusterStagedUpdateRun. properties: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml b/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml index 979c73e99..2d4b62eae 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml @@ -105,40 +105,40 @@ spec: - message: stagedRolloutStrategyName is immutable rule: self == oldSelf state: - default: NotStarted + default: Initialize description: |- State indicates the desired state of the update run. - NotStarted: The update run is initialized but execution has not started (default). - Started: The update run should execute or resume execution. - Stopped: The update run should pause execution. - Abandoned: The update run should be abandoned and terminated. + Initialize: The update run should be initialized but execution should not start (default). + Execute: The update run should execute or resume execution. + Pause: The update run should pause execution. + Abandon: The update run should be abandoned and terminated. enum: - - NotStarted - - Started - - Stopped - - Abandoned + - Initialize + - Execute + - Pause + - Abandon type: string required: - placementName - stagedRolloutStrategyName type: object x-kubernetes-validations: - - message: 'invalid state transition: cannot transition from NotStarted - to Stopped' - rule: '!has(oldSelf.state) || oldSelf.state != ''NotStarted'' || self.state - != ''Stopped''' - - message: 'invalid state transition: cannot transition from Started to - NotStarted' - rule: '!has(oldSelf.state) || oldSelf.state != ''Started'' || self.state - != ''NotStarted''' - - message: 'invalid state transition: cannot transition from Stopped to - NotStarted' - rule: '!has(oldSelf.state) || oldSelf.state != ''Stopped'' || self.state - != ''NotStarted''' - - message: 'invalid state transition: Abandoned is a terminal state and + - message: 'invalid state transition: cannot transition from Initialize + to Pause' + rule: '!has(oldSelf.state) || oldSelf.state != ''Initialize'' || self.state + != ''Pause''' + - message: 'invalid state transition: cannot transition from Execute to + Initialize' + rule: '!has(oldSelf.state) || oldSelf.state != ''Execute'' || self.state + != ''Initialize''' + - message: 'invalid state transition: cannot transition from Pause to + Initialize' + rule: '!has(oldSelf.state) || oldSelf.state != ''Pause'' || self.state + != ''Initialize''' + - message: 'invalid state transition: Abandon is a terminal state and cannot transition to any other state' - rule: '!has(oldSelf.state) || oldSelf.state != ''Abandoned'' || self.state - == ''Abandoned''' + rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state + == ''Abandon''' status: description: The observed status of StagedUpdateRun. properties: From 010c1e04e4172a02547b1bd78c9b9e5955f60423 Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Tue, 25 Nov 2025 20:27:19 -0800 Subject: [PATCH 2/2] fix api test Signed-off-by: Ryan Zhang --- apis/placement/v1beta1/stageupdate_types.go | 6 +-- ...etes-fleet.io_clusterstagedupdateruns.yaml | 12 ++--- ....kubernetes-fleet.io_stagedupdateruns.yaml | 12 ++--- .../api_validation_integration_test.go | 54 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/apis/placement/v1beta1/stageupdate_types.go b/apis/placement/v1beta1/stageupdate_types.go index 2974f4c5f..588e38136 100644 --- a/apis/placement/v1beta1/stageupdate_types.go +++ b/apis/placement/v1beta1/stageupdate_types.go @@ -171,9 +171,9 @@ const ( // UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated. // It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object. -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Initialize' || self.state != 'Pause'",message="invalid state transition: cannot transition from Initialize to Pause" -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Execute' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Execute to Initialize" -// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Pause' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Pause to Initialize" +// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Initialize' && self.state == 'Pause')",message="invalid state transition: cannot transition from Initialize to Pause" +// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Execute' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Execute to Initialize" +// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Pause' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Pause to Initialize" // +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Abandon' || self.state == 'Abandon'",message="invalid state transition: Abandon is a terminal state and cannot transition to any other state" type UpdateRunSpec struct { // PlacementName is the name of placement that this update run is applied to. diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml index b725960cc..c95748724 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml @@ -1205,16 +1205,16 @@ spec: x-kubernetes-validations: - message: 'invalid state transition: cannot transition from Initialize to Pause' - rule: '!has(oldSelf.state) || oldSelf.state != ''Initialize'' || self.state - != ''Pause''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Initialize'' && self.state + == ''Pause'')' - message: 'invalid state transition: cannot transition from Execute to Initialize' - rule: '!has(oldSelf.state) || oldSelf.state != ''Execute'' || self.state - != ''Initialize''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Execute'' && self.state + == ''Initialize'')' - message: 'invalid state transition: cannot transition from Pause to Initialize' - rule: '!has(oldSelf.state) || oldSelf.state != ''Pause'' || self.state - != ''Initialize''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Pause'' && self.state + == ''Initialize'')' - message: 'invalid state transition: Abandon is a terminal state and cannot transition to any other state' rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state diff --git a/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml b/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml index 2d4b62eae..abfa39f46 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml @@ -125,16 +125,16 @@ spec: x-kubernetes-validations: - message: 'invalid state transition: cannot transition from Initialize to Pause' - rule: '!has(oldSelf.state) || oldSelf.state != ''Initialize'' || self.state - != ''Pause''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Initialize'' && self.state + == ''Pause'')' - message: 'invalid state transition: cannot transition from Execute to Initialize' - rule: '!has(oldSelf.state) || oldSelf.state != ''Execute'' || self.state - != ''Initialize''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Execute'' && self.state + == ''Initialize'')' - message: 'invalid state transition: cannot transition from Pause to Initialize' - rule: '!has(oldSelf.state) || oldSelf.state != ''Pause'' || self.state - != ''Initialize''' + rule: '!(has(oldSelf.state) && oldSelf.state == ''Pause'' && self.state + == ''Initialize'')' - message: 'invalid state transition: Abandon is a terminal state and cannot transition to any other state' rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state diff --git a/test/apis/placement/v1beta1/api_validation_integration_test.go b/test/apis/placement/v1beta1/api_validation_integration_test.go index 9d14e54f9..03aa7895e 100644 --- a/test/apis/placement/v1beta1/api_validation_integration_test.go +++ b/test/apis/placement/v1beta1/api_validation_integration_test.go @@ -1813,7 +1813,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { }) }) - Context("Test ClusterStagedUpdateRun State API validation - valid NotStarted state transitions", func() { + Context("Test ClusterStagedUpdateRun State API validation - valid Initialize state transitions", func() { var updateRun *placementv1beta1.ClusterStagedUpdateRun updateRunName := fmt.Sprintf(validupdateRunNameTemplate, GinkgoParallelProcess()) @@ -1839,7 +1839,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { Name: "unspecfied-state-update-run-" + fmt.Sprintf("%d", GinkgoParallelProcess()), }, Spec: placementv1beta1.UpdateRunSpec{ - // State not specified - should default to NotStarted + // State not specified - should default to Initialize }, } Expect(hubClient.Create(ctx, updateRunWithDefaultState)).Should(Succeed()) @@ -1847,7 +1847,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { Expect(hubClient.Delete(ctx, updateRunWithDefaultState)).Should(Succeed()) }) - It("should allow creation of ClusterStagedUpdateRun with empty state (defaults to NotStarted)", func() { + It("should allow creation of ClusterStagedUpdateRun with empty state (defaults to Initialize)", func() { updateRun := &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: "empty-state-update-run-" + fmt.Sprintf("%d", GinkgoParallelProcess()), @@ -1861,18 +1861,18 @@ var _ = Describe("Test placement v1beta1 API validation", func() { Expect(hubClient.Delete(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from NotStarted to Started", func() { + It("should allow transition from Initialize to Execute", func() { updateRun.Spec.State = placementv1beta1.StateStarted Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from NotStarted to Abandoned", func() { + It("should allow transition from Initialize to Abandon", func() { updateRun.Spec.State = placementv1beta1.StateAbandoned Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) }) - Context("Test ClusterStagedUpdateRun State API validation - valid Started state transitions", func() { + Context("Test ClusterStagedUpdateRun State API validation - valid Execute state transitions", func() { var updateRun *placementv1beta1.ClusterStagedUpdateRun updateRunName := fmt.Sprintf(validupdateRunNameTemplate, GinkgoParallelProcess()) @@ -1892,18 +1892,18 @@ var _ = Describe("Test placement v1beta1 API validation", func() { Expect(hubClient.Delete(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from Started to Stopped", func() { + It("should allow transition from Execute to Pause", func() { updateRun.Spec.State = placementv1beta1.StateStopped Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from Started to Abandoned", func() { + It("should allow transition from Execute to Abandon", func() { updateRun.Spec.State = placementv1beta1.StateAbandoned Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) }) - Context("Test ClusterStagedUpdateRun State API validation - valid Stopped state transitions", func() { + Context("Test ClusterStagedUpdateRun State API validation - valid Pause state transitions", func() { var updateRun *placementv1beta1.ClusterStagedUpdateRun updateRunName := fmt.Sprintf(validupdateRunNameTemplate, GinkgoParallelProcess()) @@ -1917,7 +1917,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { }, } Expect(hubClient.Create(ctx, updateRun)).Should(Succeed()) - // Transition to Stopped state first + // Transition to Pause state first updateRun.Spec.State = placementv1beta1.StateStopped Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) @@ -1926,12 +1926,12 @@ var _ = Describe("Test placement v1beta1 API validation", func() { Expect(hubClient.Delete(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from Stopped to Started", func() { + It("should allow transition from Pause to Execute", func() { updateRun.Spec.State = placementv1beta1.StateStarted Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) - It("should allow transition from Stopped to Abandoned", func() { + It("should allow transition from Pause to Abandon", func() { updateRun.Spec.State = placementv1beta1.StateAbandoned Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) }) @@ -1947,7 +1947,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { } }) - It("should deny transition from NotStarted to Stopped", func() { + It("should deny transition from Initialize to Pause", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -1962,10 +1962,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from NotStarted to Stopped")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Initialize to Pause")) }) - It("should deny transition from Started to NotStarted", func() { + It("should deny transition from Execute to Initialize", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -1980,10 +1980,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Started to NotStarted")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Execute to Initialize")) }) - It("should deny transition from Stopped to NotStarted", func() { + It("should deny transition from Pause to Initialize", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -1994,19 +1994,19 @@ var _ = Describe("Test placement v1beta1 API validation", func() { } Expect(hubClient.Create(ctx, updateRun)).Should(Succeed()) - // Transition to Stopped first + // Transition to Pause first updateRun.Spec.State = placementv1beta1.StateStopped Expect(hubClient.Update(ctx, updateRun)).Should(Succeed()) - // Try to transition back to NotStarted + // Try to transition back to Initialize updateRun.Spec.State = placementv1beta1.StateNotStarted err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Stopped to NotStarted")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Pause to Initialize")) }) - It("should deny transition from Abandoned to NotStarted", func() { + It("should deny transition from Abandon to Initialize", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -2021,10 +2021,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state")) }) - It("should deny transition from Abandoned to Started", func() { + It("should deny transition from Abandon to Execute", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -2039,10 +2039,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state")) }) - It("should deny transition from Abandoned to Stopped", func() { + It("should deny transition from Abandon to Pause", func() { updateRun = &placementv1beta1.ClusterStagedUpdateRun{ ObjectMeta: metav1.ObjectMeta{ Name: updateRunName, @@ -2057,7 +2057,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Update(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state")) }) }) @@ -2077,7 +2077,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() { err := hubClient.Create(ctx, updateRun) var statusErr *k8sErrors.StatusError Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Create ClusterStagedUpdateRun call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{}))) - Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("supported values: \"NotStarted\", \"Started\", \"Stopped\", \"Abandoned\"")) + Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("supported values: \"Initialize\", \"Execute\", \"Pause\", \"Abandon\"")) }) })