operator-controller
operator-controller copied to clipboard
Convert boolean fields to enums
As outlined in the Do not use Boolean Fields subsection of the OpenShift API Conventions, boolean fields are to be replaced with an enumeration of values that describe the action instead.
At the time of writing this issue, the only field that is boolean type is the ClusterExtension.Spec.Preflight.CRDUpgradeSafety.Disabled field: https://github.com/operator-framework/operator-controller/blob/cb9ea0032c95d59d8a4951593f6486ae6c03c0bb/api/v1alpha1/clusterextension_types.go#L112
This field should be updated to use an enumeration instead.
For inspiration, an implementation could look something like:
type CRDUpgradeSafetyPolicy string
const (
CRDUpgradeSafetyPolicyEnabled CRDUpgradeSafetyPolicy = "Enabled"
CRDUpgradeSafetyPolicyDisabled CRDUpgradeSafetyPolicy = "Disabled"
)
type CRDUpgradeSafetyPreflightConfig struct {
//+kubebuilder:Required
// +kubebuilder:validation:Enum:="Enabled","Disabled"
// policy represents the state of the CRD upgrade safety preflight check. Allowed values are "Enabled", and Disabled".
Policy CRDUpgradeSafetyPolicy `json:"policy,omitempty"`
}