Skip to content

Commit 1d4bc48

Browse files
committed
fix: linter errors
Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 404c0c3 commit 1d4bc48

18 files changed

+189
-160
lines changed

config/v1/types_insights.go

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@ type InsightsDataGather struct {
2525
metav1.ObjectMeta `json:"metadata,omitempty"`
2626
// spec holds user settable values for configuration
2727
// +required
28-
Spec InsightsDataGatherSpec `json:"spec"`
28+
Spec InsightsDataGatherSpec `json:"spec,omitempty,omitzero"`
2929
// status holds observed values from the cluster. They may not be overridden.
3030
// +optional
31-
Status InsightsDataGatherStatus `json:"status"`
31+
Status InsightsDataGatherStatus `json:"status,omitempty,omitzero"`
3232
}
3333

34+
// InsightsDataGatherSpec contains the configuration for the data gathering.
35+
// +kubebuilder:validation:MinProperties=1
3436
type InsightsDataGatherSpec struct {
3537
// 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.
3638
// +optional
37-
GatherConfig GatherConfig `json:"gatherConfig"`
39+
GatherConfig GatherConfig `json:"gatherConfig,omitempty,omitzero"`
3840
}
3941

42+
// +kubebuilder:validation:MinProperties=1
4043
type InsightsDataGatherStatus struct{}
4144

4245
// gatherConfig provides data gathering configuration options.
@@ -47,18 +50,19 @@ type GatherConfig struct {
4750
// When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated.
4851
// When set to WorkloadNames, the gathered data about cluster resources will not contain the workload names for your deployments. Resources UIDs will be used instead.
4952
// When omitted no obfuscation is applied.
53+
// +kubebuilder:validation:MinItems=0
5054
// +kubebuilder:validation:MaxItems=2
5155
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="dataPolicy items must be unique"
5256
// +listType=atomic
5357
// +optional
54-
DataPolicy []DataPolicyOption `json:"dataPolicy"`
58+
DataPolicy []DataPolicyOption `json:"dataPolicy,omitempty"`
5559
// gatherers is a required field that specifies the configuration of the gatherers.
5660
// +required
57-
Gatherers Gatherers `json:"gatherers"`
61+
Gatherers Gatherers `json:"gatherers,omitempty,omitzero"`
5862
// storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive.
5963
// If omitted, the gathering job will use ephemeral storage.
6064
// +optional
61-
Storage *Storage `json:"storage,omitempty"`
65+
Storage Storage `json:"storage,omitempty,omitzero"`
6266
}
6367

6468
// +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"
@@ -68,13 +72,13 @@ type Gatherers struct {
6872
// When set to None, all gatherers will be disabled and no data will be gathered.
6973
// When set to Custom, the custom configuration from the custom field will be applied.
7074
// +required
71-
Mode GatheringMode `json:"mode"`
75+
Mode GatheringMode `json:"mode,omitempty"`
7276
// custom provides gathering configuration.
7377
// It is required when mode is Custom, and forbidden otherwise.
7478
// Custom configuration allows user to disable only a subset of gatherers.
7579
// Gatherers that are not explicitly disabled in custom configuration will run.
7680
// +optional
77-
Custom *Custom `json:"custom,omitempty"`
81+
Custom Custom `json:"custom,omitempty,omitzero"`
7882
}
7983

8084
// custom provides the custom configuration of gatherers
@@ -85,11 +89,12 @@ type Custom struct {
8589
// The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
8690
// Run the following command to get the names of last active gatherers:
8791
// "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
92+
// +kubebuilder:validation:MinItems=1
8893
// +kubebuilder:validation:MaxItems=100
8994
// +listType=map
9095
// +listMapKey=name
9196
// +required
92-
Configs []GathererConfig `json:"configs"`
97+
Configs []GathererConfig `json:"configs,omitempty"`
9398
}
9499

95100
// gatheringMode defines the valid gathering modes.
@@ -126,11 +131,11 @@ type Storage struct {
126131
// When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job.
127132
// When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.
128133
// +required
129-
Type StorageType `json:"type"`
134+
Type StorageType `json:"type,omitempty"`
130135
// persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive.
131136
// The PersistentVolume must be created in the openshift-insights namespace.
132137
// +optional
133-
PersistentVolume *PersistentVolumeConfig `json:"persistentVolume,omitempty"`
138+
PersistentVolume PersistentVolumeConfig `json:"persistentVolume,omitempty,omitzero"`
134139
}
135140

