Skip to content

Commit ef5d10f

Browse files
committed
add plaintext object overrider
Signed-off-by: Patrick <[email protected]>
1 parent d18afa1 commit ef5d10f

File tree

9 files changed

+624
-4
lines changed

9 files changed

+624
-4
lines changed

Diff for: api/openapi-spec/swagger.json

+32-1
Original file line numberDiff line numberDiff line change
@@ -18871,7 +18871,7 @@
1887118871
}
1887218872
},
1887318873
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Overriders": {
18874-
"description": "Overriders offers various alternatives to represent the override rules.\n\nIf more than one alternative exists, they will be applied with following order: - ImageOverrider - CommandOverrider - ArgsOverrider - LabelsOverrider - AnnotationsOverrider - Plaintext",
18874+
"description": "Overriders offers various alternatives to represent the override rules.\n\nIf more than one alternative exists, they will be applied with following order: - ImageOverrider - CommandOverrider - ArgsOverrider - LabelsOverrider - AnnotationsOverrider - Plaintext - PlaintextObjectOverrider",
1887518875
"type": "object",
1887618876
"properties": {
1887718877
"annotationsOverrider": {
@@ -18921,6 +18921,14 @@
1892118921
"default": {},
1892218922
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.PlaintextOverrider"
1892318923
}
18924+
},
18925+
"plaintextObjectOverrider": {
18926+
"description": "PlaintextObjectOverrider represents the rules dedicated to handling yaml or json object overrides",
18927+
"type": "array",
18928+
"items": {
18929+
"default": {},
18930+
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.PlaintextObjectOverrider"
18931+
}
1892418932
}
1892518933
}
1892618934
},
@@ -18962,6 +18970,29 @@
1896218970
}
1896318971
}
1896418972
},
18973+
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.PlaintextObjectOverrider": {
18974+
"description": "PlaintextObjectOverrider represents the rules dedicated to handling yaml or json object overrides",
18975+
"type": "object",
18976+
"required": [
18977+
"path",
18978+
"plaintext"
18979+
],
18980+
"properties": {
18981+
"path": {
18982+
"description": "Path indicates the path of target field",
18983+
"type": "string",
18984+
"default": ""
18985+
},
18986+
"plaintext": {
18987+
"description": "Plaintext represents override rules defined with plaintext overriders.",
18988+
"type": "array",
18989+
"items": {
18990+
"default": {},
18991+
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.PlaintextOverrider"
18992+
}
18993+
}
18994+
}
18995+
},
1896518996
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.PlaintextOverrider": {
1896618997
"description": "PlaintextOverrider is a simple overrider that overrides target fields according to path, operator and value.",
1896718998
"type": "object",

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

+91
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,52 @@ spec:
272272
- path
273273
type: object
274274
type: array
275+
plaintextObjectOverrider:
276+
description: PlaintextObjectOverrider represents the rules
277+
dedicated to handling yaml or json object overrides
278+
items:
279+
description: PlaintextObjectOverrider represents the rules
280+
dedicated to handling yaml or json object overrides
281+
properties:
282+
path:
283+
description: Path indicates the path of target field
284+
type: string
285+
plaintext:
286+
description: Plaintext represents override rules defined
287+
with plaintext overriders.
288+
items:
289+
description: |-
290+
PlaintextOverrider is a simple overrider that overrides target fields
291+
according to path, operator and value.
292+
properties:
293+
operator:
294+
description: |-
295+
Operator indicates the operation on target field.
296+
Available operators are: add, replace and remove.
297+
enum:
298+
- add
299+
- remove
300+
- replace
301+
type: string
302+
path:
303+
description: Path indicates the path of target
304+
field
305+
type: string
306+
value:
307+
description: |-
308+
Value to be applied to target field.
309+
Must be empty when operator is Remove.
310+
x-kubernetes-preserve-unknown-fields: true
311+
required:
312+
- operator
313+
- path
314+
type: object
315+
type: array
316+
required:
317+
- path
318+
- plaintext
319+
type: object
320+
type: array
275321
type: object
276322
targetCluster:
277323
description: |-
@@ -608,6 +654,51 @@ spec:
608654
- path
609655
type: object
610656
type: array
657+
plaintextObjectOverrider:
658+
description: PlaintextObjectOverrider represents the rules dedicated
659+
to handling yaml or json object overrides
660+
items:
661+
description: PlaintextObjectOverrider represents the rules dedicated
662+
to handling yaml or json object overrides
663+
properties:
664+
path:
665+
description: Path indicates the path of target field
666+
type: string
667+
plaintext:
668+
description: Plaintext represents override rules defined
669+
with plaintext overriders.
670+
items:
671+
description: |-
672+
PlaintextOverrider is a simple overrider that overrides target fields
673+
according to path, operator and value.
674+
properties:
675+
operator:
676+
description: |-
677+
Operator indicates the operation on target field.
678+
Available operators are: add, replace and remove.
679+
enum:
680+
- add
681+
- remove
682+
- replace
683+
type: string
684+
path:
685+
description: Path indicates the path of target field
686+
type: string
687+
value:
688+
description: |-
689+
Value to be applied to target field.
690+
Must be empty when operator is Remove.
691+
x-kubernetes-preserve-unknown-fields: true
692+
required:
693+
- operator
694+
- path
695+
type: object
696+
type: array
697+
required:
698+
- path
699+
- plaintext
700+
type: object
701+
type: array
611702
type: object
612703
resourceSelectors:
613704
description: |-

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

