Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 4f25d0d

Browse files
author
AmitKumarDas
committed
chore(api): include omitempty tags to selector schema fields
Signed-off-by: AmitKumarDas <amit.das@mayadata.io>
1 parent b6775e2 commit 4f25d0d

File tree

3 files changed

+12
-68
lines changed

3 files changed

+12
-68
lines changed

apis/metacontroller/v1alpha1/selector.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
// **OR** of the selector terms.
2424
type ResourceSelector struct {
2525
// A list of selector terms. This list of terms are ORed.
26-
SelectorTerms []*SelectorTerm `json:"selectorTerms"`
26+
SelectorTerms []*SelectorTerm `json:"selectorTerms,omitempty"`
2727
}
2828

2929
// A SelectorTerm is a query over various match representations.
@@ -60,14 +60,14 @@ type SelectorTerm struct {
6060
// or not.
6161
//
6262
// This is optional
63-
MatchSlice map[string][]string `json:"matchSlice"`
63+
MatchSlice map[string][]string `json:"matchSlice,omitempty"`
6464

6565
// MatchSliceExpressions is a list of slice selector requirements.
6666
// These requirements are AND-ed to determine if the selector matches
6767
// its target or not.
6868
//
6969
// This is optional
70-
MatchSliceExpressions []SliceSelectorRequirement `json:"matchSliceExpressions"`
70+
MatchSliceExpressions []SliceSelectorRequirement `json:"matchSliceExpressions,omitempty"`
7171

7272
// MatchFields is a map i.e. key value pairs based field selector.
7373
//
@@ -102,13 +102,13 @@ type SelectorTerm struct {
102102
// not.
103103
//
104104
// This is optional
105-
MatchFields map[string]string `json:"matchFields"`
105+
MatchFields map[string]string `json:"matchFields,omitempty"`
106106

107107
// MatchFieldExpressions is a list of field selector requirements.
108108
// The requirements are AND-ed.
109109
//
110110
// This is optional
111-
MatchFieldExpressions []metav1.LabelSelectorRequirement `json:"matchFieldExpressions"`
111+
MatchFieldExpressions []metav1.LabelSelectorRequirement `json:"matchFieldExpressions,omitempty"`
112112

113113
// MatchReference is a list of keys where each key holds the
114114
// path to a nested field present in both target resource as
@@ -152,13 +152,13 @@ type SelectorTerm struct {
152152
// extracted from these objects match.
153153
//
154154
// This is optional
155-
MatchReference []string `json:"matchReference"`
155+
MatchReference []string `json:"matchReference,omitempty"`
156156

157157
// MatchReferenceExpressions is a list of field selector requirements.
158158
// The requirements are AND-ed.
159159
//
160160
// This is optional
161-
MatchReferenceExpressions []ReferenceSelectorRequirement `json:"matchReferenceExpressions"`
161+
MatchReferenceExpressions []ReferenceSelectorRequirement `json:"matchReferenceExpressions,omitempty"`
162162

163163
// MatchLabels is a map of {key,value} pairs that is matched against
164164
// the target's labels.
@@ -188,13 +188,13 @@ type SelectorTerm struct {
188188
// considered as a successful match.
189189
//
190190
// This is optional
191-
MatchLabels map[string]string `json:"matchLabels"`
191+
MatchLabels map[string]string `json:"matchLabels,omitempty"`
192192

193193
// MatchLabelExpressions is a list of label selector requirements.
194194
// The requirements are ANDed.
195195
//
196196
// This is optional
197-
MatchLabelExpressions []metav1.LabelSelectorRequirement `json:"matchLabelExpressions"`
197+
MatchLabelExpressions []metav1.LabelSelectorRequirement `json:"matchLabelExpressions,omitempty"`
198198

199199
// MatchAnnotations is a map of {key,value} pairs that is matched against
200200
// the target's annotations.
@@ -224,15 +224,15 @@ type SelectorTerm struct {
224224
// considered as a successful match.
225225
//
226226
// This is optional
227-
MatchAnnotations map[string]string `json:"matchAnnotations"`
227+
MatchAnnotations map[string]string `json:"matchAnnotations,omitempty"`
228228

229229
// MatchAnnotationExpressions is a list of label selector requirements.
230230
// The requirements are ANDed.
231231
//
232232
// The key as well value is matched against the target's annotations.
233233
//
234234
// This is optional
235-
MatchAnnotationExpressions []metav1.LabelSelectorRequirement `json:"matchAnnotationExpressions"`
235+
MatchAnnotationExpressions []metav1.LabelSelectorRequirement `json:"matchAnnotationExpressions,omitempty"`
236236
}
237237

238238
// SliceSelectorRequirement contains values, a key, and an operator that
@@ -303,7 +303,7 @@ type ReferenceSelectorRequirement struct {
303303
// NOTE:
304304
// When set, the Operator field becomes optional since Operator
305305
// is set to Equals.
306-
RefKey string `json:"refKey"`
306+
RefKey string `json:"refKey,omitempty"`
307307

308308
// Operator represents the operation that will be undertaken
309309
// between the values extracted from target & reference. Both

helm/metac/crds/metac.openebs.io_genericcontrollers.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ spec:
289289
required:
290290
- key
291291
- operator
292-
- refKey
293292
type: object
294293
type: array
295294
matchSlice:
@@ -348,21 +347,8 @@ spec:
348347
- values
349348
type: object
350349
type: array
351-
required:
352-
- matchAnnotationExpressions
353-
- matchAnnotations
354-
- matchFieldExpressions
355-
- matchFields
356-
- matchLabelExpressions
357-
- matchLabels
358-
- matchReference
359-
- matchReferenceExpressions
360-
- matchSlice
361-
- matchSliceExpressions
362350
type: object
363351
type: array
364-
required:
365-
- selectorTerms
366352
type: object
367353
annotationSelector:
368354
description: "Include the resource if annotation selector matches
@@ -839,7 +825,6 @@ spec:
839825
required:
840826
- key
841827
- operator
842-
- refKey
843828
type: object
844829
type: array
845830
matchSlice:
@@ -897,21 +882,8 @@ spec:
897882
- values
898883
type: object
899884
type: array
900-
required:
901-
- matchAnnotationExpressions
902-
- matchAnnotations
903-
- matchFieldExpressions
904-
- matchFields
905-
- matchLabelExpressions
906-
- matchLabels
907-
- matchReference
908-
- matchReferenceExpressions
909-
- matchSlice
910-
- matchSliceExpressions
911885
type: object
912886
type: array
913-
required:
914-
- selectorTerms
915887
type: object
916888
annotationSelector:
917889
description: "Include the resource if annotation selector matches

manifests/metacontroller.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,6 @@ spec:
884884
required:
885885
- key
886886
- operator
887-
- refKey
888887
type: object
889888
type: array
890889
matchSlice:
@@ -943,21 +942,8 @@ spec:
943942
- values
944943
type: object
945944
type: array
946-
required:
947-
- matchAnnotationExpressions
948-
- matchAnnotations
949-
- matchFieldExpressions
950-
- matchFields
951-
- matchLabelExpressions
952-
- matchLabels
953-
- matchReference
954-
- matchReferenceExpressions
955-
- matchSlice
956-
- matchSliceExpressions
957945
type: object
958946
type: array
959-
required:
960-
- selectorTerms
961947
type: object
962948
annotationSelector:
963949
description: "Include the resource if annotation selector matches
@@ -1434,7 +1420,6 @@ spec:
14341420
required:
14351421
- key
14361422
- operator
1437-
- refKey
14381423
type: object
14391424
type: array
14401425
matchSlice:
@@ -1492,21 +1477,8 @@ spec:
14921477
- values
14931478
type: object
14941479
type: array
1495-
required:
1496-
- matchAnnotationExpressions
1497-
- matchAnnotations
1498-
- matchFieldExpressions
1499-
- matchFields
1500-
- matchLabelExpressions
1501-
- matchLabels
1502-
- matchReference
1503-
- matchReferenceExpressions
1504-
- matchSlice
1505-
- matchSliceExpressions
15061480
type: object
15071481
type: array
1508-
required:
1509-
- selectorTerms
15101482
type: object
15111483
annotationSelector:
15121484
description: "Include the resource if annotation selector matches

0 commit comments

Comments
 (0)