Skip to content

Commit e7f9ae6

Browse files
authored
chore(probe): rollback the probe schema (#452)
Signed-off-by: Shubham Chaudhary <[email protected]>
1 parent d7645ea commit e7f9ae6

File tree

4 files changed

+43
-135
lines changed

4 files changed

+43
-135
lines changed

api/litmuschaos/v1alpha1/chaosengine_types.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,22 @@ type ExperimentAttributes struct {
221221
// ProbeAttributes contains details of probe, which can be applied on the experiments
222222
type ProbeAttributes struct {
223223
// Name of probe
224-
Name string `json:"name"`
224+
Name string `json:"name,omitempty"`
225225
// Type of probe
226-
Type string `json:"type"`
226+
Type string `json:"type,omitempty"`
227227
// inputs needed for the k8s probe
228-
K8sProbeInputs *K8sProbeInputs `json:"k8sProbe/inputs,omitempty"`
228+
K8sProbeInputs K8sProbeInputs `json:"k8sProbe/inputs,omitempty"`
229229
// inputs needed for the http probe
230-
HTTPProbeInputs *HTTPProbeInputs `json:"httpProbe/inputs,omitempty"`
230+
HTTPProbeInputs HTTPProbeInputs `json:"httpProbe/inputs,omitempty"`
231231
// inputs needed for the cmd probe
232-
CmdProbeInputs *CmdProbeInputs `json:"cmdProbe/inputs,omitempty"`
232+
CmdProbeInputs CmdProbeInputs `json:"cmdProbe/inputs,omitempty"`
233233
// inputs needed for the prometheus probe
234-
PromProbeInputs *PromProbeInputs `json:"promProbe/inputs,omitempty"`
234+
PromProbeInputs PromProbeInputs `json:"promProbe/inputs,omitempty"`
235235
// RunProperty contains timeout, retry and interval for the probe
236-
RunProperties RunProperty `json:"runProperties"`
236+
RunProperties RunProperty `json:"runProperties,omitempty"`
237237
// mode for k8s probe
238238
// it can be SOT, EOT, Edge
239-
Mode string `json:"mode"`
239+
Mode string `json:"mode,omitempty"`
240240
// Data contains the manifest/data for the resource, which need to be created
241241
// it supported for create operation only
242242
Data string `json:"data,omitempty"`
@@ -245,11 +245,11 @@ type ProbeAttributes struct {
245245
// K8sProbeInputs contains all the inputs required for k8s probe
246246
type K8sProbeInputs struct {
247247
// group of the resource
248-
Group string `json:"group"`
248+
Group string `json:"group,omitempty"`
249249
// apiversion of the resource
250-
Version string `json:"version"`
250+
Version string `json:"version,omitempty"`
251251
// kind of resource
252-
Resource string `json:"resource"`
252+
Resource string `json:"resource,omitempty"`
253253
// ResourceNames to get the resources using their list of comma separated names
254254
ResourceNames string `json:"resourceNames,omitempty"`
255255
// namespace of the resource
@@ -260,24 +260,24 @@ type K8sProbeInputs struct {
260260
LabelSelector string `json:"labelSelector,omitempty"`
261261
// Operation performed by the k8s probe
262262
// it can be create, delete, present, absent
263-
Operation string `json:"operation"`
263+
Operation string `json:"operation,omitempty"`
264264
}
265265

266-
// CmdProbeInputs contains all the inputs required for cmd probe
266+
//CmdProbeInputs contains all the inputs required for cmd probe
267267
type CmdProbeInputs struct {
268268
// Command need to be executed for the probe
269-
Command string `json:"command"`
269+
Command string `json:"command,omitempty"`
270270
// Comparator check for the correctness of the probe output
271-
Comparator ComparatorInfo `json:"comparator"`
271+
Comparator ComparatorInfo `json:"comparator,omitempty"`
272272
// The source where we have to run the command
273273
// It will run in inline(inside experiment itself) mode if source is nil
274-
Source *SourceDetails `json:"source,omitempty"`
274+
Source SourceDetails `json:"source,omitempty"`
275275
}
276276

277277
// SourceDetails contains source details of the cmdProbe
278278
type SourceDetails struct {
279279
// Image for the source pod
280-
Image string `json:"image"`
280+
Image string `json:"image,omitempty"`
281281
// HostNetwork define the hostNetwork of the external pod
282282
// it supports boolean values and default value is false
283283
HostNetwork bool `json:"hostNetwork,omitempty"`
@@ -308,16 +308,16 @@ type SourceDetails struct {
308308
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
309309
}
310310

311-
// PromProbeInputs contains all the inputs required for prometheus probe
311+
//PromProbeInputs contains all the inputs required for prometheus probe
312312
type PromProbeInputs struct {
313313
// Endpoint for the prometheus probe
314-
Endpoint string `json:"endpoint"`
315-
// Query to get prometheus metrics
314+
Endpoint string `json:"endpoint,omitempty"`
315+
// Query to get promethus metrics
316316
Query string `json:"query,omitempty"`
317317
// QueryPath contains filePath, which contains prometheus query
318318
QueryPath string `json:"queryPath,omitempty"`
319319
// Comparator check for the correctness of the probe output
320-
Comparator ComparatorInfo `json:"comparator"`
320+
Comparator ComparatorInfo `json:"comparator,omitempty"`
321321
}
322322

323323
// ComparatorInfo contains the comparator details
@@ -328,34 +328,34 @@ type ComparatorInfo struct {
328328
// Criteria for matching data
329329
// it supports >=, <=, ==, >, <, != for int and float
330330
// it supports equal, notEqual, contains for string
331-
Criteria string `json:"criteria"`
331+
Criteria string `json:"criteria,omitempty"`
332332
// Value contains relative value for criteria
333-
Value string `json:"value"`
333+
Value string `json:"value,omitempty"`
334334
}
335335

336-
// HTTPProbeInputs contains all the inputs required for http probe
336+
//HTTPProbeInputs contains all the inputs required for http probe
337337
type HTTPProbeInputs struct {
338338
// URL which needs to curl, to check the status
339-
URL string `json:"url"`
339+
URL string `json:"url,omitempty"`
340340
// InsecureSkipVerify flag to skip certificate checks
341341
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
342342
// Method define the http method, it can be get or post
343-
Method HTTPMethod `json:"method"`
343+
Method HTTPMethod `json:"method,omitempty"`
344344
}
345345

346346
// HTTPMethod define the http method details
347347
type HTTPMethod struct {
348-
Get *GetMethod `json:"get,omitempty"`
349-
Post *PostMethod `json:"post,omitempty"`
348+
Get GetMethod `json:"get,omitempty"`
349+
Post PostMethod `json:"post,omitempty"`
350350
}
351351

352352
// GetMethod define the http Get method
353353
type GetMethod struct {
354354
// Criteria for matching data
355355
// it supports == != operations
356-
Criteria string `json:"criteria"`
356+
Criteria string `json:"criteria,omitempty"`
357357
// Value contains relative value for criteria
358-
ResponseCode string `json:"responseCode"`
358+
ResponseCode string `json:"responseCode,omitempty"`
359359
}
360360

361361
// PostMethod define the http Post method
@@ -368,17 +368,17 @@ type PostMethod struct {
368368
BodyPath string `json:"bodyPath,omitempty"`
369369
// Criteria for matching data
370370
// it supports == != operations
371-
Criteria string `json:"criteria"`
371+
Criteria string `json:"criteria,omitempty"`
372372
// Value contains relative value for criteria
373-
ResponseCode string `json:"responseCode"`
373+
ResponseCode string `json:"responseCode,omitempty"`
374374
}
375375

376-
// RunProperty contains timeout, retry and interval for the probe
376+
//RunProperty contains timeout, retry and interval for the probe
377377
type RunProperty struct {
378378
//ProbeTimeout contains timeout for the probe
379-
ProbeTimeout int `json:"probeTimeout"`
379+
ProbeTimeout int `json:"probeTimeout,omitempty"`
380380
// Interval contains the interval for the probe
381-
Interval int `json:"interval"`
381+
Interval int `json:"interval,omitempty"`
382382
// Retry contains the retry count for the probe
383383
Retry int `json:"retry,omitempty"`
384384
// Attempt contains the total attempt count for the probe

api/litmuschaos/v1alpha1/zz_generated.deepcopy.go

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

deploy/chaos_crds.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,7 @@ spec:
338338
items:
339339
type: object
340340
required:
341-
- name
342-
- type
343341
- runProperties
344-
- mode
345342
properties:
346343
name:
347344
type: string
@@ -351,11 +348,6 @@ spec:
351348
pattern: ^(k8sProbe|httpProbe|cmdProbe|promProbe)$
352349
k8sProbe/inputs:
353350
type: object
354-
required:
355-
- group
356-
- version
357-
- resource
358-
- operation
359351
properties:
360352
group:
361353
type: string
@@ -377,19 +369,12 @@ spec:
377369
minLength: 1
378370
cmdProbe/inputs:
379371
type: object
380-
required:
381-
- command
382-
- comparator
383372
properties:
384373
command:
385374
type: string
386375
minLength: 1
387376
comparator:
388377
type: object
389-
required:
390-
- type
391-
- criteria
392-
- value
393378
properties:
394379
type:
395380
type: string
@@ -402,8 +387,6 @@ spec:
402387
source:
403388
description: The external pod where we have to run the
404389
probe commands. It will run the commands inside the experiment pod itself(inline mode) if source contains a nil value
405-
required:
406-
- image
407390
properties:
408391
annotations:
409392
additionalProperties:
@@ -2187,9 +2170,6 @@ spec:
21872170
type: object
21882171
httpProbe/inputs:
21892172
type: object
2190-
required:
2191-
- url
2192-
- method
21932173
properties:
21942174
url:
21952175
type: string
@@ -2202,9 +2182,6 @@ spec:
22022182
properties:
22032183
get:
22042184
type: object
2205-
required:
2206-
- criteria
2207-
- responseCode
22082185
properties:
22092186
criteria:
22102187
type: string
@@ -2214,9 +2191,6 @@ spec:
22142191
minLength: 1
22152192
post:
22162193
type: object
2217-
required:
2218-
- criteria
2219-
- responseCode
22202194
properties:
22212195
contentType:
22222196
type: string
@@ -2233,9 +2207,6 @@ spec:
22332207
minLength: 1
22342208
promProbe/inputs:
22352209
type: object
2236-
required:
2237-
- endpoint
2238-
- comparator
22392210
properties:
22402211
endpoint:
22412212
type: string
@@ -2245,9 +2216,6 @@ spec:
22452216
type: string
22462217
comparator:
22472218
type: object
2248-
required:
2249-
- criteria
2250-
- value
22512219
properties:
22522220
criteria:
22532221
type: string

0 commit comments

Comments
 (0)