Skip to content

Commit b14ab02

Browse files
committed
feat: run make generate
Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 06e7038 commit b14ab02

12 files changed

+4594
-1289
lines changed

config/v1alpha1/types_insights.go

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ type GatherConfig struct {
7474
type DisabledGatherer string
7575

7676
// storageSpec provides persistent storage configuration options for on-demand gathering jobs.
77+
// If the type is set to PersistentVolumeClaim, then the PersistentVolume must be defined.
78+
// If the type is set to Ephemeral, then the PersistentVolume must not be defined.
7779
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'PersistentVolumeClaim' ? has(self.persistentVolume) : !has(self.persistentVolume)",message="persistentVolume is required when type is PersistentVolumeClaim, and forbidden otherwise"
7880
type StorageSpec struct {
7981
// type is a required field that specifies the type of storage that will be used to store the Insights data archive.

config/v1alpha1/zz_generated.deepcopy.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/v1alpha1/zz_generated.swagger_doc_generated.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

insights/v1alpha1/tests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ tests:
165165
insightsRequestID: xyz
166166
startTime: 2023-03-13T12:34:06Z
167167
expectedStatusError: 'Invalid value: "string": startTime is immutable once set'
168-
- name: Status is presentt and insightsRequestID is added
168+
- name: Status is present and insightsRequestID is added
169169
initial: |
170170
apiVersion: insights.openshift.io/v1alpha1
171171
kind: DataGather

insights/v1alpha1/types_insights.go

+29-14
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ type DataGatherSpec struct {
4545
// The current default is ClearText.
4646
// +optional
4747
DataPolicy DataPolicy `json:"dataPolicy"`
48-
// gatherers is a list of gatherers configurations.
48+
// gatherers is an optional list of gatherers configurations.
49+
// The list must not exceed 100 items.
4950
// The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
5051
// Run the following command to get the names of last active gatherers:
5152
// "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
@@ -60,6 +61,8 @@ type DataGatherSpec struct {
6061
}
6162

6263
// storageSpec provides persistent storage configuration options for on-demand gathering jobs.
64+
// If the type is set to PersistentVolumeClaim, then the PersistentVolume must be defined.
65+
// If the type is set to Ephemeral, then the PersistentVolume must not be defined.
6366
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'PersistentVolumeClaim' ? has(self.persistentVolume) : !has(self.persistentVolume)",message="persistentVolume is required when type is PersistentVolumeClaim, and forbidden otherwise"
6467
type StorageSpec struct {
6568
// type is a required field that specifies the type of storage that will be used to store the Insights data archive.
@@ -138,8 +141,14 @@ type GathererState string
138141

139142
// gathererConfig allows to configure specific gatherers
140143
type GathererConfig struct {
141-
// name is the name of specific gatherer
144+
// name is the required name of specific gatherer
145+
// It must be at most 256 characters in length.
146+
// The format for the gatherer name should be: {gatherer}/{function} where the function is optional.
147+
// Gatherer consists of a lowercase string that may include underscores (_).
148+
// Function consists of a lowercase string that may include underscores (_) and is separated from the gatherer by a forward slash (/).
149+
// The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
142150
// +kubebuilder:validation:MaxLength=256
151+
// +kubebuilder:validation:XValidation:rule=`self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$")`,message=`gatherer name must be in the format of {gatherer}/{function} where the gatherer and function are lowercase strings that may include underscores (_) and are separated by a forward slash (/) if the function is provided`
143152
// +required
144153
Name string `json:"name"`
145154
// state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted.
@@ -247,8 +256,9 @@ type InsightsReport struct {
247256
// +kubebuilder:validation:MaxItems=100
248257
// +optional
249258
HealthChecks []HealthCheck `json:"healthChecks,omitempty"`
250-
// uri provides the URL link from which the report was downloaded.
251-
// +kubebuilder:validation:Pattern=`^https:\/\/\S+`
259+
// uri is optional field that provides the URL link from which the report was downloaded.
260+
// The link must be a valid HTTPS URL and the maximum length is 2048 characters.
261+
// +kubebuilder:validation:XValidation:rule=`self.matches("^https://[^\\s]+")`,message=`URI must be a valid HTTPS URL (e.g., https://example.com)`
252262
// +kubebuilder:validation:MaxLength=2048
253263
// +optional
254264
URI string `json:"uri,omitempty"`
@@ -268,8 +278,9 @@ type HealthCheck struct {
268278
// +kubebuilder:validation:Minimum=1
269279
// +kubebuilder:validation:Maximum=4
270280
TotalRisk int32 `json:"totalRisk"`
271-
// advisorURI provides the URL link to the Insights Advisor.
272-
// +kubebuilder:validation:Pattern=`^https:\/\/\S+`
281+
// advisorURI is required field that provides the URL link to the Insights Advisor.
282+
// The link must be a valid HTTPS URL and the maximum length is 2048 characters.
283+
// +kubebuilder:validation:XValidation:rule=`self.matches("^https://[^\\s]+")`,message=`advisorURI must be a valid HTTPS URL (e.g., https://example.com)`
273284
// +kubebuilder:validation:MaxLength=2048
274285
// +required
275286
AdvisorURI string `json:"advisorURI"`
@@ -296,26 +307,30 @@ const (
296307
type ObjectReference struct {
297308
// group is the API Group of the Resource.
298309
// Enter empty string for the core group.
299-
// This value should consist of only lowercase alphanumeric characters, hyphens and periods.
310+
// This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length.
300311
// Example: "", "apps", "build.openshift.io", etc.
301-
// +kubebuilder:validation:Pattern:="^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
302-
// +kubebuilder:validation:MaxLength=512
312+
// +kubebuilder:validation:XValidation:rule="self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character."
313+
// +kubebuilder:validation:MaxLength:=253
303314
// +required
304315
Group string `json:"group"`
305-
// resource is the type that is being referenced.
316+
// resource is required field of the type that is being referenced.
306317
// It is normally the plural form of the resource kind in lowercase.
307318
// This value should consist of only lowercase alphanumeric characters and hyphens.
308319
// Example: "deployments", "deploymentconfigs", "pods", etc.
309-
// +kubebuilder:validation:Pattern:="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
320+
// +kubebuilder:validation:XValidation:rule=`self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")`,message=`resource must consist of only lowercase alphanumeric characters and hyphens`
310321
// +kubebuilder:validation:MaxLength=512
311322
// +required
312323
Resource string `json:"resource"`
313-
// name of the referent.
324+
// name of the referent that follows the DNS1123 subdomain format.
325+
// It must be at most 256 characters in length.
326+
// +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character."
314327
// +kubebuilder:validation:MaxLength=256
315328
// +required
316329
Name string `json:"name"`
317-
// namespace of the referent.
318-
// +kubebuilder:validation:MaxLength=512
330+
// namespace of the referent that follows the DNS1123 subdomain format.
331+
// It must be at most 256 characters in length.
332+
// +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character."
333+
// +kubebuilder:validation:MaxLength=253
319334
// +optional
320335
Namespace string `json:"namespace,omitempty"`
321336
}

insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-CustomNoUpgrade.crd.yaml

+56-16
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,30 @@ spec:
7373
type: string
7474
gatherers:
7575
description: |-
76-
gatherers is a list of gatherers configurations.
76+
gatherers is an optional list of gatherers configurations.
77+
The list must not exceed 100 items.
7778
The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
7879
Run the following command to get the names of last active gatherers:
7980
"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
8081
items:
8182
description: gathererConfig allows to configure specific gatherers
8283
properties:
8384
name:
84-
description: name is the name of specific gatherer
85+
description: |-
86+
name is the required name of specific gatherer
87+
It must be at most 256 characters in length.
88+
The format for the gatherer name should be: {gatherer}/{function} where the function is optional.
89+
Gatherer consists of a lowercase string that may include underscores (_).
90+
Function consists of a lowercase string that may include underscores (_) and is separated from the gatherer by a forward slash (/).
91+
The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
8592
maxLength: 256
8693
type: string
94+
x-kubernetes-validations:
95+
- message: gatherer name must be in the format of {gatherer}/{function}
96+
where the gatherer and function are lowercase strings that
97+
may include underscores (_) and are separated by a forward
98+
slash (/) if the function is provided
99+
rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$")
87100
state:
88101
description: |-
89102
state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted.
@@ -366,11 +379,14 @@ spec:
366379
attributes.
367380
properties:
368381
advisorURI:
369-
description: advisorURI provides the URL link to the Insights
370-
Advisor.
382+
description: |-
383+
advisorURI is required field that provides the URL link to the Insights Advisor.
384+
The link must be a valid HTTPS URL and the maximum length is 2048 characters.
371385
maxLength: 2048
372-
pattern: ^https:\/\/\S+
373386
type: string
387+
x-kubernetes-validations:
388+
- message: advisorURI must be a valid HTTPS URL (e.g., https://example.com)
389+
rule: self.matches("^https://[^\\s]+")
374390
description:
375391
description: description provides basic description of the
376392
healtcheck.
@@ -405,11 +421,14 @@ spec:
405421
type: array
406422
x-kubernetes-list-type: atomic
407423
uri:
408-
description: uri provides the URL link from which the report was
409-
downloaded.
424+
description: |-
425+
uri is optional field that provides the URL link from which the report was downloaded.
426+
The link must be a valid HTTPS URL and the maximum length is 2048 characters.
410427
maxLength: 2048
411-
pattern: ^https:\/\/\S+
412428
type: string
429+
x-kubernetes-validations:
430+
- message: URI must be a valid HTTPS URL (e.g., https://example.com)
431+
rule: self.matches("^https://[^\\s]+")
413432
type: object
414433
insightsRequestID:
415434
description: |-
@@ -432,28 +451,49 @@ spec:
432451
description: |-
433452
group is the API Group of the Resource.
434453
Enter empty string for the core group.
435-
This value should consist of only lowercase alphanumeric characters, hyphens and periods.
454+
This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length.
436455
Example: "", "apps", "build.openshift.io", etc.
437-
maxLength: 512
438-
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
456+
maxLength: 253
439457
type: string
458+
x-kubernetes-validations:
459+
- message: a lowercase RFC 1123 subdomain must consist of lower
460+
case alphanumeric characters, '-' or '.', and must start
461+
and end with an alphanumeric character.
462+
rule: self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue()
440463
name:
441-
description: name of the referent.
464+
description: |-
465+
name of the referent that follows the DNS1123 subdomain format.
466+
It must be at most 256 characters in length.
442467
maxLength: 256
443468
type: string
469+
x-kubernetes-validations:
470+
- message: a lowercase RFC 1123 subdomain must consist of lower
471+
case alphanumeric characters, '-' or '.', and must start
472+
and end with an alphanumeric character.
473+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
444474
namespace:
445-
description: namespace of the referent.
446-
maxLength: 512
475+
description: |-
476+
namespace of the referent that follows the DNS1123 subdomain format.
477+
It must be at most 256 characters in length.
478+
maxLength: 253
447479
type: string
480+
x-kubernetes-validations:
481+
- message: a lowercase RFC 1123 subdomain must consist of lower
482+
case alphanumeric characters, '-' or '.', and must start
483+
and end with an alphanumeric character.
484+
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
448485
resource:
449486
description: |-
450-
resource is the type that is being referenced.
487+
resource is required field of the type that is being referenced.
451488
It is normally the plural form of the resource kind in lowercase.
452489
This value should consist of only lowercase alphanumeric characters and hyphens.
453490
Example: "deployments", "deploymentconfigs", "pods", etc.
454491
maxLength: 512
455-
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
456492
type: string
493+
x-kubernetes-validations:
494+
- message: resource must consist of only lowercase alphanumeric
495+
characters and hyphens
496+
rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
457497
required:
458498
- group
459499
- name

0 commit comments

Comments
 (0)