Skip to content

Commit 596ed30

Browse files
committed
feat: address review comments
Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 43fc93f commit 596ed30

23 files changed

+466
-305
lines changed

config/v1/tests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ tests:
272272
configs:
273273
- name: gatherer
274274
state: InvalidState
275-
expectedError: 'spec.gatherConfig.gatherers.custom.configs[0].state: Unsupported value: "InvalidState": supported values: "Enabled", "Disabled", <nil>:'
275+
expectedError: 'spec.gatherConfig.gatherers.custom.configs[0].state: Unsupported value: "InvalidState": supported values: "Enabled", "Disabled"'
276276
- name: dataPolicy must be one of the valid values
277277
initial: |
278278
apiVersion: config.openshift.io/v1
@@ -283,7 +283,7 @@ tests:
283283
mode: All
284284
dataPolicy:
285285
- InvalidPolicy
286-
expectedError: 'spec.gatherConfig.dataPolicy[0]: Unsupported value: "InvalidPolicy": supported values: "ObfuscateNetworking", "WorkloadNames", <nil>'
286+
expectedError: 'spec.gatherConfig.dataPolicy[0]: Unsupported value: "InvalidPolicy": supported values: "ObfuscateNetworking", "WorkloadNames"'
287287
- name: mode must have a valid value
288288
initial: |
289289
apiVersion: config.openshift.io/v1
@@ -292,7 +292,7 @@ tests:
292292
gatherConfig:
293293
gatherers:
294294
mode: InvalidMode
295-
expectedError: 'spec.gatherConfig.gatherers.mode: Unsupported value: "InvalidMode": supported values: "All", "None", "Custom", <nil>'
295+
expectedError: 'spec.gatherConfig.gatherers.mode: Unsupported value: "InvalidMode": supported values: "All", "None", "Custom"'
296296
- name: mode set to Custom must have gatherers present
297297
initial: |
298298
apiVersion: config.openshift.io/v1

config/v1/types_insights.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
//
1111
// +kubebuilder:object:root=true
1212
// +kubebuilder:resource:path=insightsdatagathers,scope=Cluster
13-
// +kubebuilder:subresource:status
14-
// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/2195
13+
// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/2448
1514
// +openshift:file-pattern=cvoRunLevel=0000_10,operatorName=config-operator,operatorOrdering=01
1615
// +openshift:enable:FeatureGate=InsightsConfig
1716
//
@@ -26,21 +25,15 @@ type InsightsDataGather struct {
2625
// spec holds user settable values for configuration
2726
// +required
2827
Spec InsightsDataGatherSpec `json:"spec,omitempty,omitzero"`
29-
// status holds observed values from the cluster. They may not be overridden.
30-
// +optional
31-
Status InsightsDataGatherStatus `json:"status,omitempty,omitzero"`
3228
}
3329

3430
// InsightsDataGatherSpec contains the configuration for the data gathering.
3531
type InsightsDataGatherSpec struct {
36-
// gatherConfig is an optional spec attribute that includes all the configuration options related to gathering of the Insights data and its uploading to the ingress.
32+
// gatherConfig is a required spec attribute that includes all the configuration options related to gathering of the Insights data and its uploading to the ingress.
3733
// +required
3834
GatherConfig GatherConfig `json:"gatherConfig,omitempty,omitzero"`
3935
}
4036

