Skip to content

Commit 337fbf2

Browse files
committed
fix: linter errors
Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 97f2057 commit 337fbf2

16 files changed

+158
-121
lines changed

config/v1/types_insights.go

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ 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

4042
type InsightsDataGatherStatus struct{}
@@ -47,18 +49,19 @@ type GatherConfig struct {
4749
// When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated.
4850
// 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.
4951
// When omitted no obfuscation is applied.
52+
// +kubebuilder:validation:MinItems=0
5053
// +kubebuilder:validation:MaxItems=2
5154
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="dataPolicy items must be unique"
5255
// +listType=atomic
5356
// +optional
54-
DataPolicy []DataPolicyOption `json:"dataPolicy"`
57+
DataPolicy []DataPolicyOption `json:"dataPolicy,omitempty"`
5558
// gatherers is a required field that specifies the configuration of the gatherers.
5659
// +required
57-
Gatherers Gatherers `json:"gatherers"`
60+
Gatherers Gatherers `json:"gatherers,omitempty,omitzero"`
5861
// storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive.
5962
// If omitted, the gathering job will use ephemeral storage.
6063
// +optional
61-
Storage *Storage `json:"storage,omitempty"`
64+
Storage *Storage `json:"storage,omitempty,omitzero"`
6265
}
6366

6467
// +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 +71,13 @@ type Gatherers struct {
6871
// When set to None, all gatherers will be disabled and no data will be gathered.
6972
// When set to Custom, the custom configuration from the custom field will be applied.
7073
// +required
71-
Mode GatheringMode `json:"mode"`
74+
Mode GatheringMode `json:"mode,omitempty"`
7275
// custom provides gathering configuration.
7376
// It is required when mode is Custom, and forbidden otherwise.
7477
// Custom configuration allows user to disable only a subset of gatherers.
7578
// Gatherers that are not explicitly disabled in custom configuration will run.
7679
// +optional
77-
Custom *Custom `json:"custom,omitempty"`
80+
Custom *Custom `json:"custom,omitempty,omitzero"`
7881
}
7982

8083
// custom provides the custom configuration of gatherers
@@ -85,11 +88,12 @@ type Custom struct {
8588
// The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
8689
// Run the following command to get the names of last active gatherers:
8790
// "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
91+
// +kubebuilder:validation:MinItems=1
8892
// +kubebuilder:validation:MaxItems=100
8993
// +listType=map
9094
// +listMapKey=name
9195
// +required
92-
Configs []GathererConfig `json:"configs"`
96+
Configs []GathererConfig `json:"configs,omitempty"`
9397
}
9498

9599
// gatheringMode defines the valid gathering modes.
@@ -126,11 +130,11 @@ type Storage struct {
126130
// When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job.
127131
// When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.
128132
// +required
129-
Type StorageType `json:"type"`
133+
Type StorageType `json:"type,omitempty"`
130134
// persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive.
131135
// The PersistentVolume must be created in the openshift-insights namespace.
132136
// +optional
133-
PersistentVolume *PersistentVolumeConfig `json:"persistentVolume,omitempty"`
137+
PersistentVolume *PersistentVolumeConfig `json:"persistentVolume,omitempty,omitzero"`
134138
}
135139

136140
// storageType declares valid storage types
@@ -149,25 +153,27 @@ type PersistentVolumeConfig struct {
149153
// claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive.
150154
// The PersistentVolumeClaim must be created in the openshift-insights namespace.
151155
// +required
152-
Claim PersistentVolumeClaimReference `json:"claim"`
156+
Claim PersistentVolumeClaimReference `json:"claim,omitempty,omitzero"`
153157
// mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod.
154158
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
155159
// The current default mount path is /var/lib/insights-operator
156160
// The path may not exceed 1024 characters and must not contain a colon.
161+
// +kubebuilder:validation:MinLength=0
157162
// +kubebuilder:validation:MaxLength=1024
158163
// +kubebuilder:validation:XValidation:rule="!self.contains(':')",message="mountPath must not contain a colon"
159164
// +optional
160-
MountPath string `json:"mountPath,omitempty"`
165+
MountPath *string `json:"mountPath,omitempty"`
161166
}
162167

163168
// persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.
164169
type PersistentVolumeClaimReference struct {
165170
// name is a string that follows the DNS1123 subdomain format.
166171
// 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.
167172
// +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
173+
// +kubebuilder:validation:MinLength=1
174+
// +kubebuilder:validation:MaxLength=253
169175
// +required
170-
Name string `json:"name"`
176+
Name string `json:"name,omitempty"`
171177
}
172178

173179
// gathererConfig allows to configure specific gatherers
@@ -180,15 +186,16 @@ type GathererConfig struct {
180186
// The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.
181187
// Run the following command to get the names of last active gatherers:
182188
// "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'"
189+
// +kubebuilder:validation:MinLength=1
183190
// +kubebuilder:validation:MaxLength=256
184191
// +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`
185192
// +required
186-
Name string `json:"name"`
193+
Name string `json:"name,omitempty"`
187194
// state is a required field that allows you to configure specific gatherer. Valid values are "Enabled" and "Disabled".
188195
// When set to Enabled the gatherer will run.
189196
// When set to Disabled the gatherer will not run.
190197
// +required
191-
State GathererState `json:"state"`
198+
State GathererState `json:"state,omitempty"`
192199
}
193200

194201
// state declares valid gatherer state types.
@@ -212,10 +219,11 @@ type InsightsDataGatherList struct {
212219
// metadata is the required standard list's metadata.
213220
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
214221
// +required
215-
metav1.ListMeta `json:"metadata"`
222+
metav1.ListMeta `json:"metadata,omitempty"`
216223
// items is the required list of InsightsDataGather objects
217224
// it may not exceed 100 items
225+
// +kubebuilder:validation:MinItems=0
218226
// +kubebuilder:validation:MaxItems=100
219227
// +required
220-
Items []InsightsDataGather `json:"items"`
228+
Items []InsightsDataGather `json:"items,omitempty"`
221229
}

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

Lines changed: 1 addition & 0 deletions
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

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

Lines changed: 1 addition & 0 deletions
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

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

Lines changed: 1 addition & 0 deletions
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

config/v1/zz_generated.deepcopy.go

Lines changed: 11 additions & 2 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: 1 addition & 0 deletions
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

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)