Skip to content

Machine API vSphereProvider contains an incorrect validation rule #2978

Description

@Jakob-Naucke

// +kubebuilder:validation:Pattern="^(urn):(vmomi):(InventoryServiceTag):([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}):([^:]+)$"
// +kubebuilder:example="urn:vmomi:InventoryServiceTag:5736bf56-49f5-4667-b38c-b97e09dc9578:GLOBAL"
// +optional
TagIDs []string `json:"tagIDs,omitempty"`

defines a kubebuilder:validation:Pattern on an array type, but according to the validation docs, that should be defined on strings, and this should perhaps use kubebuilder:validation:items:Pattern. This also leads to controller-gen crd rejecting this API:

% controller-gen crd paths=github.com/openshift/api/machine/v1beta1
/[...]/openshift-api/machine/v1beta1/types_vsphereprovider.go:59:2: must apply pattern to a textual value, found type "array"
Error: not all generators ran successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions