Skip to content

KAL does not detect zero value invalid via string validation markers on underlying struct #138

@sbueringer

Description

@sbueringer

Wasn't sure how to phrase the issue title, but it's easier to understand with an example:

	// token is used for establishing bidirectional trust between nodes and control-planes.
	// Used for joining nodes in the cluster.
	// +required
	Token BootstrapTokenString `json:"token,omitempty,omitzero"`

...

// +kubebuilder:validation:Type=string
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=23
type BootstrapTokenString struct {
	ID     string `json:"-"`
	Secret string `json:"-"`
}

https://github.com/kubernetes-sigs/cluster-api/blob/release-1.11/api/bootstrap/kubeadm/v1beta2/kubeadm_types.go#L951-L962

Schema:

                        token:
                          maxLength: 23
                          minLength: 1
                          type: string

Finding:

api/bootstrap/kubeadm/v1beta2/kubeadm_types.go:427:2: requiredfields: field Token has a valid zero value ({"": "", "": ""}) and should be a pointer. (kubeapilinter)
        Token BootstrapTokenString `json:"token,omitempty,omitzero"`
        ^

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions