-
Notifications
You must be signed in to change notification settings - Fork 47
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
✨ Add optional field to ClusterExtension API to skip CRD upgrade safety checks #845
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -73,8 +73,41 @@ type ClusterExtensionSpec struct { | |||||
// the bundle may contain resources that are cluster-scoped or that are | ||||||
// installed in a different namespace. This namespace is expected to exist. | ||||||
InstallNamespace string `json:"installNamespace"` | ||||||
|
||||||
//+kubebuilder:Optional | ||||||
// Preflight defines the strategy for the preflight checks (i.e. as of now, the CRD upgrade safety checks) to be applied or skipped when attempting to install the cluster extension. | ||||||
Preflight PreflightConfig `json:"preflight,omitempty"` | ||||||
} | ||||||
|
||||||
// PreflightConfig holds the config for the preflight checks. Currently, this is implemented for the | ||||||
// CRDUpgradeSafety preflight check and can be extended in the future to add other preflight checks. | ||||||
type PreflightConfig struct { | ||||||
CRDUpgradeSafety CRDUpgradeSafetyPreflightConfig `json:"crdUpgradeSafety,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above: re using pointer if field is optional. |
||||||
} | ||||||
|
||||||
// CRDUpgradeSafetyPreflightConfig is a custom struct that holds the necessary configuration values to | ||||||
// enable or disable the CRD Upgrade Safety validations. Currently, this holds Mode | ||||||
// that sets the CRD Upgrade Safety validations to either Enabled/Disabled. | ||||||
// By default, this is set to "Enabled". | ||||||
type CRDUpgradeSafetyPreflightConfig struct { | ||||||
//+kubebuilder:validation:Enum:=Enabled;Disabled | ||||||
//+kubebuilder:default:=Enabled | ||||||
//+kubebuilder:Optional | ||||||
CRDUpgradeSafetyMode CRDUpgradeSafetyMode `json:"mode,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||
} | ||||||
|
||||||
type CRDUpgradeSafetyMode string | ||||||
|
||||||
const ( | ||||||
// CRDUpgradeSafetyModeEnabled represents the default state for the | ||||||
// CRD Upgrade Safety validations by setting it to "Enabled". | ||||||
CRDUpgradeSafetyModeEnabled CRDUpgradeSafetyMode = "Enabled" | ||||||
|
||||||
// CRDUpgradeSafetyModeDisabled represents the option for the | ||||||
// CRD Upgrade Safety validations to be disabled by setting it to "Disabled". | ||||||
CRDUpgradeSafetyModeDisabled CRDUpgradeSafetyMode = "Disabled" | ||||||
) | ||||||
|
||||||
const ( | ||||||
// TODO(user): add more Types, here and into init() | ||||||
TypeInstalled = "Installed" | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a field is optional (i.e. with
omitempty
), it should also be a pointer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch - I totally missed that!