Skip to content

Convert boolean fields to enums #1145

@everettraven

Description

@everettraven

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:

Disabled bool `json:"disabled,omitempty"`

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"`
}

Metadata

Metadata

Assignees

Labels

epic/v1-apigood first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.v1.0Issues related to the initial stable release of OLMv1

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions