Skip to content

Commit e563556

Browse files
committed
add plaintext object overrider
1 parent f2633a4 commit e563556

File tree

7 files changed

+587
-2
lines changed

7 files changed

+587
-2
lines changed

Diff for: charts/karmada/_crds/bases/policy/policy.karmada.io_clusteroverridepolicies.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,50 @@ spec:
272272
- path
273273
type: object
274274
type: array
275+
yamlOverrider:
276+
description: YamlOverrider represents the rules dedicated
277+
to handling yaml data overrides
278+
items:
279+
properties:
280+
path:
281+
description: Path indicates the path of target field
282+
type: string
283+
subOverrider:
284+
description: SubOverriders represents override rules
285+
defined with plaintext overriders.
286+
items:
287+
description: |-
288+
PlaintextOverrider is a simple overrider that overrides target fields
289+
according to path, operator and value.
290+
properties:
291+
operator:
292+
description: |-
293+
Operator indicates the operation on target field.
294+
Available operators are: add, replace and remove.
295+
enum:
296+
- add
297+
- remove
298+
- replace
299+
type: string
300+
path:
301+
description: Path indicates the path of target
302+
field
303+
type: string
304+
value:
305+
description: |-
306+
Value to be applied to target field.
307+
Must be empty when operator is Remove.
308+
x-kubernetes-preserve-unknown-fields: true
309+
required:
310+
- operator
311+
- path
312+
type: object
313+
type: array
314+
required:
315+
- path
316+
- subOverrider
317+
type: object
318+
type: array
275319
type: object
276320
targetCluster:
277321
description: |-
@@ -605,6 +649,49 @@ spec:
605649
- path
606650
type: object
607651
type: array
652+
yamlOverrider:
653+
description: YamlOverrider represents the rules dedicated to handling
654+
yaml data overrides
655+
items:
656+
properties:
657+
path:
658+
description: Path indicates the path of target field
659+
type: string
660+
subOverrider:
661+
description: SubOverriders represents override rules defined
662+
with plaintext overriders.
663+
items:
664+
description: |-
665+
PlaintextOverrider is a simple overrider that overrides target fields
666+
according to path, operator and value.
667+
properties:
668+
operator:
669+
description: |-
670+
Operator indicates the operation on target field.
671+
Available operators are: add, replace and remove.
672+
enum:
673+
- add
674+
- remove
675+
- replace
676+
type: string
677+
path:
678+
description: Path indicates the path of target field
679+
type: string
680+
value:
681+
description: |-
682+
Value to be applied to target field.
683+
Must be empty when operator is Remove.
684+
x-kubernetes-preserve-unknown-fields: true
685+
required:
686+
- operator
687+
- path
688+
type: object
689+
type: array
690+
required:
691+
- path
692+
- subOverrider
693+
type: object
694+
type: array
608695
type: object
609696
resourceSelectors:
610697
description: |-

Diff for: charts/karmada/_crds/bases/policy/policy.karmada.io_overridepolicies.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,50 @@ spec:
272272
- path
273273
type: object
274274
type: array
275+
yamlOverrider:
276+
description: YamlOverrider represents the rules dedicated
277+
to handling yaml data overrides
278+
items:
279+
properties:
280+
path:
281+
description: Path indicates the path of target field
282+
type: string
283+
subOverrider:
284+
description: SubOverriders represents override rules
285+
defined with plaintext overriders.
286+
items:
287+
description: |-
288+
PlaintextOverrider is a simple overrider that overrides target fields
289+
according to path, operator and value.
290+
properties:
291+
operator:
292+
description: |-
293+
Operator indicates the operation on target field.
294+
Available operators are: add, replace and remove.
295+
enum:
296+
- add
297+
- remove
298+
- replace
299+
type: string
300+
path:
301+
description: Path indicates the path of target
302+
field
303+
type: string
304+
value:
305+
description: |-
306+
Value to be applied to target field.
307+
Must be empty when operator is Remove.
308+
x-kubernetes-preserve-unknown-fields: true
309+
required:
310+
- operator
311+
- path
312+
type: object
313+
type: array
314+
required:
315+
- path
316+
- subOverrider
317+
type: object
318+
type: array
275319
type: object
276320
targetCluster:
277321
description: |-
@@ -605,6 +649,49 @@ spec:
605649
- path
606650
type: object
607651
type: array
652+
yamlOverrider:
653+
description: YamlOverrider represents the rules dedicated to handling
654+
yaml data overrides
655+
items:
656+
properties:
657+
path:
658+
description: Path indicates the path of target field
659+
type: string
660+
subOverrider:
661+
description: SubOverriders represents override rules defined
662+
with plaintext overriders.
663+
items:
664+
description: |-
665+
PlaintextOverrider is a simple overrider that overrides target fields
666+
according to path, operator and value.
667+
properties:
668+
operator:
669+
description: |-
670+
Operator indicates the operation on target field.
671+
Available operators are: add, replace and remove.
672+
enum:
673+
- add
674+
- remove
675+
- replace
676+
type: string
677+
path:
678+
description: Path indicates the path of target field
679+
type: string
680+
value:
681+
description: |-
682+
Value to be applied to target field.
683+
Must be empty when operator is Remove.
684+
x-kubernetes-preserve-unknown-fields: true
685+
required:
686+
- operator
687+
- path
688+
type: object
689+
type: array
690+
required:
691+
- path
692+
- subOverrider
693+
type: object
694+
type: array
608695
type: object
609696
resourceSelectors:
610697
description: |-

Diff for: pkg/apis/policy/v1alpha1/override_types.go

+12
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ type RuleWithCluster struct {
102102
// - LabelsOverrider
103103
// - AnnotationsOverrider
104104
// - Plaintext
105+
// - PlaintextObjectOverrider
105106
type Overriders struct {
106107
// Plaintext represents override rules defined with plaintext overriders.
107108
// +optional
@@ -126,6 +127,17 @@ type Overriders struct {
126127
// AnnotationsOverrider represents the rules dedicated to handling workload annotations
127128
// +optional
128129
AnnotationsOverrider []LabelAnnotationOverrider `json:"annotationsOverrider,omitempty"`
130+
131+
// PlaintextObjectOverrider represents the rules dedicated to handling yaml or json data overrides
132+
// +optional
133+
PlaintextObjectOverrider []PlaintextObjectOverrider `json:"plaintextObjectOverrider,omitempty"`
134+
}
135+
136+
type PlaintextObjectOverrider struct {
137+
// Path indicates the path of target field
138+
Path string `json:"path"`
139+
// Plaintext represents override rules defined with plaintext overriders.
140+
Plaintext []PlaintextOverrider `json:"plaintext"`
129141
}
130142

131143
// LabelAnnotationOverrider represents the rules dedicated to handling workload labels/annotations

Diff for: pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/generated/openapi/zz_generated.openapi.go

+54-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)