Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine-api: disallow unsetting authoritativeAPI #2091

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions machine/v1beta1/types_machineset.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ type MachineTemplateSpec struct {

// MachineSetStatus defines the observed state of MachineSet
// +openshift:validation:FeatureGateAwareXValidation:featureGate=MachineAPIMigration,rule="!has(oldSelf.synchronizedGeneration) || (has(self.synchronizedGeneration) && self.synchronizedGeneration >= oldSelf.synchronizedGeneration) || (oldSelf.authoritativeAPI == 'Migrating' && self.authoritativeAPI != 'Migrating')",message="synchronizedGeneration must not decrease unless authoritativeAPI is transitioning from Migrating to another value"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=MachineAPIMigration,rule="self.authoritativeAPI != ” || oldSelf.authoritativeAPI == ”",message="authoritativeAPI cannot be unset once it has been set"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want something similar on the spec? What about for Machines?

I would like to see some testing with the integration test suite that tests this validation transition

type MachineSetStatus struct {
// Replicas is the most recently observed number of replicas.
Replicas int32 `json:"replicas"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ spec:
&& self.synchronizedGeneration >= oldSelf.synchronizedGeneration)
|| (oldSelf.authoritativeAPI == ''Migrating'' && self.authoritativeAPI
!= ''Migrating'')'
- message: authoritativeAPI cannot be unset once it has been set
rule: self.authoritativeAPI != ” || oldSelf.authoritativeAPI == ”
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ spec:
&& self.synchronizedGeneration >= oldSelf.synchronizedGeneration)
|| (oldSelf.authoritativeAPI == ''Migrating'' && self.authoritativeAPI
!= ''Migrating'')'
- message: authoritativeAPI cannot be unset once it has been set
rule: self.authoritativeAPI != ” || oldSelf.authoritativeAPI == ”
type: object
served: true
storage: true
Expand Down