Skip to content

Ensure optional fields have the // +optional tag #1147

@everettraven

Description

@everettraven

As outlined in the Optional vs. Required subsection of the Kubernetes API Conventions, all optional fields should contain the +optional comment tag.

The following fields need to be updated with this comment tag:

  • ClusterExtension.Spec.Version:
    //+kubebuilder:validation:MaxLength:=64
    //+kubebuilder:validation:Pattern=`^(\s*(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|[x|X|\*])(\.(0|[1-9]\d*|x|X|\*]))?(\.(0|[1-9]\d*|x|X|\*))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)((?:\s+|,\s*|\s*\|\|\s*)(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|x|X|\*])(\.(0|[1-9]\d*|x|X|\*))?(\.(0|[1-9]\d*|x|X|\*]))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)*$`
    //+kubebuilder:Optional
    // Version is an optional semver constraint on the package version. If not specified, the latest version available of the package will be installed.
    // If specified, the specific version of the package will be installed so long as it is available in any of the content sources available.
    // Examples: 1.2.3, 1.0.0-alpha, 1.0.0-rc.1
    //
    // For more information on semver, please see https://semver.org/
    Version string `json:"version,omitempty"`
  • ClusterExtension.Spec.Channel:
    //+kubebuilder:validation:MaxLength:=48
    //+kubebuilder:validation:Pattern:=^[a-z0-9]+([\.-][a-z0-9]+)*$
    // Channel constraint definition
    Channel string `json:"channel,omitempty"`
  • ClusterExtension.Spec.UpgradeConstraintPolicy:
    //+kubebuilder:validation:Enum:=Enforce;Ignore
    //+kubebuilder:default:=Enforce
    //+kubebuilder:Optional
    //
    // Defines the policy for how to handle upgrade constraints
    UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
  • ClusterExtension.Spec.Preflight:
    //+kubebuilder:Optional
    // Preflight defines the configuration of preflight checks.
    Preflight *PreflightConfig `json:"preflight,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