+91
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,52 @@ spec:
272272
- path
273273
type: object
274274
type: array
275+
plaintextObjectOverrider:
276+
description: PlaintextObjectOverrider represents the rules
277+
dedicated to handling yaml or json object overrides
278+
items:
279+
description: PlaintextObjectOverrider represents the rules
280+
dedicated to handling yaml or json object overrides
281+
properties:
282+
path:
283+
description: Path indicates the path of target field
284+
type: string
285+
plaintext:
286+
description: Plaintext represents override rules defined
287+
with plaintext overriders.
288+
items:
289+
description: |-
290+
PlaintextOverrider is a simple overrider that overrides target fields
291+
according to path, operator and value.
292+
properties:
293+
operator:
294+
description: |-
295+
Operator indicates the operation on target field.
296+
Available operators are: add, replace and remove.
297+
enum:
298+
- add
299+
- remove
300+
- replace
301+
type: string
302+
path:
303+
description: Path indicates the path of target
304+
field
305+
type: string
306+
value:
307+
description: |-
308+
Value to be applied to target field.
309+
Must be empty when operator is Remove.
310+
x-kubernetes-preserve-unknown-fields: true
311+
required:
312+
- operator
313+
- path
314+
type: object
315+
type: array
316+
required:
317+
- path
318+
- plaintext
319+
type: object
320+
type: array
275321
type: object
276322
targetCluster:
277323
description: |-
@@ -608,6 +654,51 @@ spec:
608654
- path
609655
type: object
610656
type: array
657+
plaintextObjectOverrider:
658+
description: PlaintextObjectOverrider represents the rules dedicated
659+
to handling yaml or json object overrides
660+
items:
661+
description: PlaintextObjectOverrider represents the rules dedicated
662+
to handling yaml or json object overrides
663+
properties:
664+
path:
665+
description: Path indicates the path of target field
666+
type: string
667+
plaintext:
668+
description: Plaintext represents override rules defined
669+
with plaintext overriders.
670+
items:
671+
description: |-
672+
PlaintextOverrider is a simple overrider that overrides target fields
673+
according to path, operator and value.
674+
properties:
675+
operator:
676+
description: |-
677+
Operator indicates the operation on target field.
678+
Available operators are: add, replace and remove.
679+
enum:
680+
- add
681+
- remove
682+
- replace
683+
type: string
684+
path:
685+
description: Path indicates the path of target field
686+
type: string
687+
value:
688+
description: |-
689+
Value to be applied to target field.
690+
Must be empty when operator is Remove.
691+
x-kubernetes-preserve-unknown-fields: true
692+
required:
693+
- operator
694+
- path
695+
type: object
696+
type: array
697+
required:
698+
- path
699+
- plaintext
700+
type: object
701+
type: array
611702
type: object
612703
resourceSelectors:
613704
description: |-

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/emirpasic/gods v1.18.1
99
github.com/evanphx/json-patch/v5 v5.9.0
1010
github.com/go-co-op/gocron v1.30.1
11+
github.com/go-openapi/jsonpointer v0.20.2
1112
github.com/gogo/protobuf v1.3.2
1213
github.com/google/go-cmp v0.6.0
1314
github.com/google/uuid v1.5.0
@@ -90,7 +91,6 @@ require (
9091
github.com/go-logr/logr v1.4.1 // indirect
9192
github.com/go-logr/stdr v1.2.2 // indirect
9293
github.com/go-logr/zapr v1.3.0 // indirect
93-
github.com/go-openapi/jsonpointer v0.20.2 // indirect
9494
github.com/go-openapi/jsonreference v0.20.4 // indirect
9595
github.com/go-openapi/swag v0.22.7 // indirect
9696
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect

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

+13
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,18 @@ 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 object overrides
132+
// +optional
133+
PlaintextObjectOverrider []PlaintextObjectOverrider `json:"plaintextObjectOverrider,omitempty"`
134+
}
135+
136+
// PlaintextObjectOverrider represents the rules dedicated to handling yaml or json object overrides
137+
type PlaintextObjectOverrider struct {
138+
// Path indicates the path of target field
139+
Path string `json:"path"`
140+
// Plaintext represents override rules defined with plaintext overriders.
141+
Plaintext []PlaintextOverrider `json:"plaintext"`
129142
}
130143

131144
// 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.

0 commit comments

Comments
 (0)