136141
// storageType declares valid storage types
@@ -149,11 +154,12 @@ type PersistentVolumeConfig struct {
149154
// claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive.
150155
// The PersistentVolumeClaim must be created in the openshift-insights namespace.
151156
// +required
152-
Claim PersistentVolumeClaimReference `json:"claim"`
157+
Claim PersistentVolumeClaimReference `json:"claim,omitempty,omitzero"`
153158
// mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod.
154159
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
155160
// The current default mount path is /var/lib/insights-operator
156161
// The path may not exceed 1024 characters and must not contain a colon.
162+
// +kubebuilder:validation:MinLength=1
157163
// +kubebuilder:validation:MaxLength=1024
158164
// +kubebuilder:validation:XValidation:rule="!self.contains(':')",message="mountPath must not contain a colon"
159165
// +optional
@@ -165,9 +171,10 @@ type PersistentVolumeClaimReference struct {
165171
// name is a string that follows the DNS1123 subdomain format.
166172
// 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.
167173
// +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."
168-
// +kubebuilder:validation:MaxLength:=253
174+
// +kubebuilder:validation:MinLength=1
175+
// +kubebuilder:validation:MaxLength=253
169176
// +required
170-
Name string `json:"name"`
177+
Name string `json:"name,omitempty"`
171178
}
172179

173180
// gathererConfig allows to configure specific gatherers
@@ -180,15 +187,16 @@ type GathererConfig struct {
180187
// The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
181188
// Run the following command to get the names of last active gatherers:
182189
// "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
190+
// +kubebuilder:validation:MinLength=1
183191
// +kubebuilder:validation:MaxLength=256
184192
// +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 letters only that may include underscores (_) and are separated by a forward slash (/) if the function is provided`
185193
// +required
186-
Name string `json:"name"`
194+
Name string `json:"name,omitempty"`
187195
// state is a required field that allows you to configure specific gatherer. Valid values are "Enabled" and "Disabled".
188196
// When set to Enabled the gatherer will run.
189197
// When set to Disabled the gatherer will not run.
190198
// +required
191-
State GathererState `json:"state"`
199+
State GathererState `json:"state,omitempty"`
192200
}
193201

194202
// state declares valid gatherer state types.
@@ -212,10 +220,11 @@ type InsightsDataGatherList struct {
212220
// metadata is the required standard list's metadata.
213221
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
214222
// +required
215-
metav1.ListMeta `json:"metadata"`
223+
metav1.ListMeta `json:"metadata,omitempty"`
216224
// items is the required list of InsightsDataGather objects
217225
// it may not exceed 100 items
226+
// +kubebuilder:validation:MinItems=0
218227
// +kubebuilder:validation:MaxItems=100
219228
// +required
220-
Items []InsightsDataGather `json:"items"`
229+
Items []InsightsDataGather `json:"items,omitempty"`
221230
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
type: object
4545
spec:
4646
description: spec holds user settable values for configuration
47+
minProperties: 1
4748
properties:
4849
gatherConfig:
4950
description: gatherConfig is an optional spec attribute that includes
@@ -193,7 +194,7 @@ spec:
193194
The current default mount path is /var/lib/insights-operator
194195
The path may not exceed 1024 characters and must not contain a colon.
195196
maxLength: 1024
196-
minLength: 0
197+
minLength: 1
197198
type: string
198199
x-kubernetes-validations:
199200
- message: mountPath must not contain a colon
@@ -226,6 +227,7 @@ spec:
226227
status:
227228
description: status holds observed values from the cluster. They may not
228229
be overridden.
230+
minProperties: 1
229231
type: object
230232
required:
231233
- spec

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
type: object
4545
spec:
4646
description: spec holds user settable values for configuration
47+
minProperties: 1
4748
properties:
4849
gatherConfig:
4950
description: gatherConfig is an optional spec attribute that includes
@@ -193,7 +194,7 @@ spec:
193194
The current default mount path is /var/lib/insights-operator
194195
The path may not exceed 1024 characters and must not contain a colon.
195196
maxLength: 1024
196-
minLength: 0
197+
minLength: 1
197198
type: string
198199
x-kubernetes-validations:
199200
- message: mountPath must not contain a colon
@@ -226,6 +227,7 @@ spec:
226227
status:
227228
description: status holds observed values from the cluster. They may not
228229
be overridden.
230+
minProperties: 1
229231
type: object
230232
required:
231233
- spec

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
type: object
4545
spec:
4646
description: spec holds user settable values for configuration
47+
minProperties: 1
4748
properties:
4849
gatherConfig:
4950
description: gatherConfig is an optional spec attribute that includes
@@ -193,7 +194,7 @@ spec:
193194
The current default mount path is /var/lib/insights-operator
194195
The path may not exceed 1024 characters and must not contain a colon.
195196
maxLength: 1024
196-
minLength: 0
197+
minLength: 1
197198
type: string
198199
x-kubernetes-validations:
199200
- message: mountPath must not contain a colon
@@ -226,6 +227,7 @@ spec:
226227
status:
227228
description: status holds observed values from the cluster. They may not
228229
be overridden.
230+
minProperties: 1
229231
type: object
230232
required:
231233
- spec

config/v1/zz_generated.deepcopy.go

Lines changed: 3 additions & 15 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/insightsdatagathers.config.openshift.io/InsightsConfig.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
type: object
4545
spec:
4646
description: spec holds user settable values for configuration
47+
minProperties: 1
4748
properties:
4849
gatherConfig:
4950
description: gatherConfig is an optional spec attribute that includes
@@ -193,7 +194,7 @@ spec:
193194
The current default mount path is /var/lib/insights-operator
194195
The path may not exceed 1024 characters and must not contain a colon.
195196
maxLength: 1024
196-
minLength: 0
197+
minLength: 1
197198
type: string
198199
x-kubernetes-validations:
199200
- message: mountPath must not contain a colon
@@ -226,6 +227,7 @@ spec:
226227
status:
227228
description: status holds observed values from the cluster. They may not
228229
be overridden.
230+
minProperties: 1
229231
type: object
230232
required:
231233
- spec

config/v1/zz_generated.swagger_doc_generated.go

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

0 commit comments

Comments
 (0)