Skip to content

OCPBUGS-56382: Fix validation for Resource field in MOSB API #2327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions machineconfiguration/v1/types_machineosbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ type ObjectReference struct {
Group string `json:"group"`
// resource of the referent.
// This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
// and should start and end with an alphanumeric character.
// and should start with an alphabetic character and end with an alphanumeric character.
// Example: "deployments", "deploymentconfigs", "pods", etc.
// +required
// +kubebuilder:validation:XValidation:rule=`!format.dns1123Label().validate(self).hasValue()`,message="the value must consist of only lowercase alphanumeric characters and hyphens"
// +kubebuilder:validation:XValidation:rule=`!format.dns1035Label().validate(self).hasValue()`,message="a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character"
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
Resource string `json:"resource"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character,
and end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down Expand Up @@ -367,15 +368,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character,
and end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down Expand Up @@ -368,15 +369,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character,
and end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down Expand Up @@ -367,15 +368,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,16 @@ spec:
description: |-
resource of the referent.
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
and should start and end with an alphanumeric character.
and should start with an alphabetic character and end with an alphanumeric character.
Example: "deployments", "deploymentconfigs", "pods", etc.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: the value must consist of only lowercase alphanumeric
characters and hyphens
rule: '!format.dns1123Label().validate(self).hasValue()'
- message: a DNS-1035 label must consist of lower case alphanumeric
characters or '-', start with an alphabetic character, and
end with an alphanumeric character
rule: '!format.dns1035Label().validate(self).hasValue()'
required:
- group
- name
Expand Down