restrict override operation (#123)
Signed-off-by: RainbowMango <renhongcai@huawei.com>
This commit is contained in:
parent
2e9f245304
commit
1ee618a051
|
@ -50,7 +50,11 @@ spec:
|
|||
properties:
|
||||
operator:
|
||||
description: 'Operator indicates the operation on target
|
||||
field. Available operators are: Add, Update and Remove.'
|
||||
field. Available operators are: add, update and remove.'
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
path:
|
||||
description: Path indicates the path of target field
|
||||
|
|
|
@ -8,7 +8,7 @@ spec:
|
|||
resourceSelectors:
|
||||
- apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: # user can either select resource by name or by labelselector
|
||||
name: nginx # user can either select resource by name or by labelselector
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
image: nginx
|
||||
|
@ -24,11 +24,11 @@ spec:
|
|||
overriders:
|
||||
plaintext:
|
||||
- path: "/spec/template/spec/containers/0/image"
|
||||
operator: Replace
|
||||
operator: replace
|
||||
value: "dc-1.registry.io/nginx:1.17.0-alpine"
|
||||
- path: "/metadata/annotations"
|
||||
operator: Add
|
||||
operator: add
|
||||
value:
|
||||
foo: bar
|
||||
- path: "/metadata/annotations/foo"
|
||||
operator: Remove
|
||||
operator: remove
|
||||
|
|
|
@ -42,7 +42,8 @@ type PlaintextOverrider struct {
|
|||
// Path indicates the path of target field
|
||||
Path string `json:"path"`
|
||||
// Operator indicates the operation on target field.
|
||||
// Available operators are: Add, Update and Remove.
|
||||
// Available operators are: add, update and remove.
|
||||
// +kubebuilder:validation:Enum=add;remove;replace
|
||||
Operator OverriderOperator `json:"operator"`
|
||||
// Value to be applied to target field.
|
||||
// Must be empty when operator is Remove.
|
||||
|
@ -55,9 +56,9 @@ type OverriderOperator string
|
|||
|
||||
// These are valid overrider operators.
|
||||
const (
|
||||
OverriderOpAdd OverriderOperator = "Add"
|
||||
OverriderOpRemove OverriderOperator = "Remove"
|
||||
OverriderOpReplace OverriderOperator = "Replace"
|
||||
OverriderOpAdd OverriderOperator = "add"
|
||||
OverriderOpRemove OverriderOperator = "remove"
|
||||
OverriderOpReplace OverriderOperator = "replace"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
Loading…
Reference in New Issue