Skip to content

Commit 9cbdb71

Browse files
Merge pull request openshift#2327 from umohnani8/resource
OCPBUGS-56382: Fix validation for Resource field in MOSB API
2 parents 094c670 + 7065a4e commit 9cbdb71

File tree

8 files changed

+48
-39
lines changed

8 files changed

+48
-39
lines changed

machineconfiguration/v1/types_machineosbuild.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ type ObjectReference struct {
179179
Group string `json:"group"`
180180
// resource of the referent.
181181
// This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
182-
// and should start and end with an alphanumeric character.
182+
// and should start with an alphabetic character and end with an alphanumeric character.
183183
// Example: "deployments", "deploymentconfigs", "pods", etc.
184184
// +required
185-
// +kubebuilder:validation:XValidation:rule=`!format.dns1123Label().validate(self).hasValue()`,message="the value must consist of only lowercase alphanumeric characters and hyphens"
185+
// +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"
186186
// +kubebuilder:validation:MinLength=1
187187
// +kubebuilder:validation:MaxLength=63
188188
Resource string `json:"resource"`

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosbuilds.crd.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,16 @@ spec:
206206
description: |-
207207
resource of the referent.
208208
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
209-
and should start and end with an alphanumeric character.
209+
and should start with an alphabetic character and end with an alphanumeric character.
210210
Example: "deployments", "deploymentconfigs", "pods", etc.
211211
maxLength: 63
212212
minLength: 1
213213
type: string
214214
x-kubernetes-validations:
215-
- message: the value must consist of only lowercase alphanumeric
216-
characters and hyphens
217-
rule: '!format.dns1123Label().validate(self).hasValue()'
215+
- message: a DNS-1035 label must consist of lower case alphanumeric
216+
characters or '-', start with an alphabetic character,
217+
and end with an alphanumeric character
218+
rule: '!format.dns1035Label().validate(self).hasValue()'
218219
required:
219220
- group
220221
- name
@@ -367,15 +368,16 @@ spec:
367368
description: |-
368369
resource of the referent.
369370
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
370-
and should start and end with an alphanumeric character.
371+
and should start with an alphabetic character and end with an alphanumeric character.
371372
Example: "deployments", "deploymentconfigs", "pods", etc.
372373
maxLength: 63
373374
minLength: 1
374375
type: string
375376
x-kubernetes-validations:
376-
- message: the value must consist of only lowercase alphanumeric
377-
characters and hyphens
378-
rule: '!format.dns1123Label().validate(self).hasValue()'
377+
- message: a DNS-1035 label must consist of lower case alphanumeric
378+
characters or '-', start with an alphabetic character, and
379+
end with an alphanumeric character
380+
rule: '!format.dns1035Label().validate(self).hasValue()'
379381
required:
380382
- group
381383
- name

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineosconfigs.crd.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,16 @@ spec:
317317
description: |-
318318
resource of the referent.
319319
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
320-
and should start and end with an alphanumeric character.
320+
and should start with an alphabetic character and end with an alphanumeric character.
321321
Example: "deployments", "deploymentconfigs", "pods", etc.
322322
maxLength: 63
323323
minLength: 1
324324
type: string
325325
x-kubernetes-validations:
326-
- message: the value must consist of only lowercase alphanumeric
327-
characters and hyphens
328-
rule: '!format.dns1123Label().validate(self).hasValue()'
326+
- message: a DNS-1035 label must consist of lower case alphanumeric
327+
characters or '-', start with an alphabetic character, and
328+
end with an alphanumeric character
329+
rule: '!format.dns1035Label().validate(self).hasValue()'
329330
required:
330331
- group
331332
- name

machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosbuilds.machineconfiguration.openshift.io/OnClusterBuild.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,16 @@ spec:
207207
description: |-
208208
resource of the referent.
209209
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
210-
and should start and end with an alphanumeric character.
210+
and should start with an alphabetic character and end with an alphanumeric character.
211211
Example: "deployments", "deploymentconfigs", "pods", etc.
212212
maxLength: 63
213213
minLength: 1
214214
type: string
215215
x-kubernetes-validations:
216-
- message: the value must consist of only lowercase alphanumeric
217-
characters and hyphens
218-
rule: '!format.dns1123Label().validate(self).hasValue()'
216+
- message: a DNS-1035 label must consist of lower case alphanumeric
217+
characters or '-', start with an alphabetic character,
218+
and end with an alphanumeric character
219+
rule: '!format.dns1035Label().validate(self).hasValue()'
219220
required:
220221
- group
221222
- name
@@ -368,15 +369,16 @@ spec:
368369
description: |-
369370
resource of the referent.
370371
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
371-
and should start and end with an alphanumeric character.
372+
and should start with an alphabetic character and end with an alphanumeric character.
372373
Example: "deployments", "deploymentconfigs", "pods", etc.
373374
maxLength: 63
374375
minLength: 1
375376
type: string
376377
x-kubernetes-validations:
377-
- message: the value must consist of only lowercase alphanumeric
378-
characters and hyphens
379-
rule: '!format.dns1123Label().validate(self).hasValue()'
378+
- message: a DNS-1035 label must consist of lower case alphanumeric
379+
characters or '-', start with an alphabetic character, and
380+
end with an alphanumeric character
381+
rule: '!format.dns1035Label().validate(self).hasValue()'
380382
required:
381383
- group
382384
- name

machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineosconfigs.machineconfiguration.openshift.io/OnClusterBuild.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,16 @@ spec:
318318
description: |-
319319
resource of the referent.
320320
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
321-
and should start and end with an alphanumeric character.
321+
and should start with an alphabetic character and end with an alphanumeric character.
322322
Example: "deployments", "deploymentconfigs", "pods", etc.
323323
maxLength: 63
324324
minLength: 1
325325
type: string
326326
x-kubernetes-validations:
327-
- message: the value must consist of only lowercase alphanumeric
328-
characters and hyphens
329-
rule: '!format.dns1123Label().validate(self).hasValue()'
327+
- message: a DNS-1035 label must consist of lower case alphanumeric
328+
characters or '-', start with an alphabetic character, and
329+
end with an alphanumeric character
330+
rule: '!format.dns1035Label().validate(self).hasValue()'
330331
required:
331332
- group
332333
- name

machineconfiguration/v1/zz_generated.swagger_doc_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payload-manifests/crds/0000_80_machine-config_01_machineosbuilds.crd.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,16 @@ spec:
206206
description: |-
207207
resource of the referent.
208208
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
209-
and should start and end with an alphanumeric character.
209+
and should start with an alphabetic character and end with an alphanumeric character.
210210
Example: "deployments", "deploymentconfigs", "pods", etc.
211211
maxLength: 63
212212
minLength: 1
213213
type: string
214214
x-kubernetes-validations:
215-
- message: the value must consist of only lowercase alphanumeric
216-
characters and hyphens
217-
rule: '!format.dns1123Label().validate(self).hasValue()'
215+
- message: a DNS-1035 label must consist of lower case alphanumeric
216+
characters or '-', start with an alphabetic character,
217+
and end with an alphanumeric character
218+
rule: '!format.dns1035Label().validate(self).hasValue()'
218219
required:
219220
- group
220221
- name
@@ -367,15 +368,16 @@ spec:
367368
description: |-
368369
resource of the referent.
369370
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
370-
and should start and end with an alphanumeric character.
371+
and should start with an alphabetic character and end with an alphanumeric character.
371372
Example: "deployments", "deploymentconfigs", "pods", etc.
372373
maxLength: 63
373374
minLength: 1
374375
type: string
375376
x-kubernetes-validations:
376-
- message: the value must consist of only lowercase alphanumeric
377-
characters and hyphens
378-
rule: '!format.dns1123Label().validate(self).hasValue()'
377+
- message: a DNS-1035 label must consist of lower case alphanumeric
378+
characters or '-', start with an alphabetic character, and
379+
end with an alphanumeric character
380+
rule: '!format.dns1035Label().validate(self).hasValue()'
379381
required:
380382
- group
381383
- name

payload-manifests/crds/0000_80_machine-config_01_machineosconfigs.crd.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,16 @@ spec:
317317
description: |-
318318
resource of the referent.
319319
This value should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
320-
and should start and end with an alphanumeric character.
320+
and should start with an alphabetic character and end with an alphanumeric character.
321321
Example: "deployments", "deploymentconfigs", "pods", etc.
322322
maxLength: 63
323323
minLength: 1
324324
type: string
325325
x-kubernetes-validations:
326-
- message: the value must consist of only lowercase alphanumeric
327-
characters and hyphens
328-
rule: '!format.dns1123Label().validate(self).hasValue()'
326+
- message: a DNS-1035 label must consist of lower case alphanumeric
327+
characters or '-', start with an alphabetic character, and
328+
end with an alphanumeric character
329+
rule: '!format.dns1035Label().validate(self).hasValue()'
329330
required:
330331
- group
331332
- name

0 commit comments

Comments
 (0)