Skip to content

Commit 595e66a

Browse files
Merge pull request #2448 from opokornyy/CCXDEV-15259-io-v1
[CCXDEV-15259]: promote InsightConfigAPI and OnDemandDataGather to v1
2 parents 172bfaf + 610b8c6 commit 595e66a

File tree

33 files changed

+10198
-12
lines changed

33 files changed

+10198
-12
lines changed

config/v1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
7676
&ImagePolicyList{},
7777
&ClusterImagePolicy{},
7878
&ClusterImagePolicyList{},
79+
&InsightsDataGather{},
80+
&InsightsDataGatherList{},
7981
)
8082
metav1.AddToGroupVersion(scheme, GroupVersion)
8183
return nil
Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "[TechPreview] InsightsDataGather"
3+
crdName: insightsdatagathers.config.openshift.io
4+
featureGates:
5+
- InsightsConfig
6+
tests:
7+
onCreate:
8+
- name: Should be able to create a minimal InsightsDataGather
9+
initial: |
10+
apiVersion: config.openshift.io/v1
11+
kind: InsightsDataGather
12+
spec:
13+
gatherConfig:
14+
gatherers:
15+
mode: All
16+
expected: |
17+
apiVersion: config.openshift.io/v1
18+
kind: InsightsDataGather
19+
spec:
20+
gatherConfig:
21+
gatherers:
22+
mode: All
23+
- name: InsightsDataGather without the spec should not be created
24+
initial: |
25+
apiVersion: config.openshift.io/v1
26+
kind: InsightsDataGather
27+
spec: {}
28+
expectedError: "spec.gatherConfig: Required value, <nil>: Invalid value"
29+
- name: Should be able to create InsightsDataGather with a storage and PersistentVolume
30+
initial: |
31+
apiVersion: config.openshift.io/v1
32+
kind: InsightsDataGather
33+
spec:
34+
gatherConfig:
35+
gatherers:
36+
mode: All
37+
dataPolicy:
38+
- WorkloadNames
39+
storage:
40+
type: PersistentVolume
41+
persistentVolume:
42+
mountPath: /data
43+
claim:
44+
name: test-claim
45+
expected: |
46+
apiVersion: config.openshift.io/v1
47+
kind: InsightsDataGather
48+
spec:
49+
gatherConfig:
50+
gatherers:
51+
mode: All
52+
dataPolicy:
53+
- WorkloadNames
54+
storage:
55+
type: PersistentVolume
56+
persistentVolume:
57+
mountPath: /data
58+
claim:
59+
name: test-claim
60+
- name: Should be able to create InsightsDataGather with a multiple DataPolicy values
61+
initial: |
62+
apiVersion: config.openshift.io/v1
63+
kind: InsightsDataGather
64+
spec:
65+
gatherConfig:
66+
gatherers:
67+
mode: All
68+
dataPolicy:
69+
- ObfuscateNetworking
70+
- WorkloadNames
71+
storage:
72+
type: PersistentVolume
73+
persistentVolume:
74+
mountPath: /data
75+
claim:
76+
name: test-claim
77+
expected: |
78+
apiVersion: config.openshift.io/v1
79+
kind: InsightsDataGather
80+
spec:
81+
gatherConfig:
82+
gatherers:
83+
mode: All
84+
dataPolicy:
85+
- ObfuscateNetworking
86+
- WorkloadNames
87+
storage:
88+
type: PersistentVolume
89+
persistentVolume:
90+
mountPath: /data
91+
claim:
92+
name: test-claim
93+
- name: Should be able to create InsightsDataGather with a storage and Ephemeral
94+
initial: |
95+
apiVersion: config.openshift.io/v1
96+
kind: InsightsDataGather
97+
spec:
98+
gatherConfig:
99+
gatherers:
100+
mode: All
101+
storage:
102+
type: Ephemeral
103+
expected: |
104+
apiVersion: config.openshift.io/v1
105+
kind: InsightsDataGather
106+
spec:
107+
gatherConfig:
108+
gatherers:
109+
mode: All
110+
storage:
111+
type: Ephemeral
112+
- name: Should be able to create InsightsDataGather with valid GathererConfig
113+
initial: |
114+
apiVersion: config.openshift.io/v1
115+
kind: InsightsDataGather
116+
spec:
117+
gatherConfig:
118+
gatherers:
119+
mode: Custom
120+
custom:
121+
configs:
122+
- name: gatherer
123+
state: Disabled
124+
- name: valid_gatherer
125+
state: Enabled
126+
- name: gatherer/function
127+
state: Enabled
128+
- name: gatherer_a/function_a
129+
state: Disabled
130+
expected: |
131+
apiVersion: config.openshift.io/v1
132+
kind: InsightsDataGather
133+
spec:
134+
gatherConfig:
135+
gatherers:
136+
mode: Custom
137+
custom:
138+
configs:
139+
- name: gatherer
140+
state: Disabled
141+
- name: valid_gatherer
142+
state: Enabled
143+
- name: gatherer/function
144+
state: Enabled
145+
- name: gatherer_a/function_a
146+
state: Disabled
147+
- name: Should be able to create InsightsDataGather with valid combination of dataPolicy values
148+
initial: |
149+
apiVersion: config.openshift.io/v1
150+
kind: InsightsDataGather
151+
spec:
152+
gatherConfig:
153+
gatherers:
154+
mode: All
155+
dataPolicy:
156+
- ObfuscateNetworking
157+
- WorkloadNames
158+
expected: |
159+
apiVersion: config.openshift.io/v1
160+
kind: InsightsDataGather
161+
spec:
162+
gatherConfig:
163+
gatherers:
164+
mode: All
165+
dataPolicy:
166+
- ObfuscateNetworking
167+
- WorkloadNames
168+
- name: When storage.type is PersistentVolume then PersistentVolume must be present
169+
initial: |
170+
apiVersion: config.openshift.io/v1
171+
kind: InsightsDataGather
172+
spec:
173+
gatherConfig:
174+
gatherers:
175+
mode: All
176+
storage:
177+
type: PersistentVolume
178+
expectedError: 'spec.gatherConfig.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise'
179+
- name: When storage.type is not PersistentVolume then PersistentVolume must not be present
180+
initial: |
181+
apiVersion: config.openshift.io/v1
182+
kind: InsightsDataGather
183+
spec:
184+
gatherConfig:
185+
gatherers:
186+
mode: All
187+
storage:
188+
type: Ephemeral
189+
persistentVolume:
190+
claim:
191+
name: test-claim
192+
expectedError: 'spec.gatherConfig.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise'
193+
- name: mountPath must not contain colon
194+
initial: |
195+
apiVersion: config.openshift.io/v1
196+
kind: InsightsDataGather
197+
spec:
198+
gatherConfig:
199+
gatherers:
200+
mode: All
201+
storage:
202+
type: PersistentVolume
203+
persistentVolume:
204+
mountPath: /data:/data
205+
claim:
206+
name: test-claim
207+
expectedError: 'spec.gatherConfig.storage.persistentVolume.mountPath: Invalid value: "string": mountPath must not contain a colon'
208+
- name: invalid gatherer name
209+
initial: |
210+
apiVersion: config.openshift.io/v1
211+
kind: InsightsDataGather
212+
spec:
213+
gatherConfig:
214+
gatherers:
215+
mode: All
216+
custom:
217+
configs:
218+
- name: invalid_gatherer_1
219+
state: Disabled
220+
expectedError: 'Invalid value: "string": 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'
221+
- name: storage.type is required
222+
initial: |
223+
apiVersion: config.openshift.io/v1
224+
kind: InsightsDataGather
225+
spec:
226+
gatherConfig:
227+
gatherers:
228+
mode: All
229+
storage:
230+
persistentVolume:
231+
mountPath: /data
232+
claim:
233+
name: test-claim
234+
expectedError: "spec.gatherConfig.storage.type: Required value"
235+
- name: storage.persistentVolume.claim can not be empty
236+
initial: |
237+
apiVersion: config.openshift.io/v1
238+
kind: InsightsDataGather
239+
spec:
240+
gatherConfig:
241+
gatherers:
242+
mode: All
243+
storage:
244+
type: PersistentVolume
245+
persistentVolume:
246+
mountPath: /data
247+
claim:
248+
expectedError: "spec.gatherConfig.storage.persistentVolume.claim: Required value"
249+
- name: claim must follow the naming convention
250+
initial: |
251+
apiVersion: config.openshift.io/v1
252+
kind: InsightsDataGather
253+
spec:
254+
gatherConfig:
255+
gatherers:
256+
mode: All
257+
storage:
258+
type: PersistentVolume
259+
persistentVolume:
260+
claim:
261+
name: INVALID_PVC_NAME
262+
expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ''-'' or ''.'', and must start and end with an alphanumeric character.'
263+
- name: gatherer state must be Disabled or Enabled
264+
initial: |
265+
apiVersion: config.openshift.io/v1
266+
kind: InsightsDataGather
267+
spec:
268+
gatherConfig:
269+
gatherers:
270+
mode: Custom
271+
custom:
272+
configs:
273+
- name: gatherer
274+
state: InvalidState
275+
expectedError: 'spec.gatherConfig.gatherers.custom.configs[0].state: Unsupported value: "InvalidState": supported values: "Enabled", "Disabled"'
276+
- name: dataPolicy must be one of the valid values
277+
initial: |
278+
apiVersion: config.openshift.io/v1
279+
kind: InsightsDataGather
280+
spec:
281+
gatherConfig:
282+
gatherers:
283+
mode: All
284+
dataPolicy:
285+
- InvalidPolicy
286+
expectedError: 'spec.gatherConfig.dataPolicy[0]: Unsupported value: "InvalidPolicy": supported values: "ObfuscateNetworking", "WorkloadNames"'
287+
- name: mode must have a valid value
288+
initial: |
289+
apiVersion: config.openshift.io/v1
290+
kind: InsightsDataGather
291+
spec:
292+
gatherConfig:
293+
gatherers:
294+
mode: InvalidMode
295+
expectedError: 'spec.gatherConfig.gatherers.mode: Unsupported value: "InvalidMode": supported values: "All", "None", "Custom"'
296+
- name: mode set to Custom must have gatherers present
297+
initial: |
298+
apiVersion: config.openshift.io/v1
299+
kind: InsightsDataGather
300+
spec:
301+
gatherConfig:
302+
gatherers:
303+
mode: Custom
304+
expectedError: 'spec.gatherConfig.gatherers: Invalid value: "object": custom is required when mode is Custom, and forbidden otherwise'
305+
- name: mode set to Disabled must not have gatherers present
306+
initial: |
307+
apiVersion: config.openshift.io/v1
308+
kind: InsightsDataGather
309+
spec:
310+
gatherConfig:
311+
gatherers:
312+
mode: None
313+
custom:
314+
configs:
315+
- name: gatherer
316+
state: Enabled
317+
expectedError: 'Invalid value: "object": custom is required when mode is Custom, and forbidden otherwise'

0 commit comments

Comments
 (0)