You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apis/placement/v1beta1/stageupdate_types.go
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -171,9 +171,9 @@ const (
171
171
172
172
// UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated.
173
173
// It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object.
174
-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Initialize' || self.state != 'Pause'",message="invalid state transition: cannot transition from Initialize to Pause"
175
-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Execute' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Execute to Initialize"
176
-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Pause' || self.state != 'Initialize'",message="invalid state transition: cannot transition from Pause to Initialize"
174
+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Initialize' && self.state == 'Pause')",message="invalid state transition: cannot transition from Initialize to Pause"
175
+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Execute' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Execute to Initialize"
176
+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Pause' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Pause to Initialize"
177
177
// +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"
178
178
typeUpdateRunSpecstruct {
179
179
// PlacementName is the name of placement that this update run is applied to.
@@ -1962,10 +1962,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
1962
1962
err:=hubClient.Update(ctx, updateRun)
1963
1963
varstatusErr*k8sErrors.StatusError
1964
1964
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{})))
1965
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from NotStarted to Stopped"))
1965
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Initialize to Pause"))
1966
1966
})
1967
1967
1968
-
It("should deny transition from Started to NotStarted", func() {
1968
+
It("should deny transition from Execute to Initialize", func() {
@@ -1980,10 +1980,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
1980
1980
err:=hubClient.Update(ctx, updateRun)
1981
1981
varstatusErr*k8sErrors.StatusError
1982
1982
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{})))
1983
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Started to NotStarted"))
1983
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Execute to Initialize"))
1984
1984
})
1985
1985
1986
-
It("should deny transition from Stopped to NotStarted", func() {
1986
+
It("should deny transition from Pause to Initialize", func() {
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{})))
2006
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Stopped to NotStarted"))
2006
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: cannot transition from Pause to Initialize"))
2007
2007
})
2008
2008
2009
-
It("should deny transition from Abandoned to NotStarted", func() {
2009
+
It("should deny transition from Abandon to Initialize", func() {
@@ -2021,10 +2021,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
2021
2021
err:=hubClient.Update(ctx, updateRun)
2022
2022
varstatusErr*k8sErrors.StatusError
2023
2023
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{})))
2024
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state"))
2024
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state"))
2025
2025
})
2026
2026
2027
-
It("should deny transition from Abandoned to Started", func() {
2027
+
It("should deny transition from Abandon to Execute", func() {
@@ -2039,10 +2039,10 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
2039
2039
err:=hubClient.Update(ctx, updateRun)
2040
2040
varstatusErr*k8sErrors.StatusError
2041
2041
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{})))
2042
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state"))
2042
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state"))
2043
2043
})
2044
2044
2045
-
It("should deny transition from Abandoned to Stopped", func() {
2045
+
It("should deny transition from Abandon to Pause", func() {
@@ -2057,7 +2057,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
2057
2057
err:=hubClient.Update(ctx, updateRun)
2058
2058
varstatusErr*k8sErrors.StatusError
2059
2059
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{})))
2060
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandoned is a terminal state and cannot transition to any other state"))
2060
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("invalid state transition: Abandon is a terminal state and cannot transition to any other state"))
2061
2061
})
2062
2062
})
2063
2063
@@ -2077,7 +2077,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
2077
2077
err:=hubClient.Create(ctx, updateRun)
2078
2078
varstatusErr*k8sErrors.StatusError
2079
2079
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{})))
0 commit comments