41-
// +kubebuilder:validation:MinProperties=1
42-
type InsightsDataGatherStatus struct{}
43-
4437
// gatherConfig provides data gathering configuration options.
4538
type GatherConfig struct {
4639
// dataPolicy is an optional list of DataPolicyOptions that allows user to enable additional obfuscation of the Insights archive data.
@@ -65,17 +58,20 @@ type GatherConfig struct {
6558
}
6659

6760
// +kubebuilder:validation:XValidation:rule="has(self.mode) && self.mode == 'Custom' ? has(self.custom) : !has(self.custom)",message="custom is required when mode is Custom, and forbidden otherwise"
61+
// +union
6862
type Gatherers struct {
6963
// mode is a required field that specifies the mode for gatherers. Allowed values are All, None, and Custom.
7064
// When set to All, all gatherers wil run and gather data.
7165
// When set to None, all gatherers will be disabled and no data will be gathered.
7266
// When set to Custom, the custom configuration from the custom field will be applied.
67+
// +unionDiscriminator
7368
// +required
7469
Mode GatheringMode `json:"mode,omitempty"`
7570
// custom provides gathering configuration.
7671
// It is required when mode is Custom, and forbidden otherwise.
7772
// Custom configuration allows user to disable only a subset of gatherers.
7873
// Gatherers that are not explicitly disabled in custom configuration will run.
74+
// +unionMember
7975
// +optional
8076
Custom Custom `json:"custom,omitempty,omitzero"`
8177
}
@@ -124,15 +120,18 @@ const (
124120
// If the type is set to PersistentVolume, then the PersistentVolume must be defined.
125121
// If the type is set to Ephemeral, then the PersistentVolume must not be defined.
126122
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'PersistentVolume' ? has(self.persistentVolume) : !has(self.persistentVolume)",message="persistentVolume is required when type is PersistentVolume, and forbidden otherwise"
123+
// +union
127124
type Storage struct {
128125
// type is a required field that specifies the type of storage that will be used to store the Insights data archive.
129126
// Valid values are "PersistentVolume" and "Ephemeral".
130127
// When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job.
131128
// When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.
129+
// +unionDiscriminator
132130
// +required
133131
Type StorageType `json:"type,omitempty"`
134132
// persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive.
135133
// The PersistentVolume must be created in the openshift-insights namespace.
134+
// +unionMember
136135
// +optional
137136
PersistentVolume PersistentVolumeConfig `json:"persistentVolume,omitempty,omitzero"`
138137
}
@@ -167,7 +166,8 @@ type PersistentVolumeConfig struct {
167166

168167
// persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.
169168
type PersistentVolumeClaimReference struct {
170-
// name is a string that follows the DNS1123 subdomain format.
169+
// name is the name of the PersistentVolumeClaim that will be used to store the Insights data archive.
170+
// It is a string that follows the DNS1123 subdomain format.
171171
// It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.
172172
// +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."
173173
// +kubebuilder:validation:MinLength=1
@@ -178,7 +178,7 @@ type PersistentVolumeClaimReference struct {
178178

179179
// gathererConfig allows to configure specific gatherers
180180
type GathererConfig struct {
181-
// name is the required name of a specific gatherer
181+
// name is the required name of a specific gatherer.
182182
// It may not exceed 256 characters.
183183
// The format for a gatherer name is: {gatherer}/{function} where the function is optional.
184184
// Gatherer consists of a lowercase letters only that may include underscores (_).

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-CustomNoUpgrade.crd.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
api-approved.openshift.io: https://github.com/openshift/api/pull/2195
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/2448
66
api.openshift.io/merged-by-featuregates: "true"
77
include.release.openshift.io/ibm-cloud-managed: "true"
88
include.release.openshift.io/self-managed-high-availability: "true"
@@ -46,7 +46,7 @@ spec:
4646
description: spec holds user settable values for configuration
4747
properties:
4848
gatherConfig:
49-
description: gatherConfig is an optional spec attribute that includes
49+
description: gatherConfig is a required spec attribute that includes
5050
all the configuration options related to gathering of the Insights
5151
data and its uploading to the ingress.
5252
properties:
@@ -96,7 +96,7 @@ spec:
9696
properties:
9797
name:
9898
description: |-
99-
name is the required name of a specific gatherer
99+
name is the required name of a specific gatherer.
100100
It may not exceed 256 characters.
101101
The format for a gatherer name is: {gatherer}/{function} where the function is optional.
102102
Gatherer consists of a lowercase letters only that may include underscores (_).
@@ -172,7 +172,8 @@ spec:
172172
properties:
173173
name:
174174
description: |-
175-
name is a string that follows the DNS1123 subdomain format.
175+
name is the name of the PersistentVolumeClaim that will be used to store the Insights data archive.
176+
It is a string that follows the DNS1123 subdomain format.
176177
It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.
177178
maxLength: 253
178179
minLength: 1
@@ -225,15 +226,8 @@ spec:
225226
required:
226227
- gatherConfig
227228
type: object
228-
status:
229-
description: status holds observed values from the cluster. They may not
230-
be overridden.
231-
minProperties: 1
232-
type: object
233229
required:
234230
- spec
235231
type: object
236232
served: true
237233
storage: true
238-
subresources:
239-
status: {}

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-DevPreviewNoUpgrade.crd.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
api-approved.openshift.io: https://github.com/openshift/api/pull/2195
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/2448
66
api.openshift.io/merged-by-featuregates: "true"
77
include.release.openshift.io/ibm-cloud-managed: "true"
88
include.release.openshift.io/self-managed-high-availability: "true"
@@ -46,7 +46,7 @@ spec:
4646
description: spec holds user settable values for configuration
4747
properties:
4848
gatherConfig:
49-
description: gatherConfig is an optional spec attribute that includes
49+
description: gatherConfig is a required spec attribute that includes
5050
all the configuration options related to gathering of the Insights
5151
data and its uploading to the ingress.
5252
properties:
@@ -96,7 +96,7 @@ spec:
9696
properties:
9797
name:
9898
description: |-
99-
name is the required name of a specific gatherer
99+
name is the required name of a specific gatherer.
100100
It may not exceed 256 characters.
101101
The format for a gatherer name is: {gatherer}/{function} where the function is optional.
102102
Gatherer consists of a lowercase letters only that may include underscores (_).
@@ -172,7 +172,8 @@ spec:
172172
properties:
173173
name:
174174
description: |-
175-
name is a string that follows the DNS1123 subdomain format.
175+
name is the name of the PersistentVolumeClaim that will be used to store the Insights data archive.
176+
It is a string that follows the DNS1123 subdomain format.
176177
It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.
177178
maxLength: 253
178179
minLength: 1
@@ -225,15 +226,8 @@ spec:
225226
required:
226227
- gatherConfig
227228
type: object
228-
status:
229-
description: status holds observed values from the cluster. They may not
230-
be overridden.
231-
minProperties: 1
232-
type: object
233229
required:
234230
- spec
235231
type: object
236232
served: true
237233
storage: true
238-
subresources:
239-
status: {}

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-TechPreviewNoUpgrade.crd.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
api-approved.openshift.io: https://github.com/openshift/api/pull/2195
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/2448
66
api.openshift.io/merged-by-featuregates: "true"
77
include.release.openshift.io/ibm-cloud-managed: "true"
88
include.release.openshift.io/self-managed-high-availability: "true"
@@ -46,7 +46,7 @@ spec:
4646
description: spec holds user settable values for configuration
4747
properties:
4848
gatherConfig:
49-
description: gatherConfig is an optional spec attribute that includes
49+
description: gatherConfig is a required spec attribute that includes
5050
all the configuration options related to gathering of the Insights
5151
data and its uploading to the ingress.
5252
properties:
@@ -96,7 +96,7 @@ spec:
9696
properties:
9797
name:
9898
description: |-
99-
name is the required name of a specific gatherer
99+
name is the required name of a specific gatherer.
100100
It may not exceed 256 characters.
101101
The format for a gatherer name is: {gatherer}/{function} where the function is optional.
102102
Gatherer consists of a lowercase letters only that may include underscores (_).
@@ -172,7 +172,8 @@ spec:
172172
properties:
173173
name:
174174
description: |-
175-
name is a string that follows the DNS1123 subdomain format.
175+
name is the name of the PersistentVolumeClaim that will be used to store the Insights data archive.
176+
It is a string that follows the DNS1123 subdomain format.
176177
It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.
177178
maxLength: 253
178179
minLength: 1
@@ -225,15 +226,8 @@ spec:
225226
required:
226227
- gatherConfig
227228
type: object
228-
status:
229-
description: status holds observed values from the cluster. They may not
230-
be overridden.
231-
minProperties: 1
232-
type: object
233229
required:
234230
- spec
235231
type: object
236232
served: true
237233
storage: true
238-
subresources:
239-
status: {}

config/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/v1/zz_generated.featuregated-crd-manifests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ ingresses.config.openshift.io:
410410

411411
insightsdatagathers.config.openshift.io:
412412
Annotations: {}
413-
ApprovedPRNumber: https://github.com/openshift/api/pull/2195
413+
ApprovedPRNumber: https://github.com/openshift/api/pull/2448
414414
CRDName: insightsdatagathers.config.openshift.io
415415
Capability: ""
416416
Category: ""
@@ -420,7 +420,7 @@ insightsdatagathers.config.openshift.io:
420420
FilenameOperatorOrdering: "01"
421421
FilenameRunLevel: "0000_10"
422422
GroupName: config.openshift.io
423-
HasStatus: true
423+
HasStatus: false
424424
KindName: InsightsDataGather
425425
Labels: {}
426426
PluralName: insightsdatagathers

config/v1/zz_generated.featuregated-crd-manifests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
api-approved.openshift.io: https://github.com/openshift/api/pull/2195
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/2448
66
api.openshift.io/filename-cvo-runlevel: "0000_10"
77
api.openshift.io/filename-operator: config-operator
88
api.openshift.io/filename-ordering: "01"
@@ -46,7 +46,7 @@ spec:
4646
description: spec holds user settable values for configuration
4747
properties:
4848
gatherConfig:
49-
description: gatherConfig is an optional spec attribute that includes
49+
description: gatherConfig is a required spec attribute that includes
5050
all the configuration options related to gathering of the Insights
5151
data and its uploading to the ingress.
5252
properties:
@@ -96,7 +96,7 @@ spec:
9696
properties:
9797
name:
9898
description: |-
99-
name is the required name of a specific gatherer
99+
name is the required name of a specific gatherer.
100100
It may not exceed 256 characters.
101101
The format for a gatherer name is: {gatherer}/{function} where the function is optional.
102102
Gatherer consists of a lowercase letters only that may include underscores (_).
@@ -172,7 +172,8 @@ spec:
172172
properties:
173173
name:
174174
description: |-
175-
name is a string that follows the DNS1123 subdomain format.
175+
name is the name of the PersistentVolumeClaim that will be used to store the Insights data archive.
176+
It is a string that follows the DNS1123 subdomain format.
176177
It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.
177178
maxLength: 253
178179
minLength: 1
@@ -225,15 +226,8 @@ spec:
225226
required:
226227
- gatherConfig
227228
type: object
228-
status:
229-
description: status holds observed values from the cluster. They may not
230-
be overridden.
231-
minProperties: 1
232-
type: object
233229
required:
234230
- spec
235231
type: object
236232
served: true
237233
storage: true
238-
subresources:
239-
status: {}

0 commit comments

Comments
 (0)