Proposing structured field overrider API
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
parent
721107da86
commit
8ad4b5a989
|
@ -18691,6 +18691,36 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.FieldOverrider": {
|
||||
"description": "FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource. This allows changing a single field within the resource with multiple operations. It is designed to handle structured field values such as those found in ConfigMaps or Secrets. The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future. Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"fieldPath"
|
||||
],
|
||||
"properties": {
|
||||
"fieldPath": {
|
||||
"description": "FieldPath specifies the initial location in the instance document where the operation should take place. The path uses RFC 6901 for navigating into nested structures. For example, the path \"/data/db-config.yaml\" specifies the configuration data key named \"db-config.yaml\" in a ConfigMap: \"/data/db-config.yaml\".",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"json": {
|
||||
"description": "JSON represents the operations performed on the JSON document specified by the FieldPath.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"default": {},
|
||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.JSONPatchOperation"
|
||||
}
|
||||
},
|
||||
"yaml": {
|
||||
"description": "YAML represents the operations performed on the YAML document specified by the FieldPath.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"default": {},
|
||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.YAMLPatchOperation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.FieldSelector": {
|
||||
"description": "FieldSelector is a field filter.",
|
||||
"type": "object",
|
||||
|
@ -18747,6 +18777,30 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.JSONPatchOperation": {
|
||||
"description": "JSONPatchOperation represents a single field modification operation for JSON format.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"subPath",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"operator": {
|
||||
"description": "Operator indicates the operation on target field. Available operators are: \"add\", \"remove\", and \"replace\".",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"subPath": {
|
||||
"description": "SubPath specifies the relative location within the initial FieldPath where the operation should take place. The path uses RFC 6901 for navigating into nested structures.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"value": {
|
||||
"description": "Value is the new value to set for the specified field if the operation is \"add\" or \"replace\". For \"remove\" operation, this field is ignored.",
|
||||
"$ref": "#/definitions/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON"
|
||||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.LabelAnnotationOverrider": {
|
||||
"description": "LabelAnnotationOverrider represents the rules dedicated to handling workload labels/annotations",
|
||||
"type": "object",
|
||||
|
@ -18871,7 +18925,7 @@
|
|||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.Overriders": {
|
||||
"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",
|
||||
"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 - FieldOverrider - Plaintext",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"annotationsOverrider": {
|
||||
|
@ -18898,6 +18952,14 @@
|
|||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.CommandArgsOverrider"
|
||||
}
|
||||
},
|
||||
"fieldOverrider": {
|
||||
"description": "FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource. This allows changing a single field within the resource with multiple operations. It is designed to handle structured field values such as those found in ConfigMaps or Secrets. The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"default": {},
|
||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.FieldOverrider"
|
||||
}
|
||||
},
|
||||
"imageOverrider": {
|
||||
"description": "ImageOverrider represents the rules dedicated to handling image overrides.",
|
||||
"type": "array",
|
||||
|
@ -19292,6 +19354,30 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.YAMLPatchOperation": {
|
||||
"description": "YAMLPatchOperation represents a single field modification operation for YAML format.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"subPath",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"operator": {
|
||||
"description": "Operator indicates the operation on target field. Available operators are: \"add\", \"remove\", and \"replace\".",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"subPath": {
|
||||
"description": "SubPath specifies the relative location within the initial FieldPath where the operation should take place. The path uses RFC 6901 for navigating into nested structures.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"value": {
|
||||
"description": "Value is the new value to set for the specified field if the operation is \"add\" or \"replace\". For \"remove\" operation, this field is ignored.",
|
||||
"$ref": "#/definitions/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON"
|
||||
}
|
||||
}
|
||||
},
|
||||
"com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterAffinity": {
|
||||
"description": "ClusterAffinity represents the filter to select clusters.",
|
||||
"type": "object",
|
||||
|
|
|
@ -144,6 +144,92 @@ spec:
|
|||
- operator
|
||||
type: object
|
||||
type: array
|
||||
fieldOverrider:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
items:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: |-
|
||||
FieldPath specifies the initial location in the instance document where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures. For example, the path "/data/db-config.yaml"
|
||||
specifies the configuration data key named "db-config.yaml" in a ConfigMap: "/data/db-config.yaml".
|
||||
type: string
|
||||
json:
|
||||
description: JSON represents the operations performed
|
||||
on the JSON document specified by the FieldPath.
|
||||
items:
|
||||
description: JSONPatchOperation represents a single
|
||||
field modification operation for JSON format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
yaml:
|
||||
description: YAML represents the operations performed
|
||||
on the YAML document specified by the FieldPath.
|
||||
items:
|
||||
description: YAMLPatchOperation represents a single
|
||||
field modification operation for YAML format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- fieldPath
|
||||
type: object
|
||||
type: array
|
||||
imageOverrider:
|
||||
description: ImageOverrider represents the rules dedicated
|
||||
to handling image overrides.
|
||||
|
@ -481,6 +567,92 @@ spec:
|
|||
- operator
|
||||
type: object
|
||||
type: array
|
||||
fieldOverrider:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
items:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: |-
|
||||
FieldPath specifies the initial location in the instance document where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures. For example, the path "/data/db-config.yaml"
|
||||
specifies the configuration data key named "db-config.yaml" in a ConfigMap: "/data/db-config.yaml".
|
||||
type: string
|
||||
json:
|
||||
description: JSON represents the operations performed on
|
||||
the JSON document specified by the FieldPath.
|
||||
items:
|
||||
description: JSONPatchOperation represents a single field
|
||||
modification operation for JSON format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
yaml:
|
||||
description: YAML represents the operations performed on
|
||||
the YAML document specified by the FieldPath.
|
||||
items:
|
||||
description: YAMLPatchOperation represents a single field
|
||||
modification operation for YAML format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- fieldPath
|
||||
type: object
|
||||
type: array
|
||||
imageOverrider:
|
||||
description: ImageOverrider represents the rules dedicated to
|
||||
handling image overrides.
|
||||
|
|
|
@ -144,6 +144,92 @@ spec:
|
|||
- operator
|
||||
type: object
|
||||
type: array
|
||||
fieldOverrider:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
items:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: |-
|
||||
FieldPath specifies the initial location in the instance document where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures. For example, the path "/data/db-config.yaml"
|
||||
specifies the configuration data key named "db-config.yaml" in a ConfigMap: "/data/db-config.yaml".
|
||||
type: string
|
||||
json:
|
||||
description: JSON represents the operations performed
|
||||
on the JSON document specified by the FieldPath.
|
||||
items:
|
||||
description: JSONPatchOperation represents a single
|
||||
field modification operation for JSON format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
yaml:
|
||||
description: YAML represents the operations performed
|
||||
on the YAML document specified by the FieldPath.
|
||||
items:
|
||||
description: YAMLPatchOperation represents a single
|
||||
field modification operation for YAML format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- fieldPath
|
||||
type: object
|
||||
type: array
|
||||
imageOverrider:
|
||||
description: ImageOverrider represents the rules dedicated
|
||||
to handling image overrides.
|
||||
|
@ -481,6 +567,92 @@ spec:
|
|||
- operator
|
||||
type: object
|
||||
type: array
|
||||
fieldOverrider:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
items:
|
||||
description: |-
|
||||
FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
This allows changing a single field within the resource with multiple operations.
|
||||
It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: |-
|
||||
FieldPath specifies the initial location in the instance document where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures. For example, the path "/data/db-config.yaml"
|
||||
specifies the configuration data key named "db-config.yaml" in a ConfigMap: "/data/db-config.yaml".
|
||||
type: string
|
||||
json:
|
||||
description: JSON represents the operations performed on
|
||||
the JSON document specified by the FieldPath.
|
||||
items:
|
||||
description: JSONPatchOperation represents a single field
|
||||
modification operation for JSON format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
yaml:
|
||||
description: YAML represents the operations performed on
|
||||
the YAML document specified by the FieldPath.
|
||||
items:
|
||||
description: YAMLPatchOperation represents a single field
|
||||
modification operation for YAML format.
|
||||
properties:
|
||||
operator:
|
||||
description: |-
|
||||
Operator indicates the operation on target field.
|
||||
Available operators are: "add", "remove", and "replace".
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
subPath:
|
||||
description: |-
|
||||
SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
The path uses RFC 6901 for navigating into nested structures.
|
||||
type: string
|
||||
value:
|
||||
description: |-
|
||||
Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
For "remove" operation, this field is ignored.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- subPath
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- fieldPath
|
||||
type: object
|
||||
type: array
|
||||
imageOverrider:
|
||||
description: ImageOverrider represents the rules dedicated to
|
||||
handling image overrides.
|
||||
|
|
|
@ -101,6 +101,7 @@ type RuleWithCluster struct {
|
|||
// - ArgsOverrider
|
||||
// - LabelsOverrider
|
||||
// - AnnotationsOverrider
|
||||
// - FieldOverrider
|
||||
// - Plaintext
|
||||
type Overriders struct {
|
||||
// Plaintext represents override rules defined with plaintext overriders.
|
||||
|
@ -126,6 +127,13 @@ type Overriders struct {
|
|||
// AnnotationsOverrider represents the rules dedicated to handling workload annotations
|
||||
// +optional
|
||||
AnnotationsOverrider []LabelAnnotationOverrider `json:"annotationsOverrider,omitempty"`
|
||||
|
||||
// FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
// This allows changing a single field within the resource with multiple operations.
|
||||
// It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
// The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
// +optional
|
||||
FieldOverrider []FieldOverrider `json:"fieldOverrider,omitempty"`
|
||||
}
|
||||
|
||||
// LabelAnnotationOverrider represents the rules dedicated to handling workload labels/annotations
|
||||
|
@ -255,6 +263,65 @@ const (
|
|||
OverriderOpReplace OverriderOperator = "replace"
|
||||
)
|
||||
|
||||
// FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource.
|
||||
// This allows changing a single field within the resource with multiple operations.
|
||||
// It is designed to handle structured field values such as those found in ConfigMaps or Secrets.
|
||||
// The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.
|
||||
// Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.
|
||||
type FieldOverrider struct {
|
||||
// FieldPath specifies the initial location in the instance document where the operation should take place.
|
||||
// The path uses RFC 6901 for navigating into nested structures. For example, the path "/data/db-config.yaml"
|
||||
// specifies the configuration data key named "db-config.yaml" in a ConfigMap: "/data/db-config.yaml".
|
||||
// +required
|
||||
FieldPath string `json:"fieldPath"`
|
||||
|
||||
// JSON represents the operations performed on the JSON document specified by the FieldPath.
|
||||
// +optional
|
||||
JSON []JSONPatchOperation `json:"json,omitempty"`
|
||||
|
||||
// YAML represents the operations performed on the YAML document specified by the FieldPath.
|
||||
// +optional
|
||||
YAML []YAMLPatchOperation `json:"yaml,omitempty"`
|
||||
}
|
||||
|
||||
// JSONPatchOperation represents a single field modification operation for JSON format.
|
||||
type JSONPatchOperation struct {
|
||||
// SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
// The path uses RFC 6901 for navigating into nested structures.
|
||||
// +required
|
||||
SubPath string `json:"subPath"`
|
||||
|
||||
// Operator indicates the operation on target field.
|
||||
// Available operators are: "add", "remove", and "replace".
|
||||
// +kubebuilder:validation:Enum=add;remove;replace
|
||||
// +required
|
||||
Operator OverriderOperator `json:"operator"`
|
||||
|
||||
// Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
// For "remove" operation, this field is ignored.
|
||||
// +optional
|
||||
Value apiextensionsv1.JSON `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// YAMLPatchOperation represents a single field modification operation for YAML format.
|
||||
type YAMLPatchOperation struct {
|
||||
// SubPath specifies the relative location within the initial FieldPath where the operation should take place.
|
||||
// The path uses RFC 6901 for navigating into nested structures.
|
||||
// +required
|
||||
SubPath string `json:"subPath"`
|
||||
|
||||
// Operator indicates the operation on target field.
|
||||
// Available operators are: "add", "remove", and "replace".
|
||||
// +kubebuilder:validation:Enum=add;remove;replace
|
||||
// +required
|
||||
Operator OverriderOperator `json:"operator"`
|
||||
|
||||
// Value is the new value to set for the specified field if the operation is "add" or "replace".
|
||||
// For "remove" operation, this field is ignored.
|
||||
// +optional
|
||||
Value apiextensionsv1.JSON `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// OverridePolicyList is a collection of OverridePolicy.
|
||||
|
|
|
@ -453,6 +453,36 @@ func (in *FederatedResourceQuotaStatus) DeepCopy() *FederatedResourceQuotaStatus
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FieldOverrider) DeepCopyInto(out *FieldOverrider) {
|
||||
*out = *in
|
||||
if in.JSON != nil {
|
||||
in, out := &in.JSON, &out.JSON
|
||||
*out = make([]JSONPatchOperation, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.YAML != nil {
|
||||
in, out := &in.YAML, &out.YAML
|
||||
*out = make([]YAMLPatchOperation, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldOverrider.
|
||||
func (in *FieldOverrider) DeepCopy() *FieldOverrider {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FieldOverrider)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FieldSelector) DeepCopyInto(out *FieldSelector) {
|
||||
*out = *in
|
||||
|
@ -513,6 +543,23 @@ func (in *ImagePredicate) DeepCopy() *ImagePredicate {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JSONPatchOperation) DeepCopyInto(out *JSONPatchOperation) {
|
||||
*out = *in
|
||||
in.Value.DeepCopyInto(&out.Value)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONPatchOperation.
|
||||
func (in *JSONPatchOperation) DeepCopy() *JSONPatchOperation {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(JSONPatchOperation)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LabelAnnotationOverrider) DeepCopyInto(out *LabelAnnotationOverrider) {
|
||||
*out = *in
|
||||
|
@ -677,6 +724,13 @@ func (in *Overriders) DeepCopyInto(out *Overriders) {
|
|||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.FieldOverrider != nil {
|
||||
in, out := &in.FieldOverrider, &out.FieldOverrider
|
||||
*out = make([]FieldOverrider, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1027,3 +1081,20 @@ func (in *Suspension) DeepCopy() *Suspension {
|
|||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *YAMLPatchOperation) DeepCopyInto(out *YAMLPatchOperation) {
|
||||
*out = *in
|
||||
in.Value.DeepCopyInto(&out.Value)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YAMLPatchOperation.
|
||||
func (in *YAMLPatchOperation) DeepCopy() *YAMLPatchOperation {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(YAMLPatchOperation)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
|
@ -109,9 +109,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
|||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FederatedResourceQuotaList": schema_pkg_apis_policy_v1alpha1_FederatedResourceQuotaList(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FederatedResourceQuotaSpec": schema_pkg_apis_policy_v1alpha1_FederatedResourceQuotaSpec(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FederatedResourceQuotaStatus": schema_pkg_apis_policy_v1alpha1_FederatedResourceQuotaStatus(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FieldOverrider": schema_pkg_apis_policy_v1alpha1_FieldOverrider(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FieldSelector": schema_pkg_apis_policy_v1alpha1_FieldSelector(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ImageOverrider": schema_pkg_apis_policy_v1alpha1_ImageOverrider(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ImagePredicate": schema_pkg_apis_policy_v1alpha1_ImagePredicate(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.JSONPatchOperation": schema_pkg_apis_policy_v1alpha1_JSONPatchOperation(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.LabelAnnotationOverrider": schema_pkg_apis_policy_v1alpha1_LabelAnnotationOverrider(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.OverridePolicy": schema_pkg_apis_policy_v1alpha1_OverridePolicy(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.OverridePolicyList": schema_pkg_apis_policy_v1alpha1_OverridePolicyList(ref),
|
||||
|
@ -130,6 +132,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
|||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.StaticClusterWeight": schema_pkg_apis_policy_v1alpha1_StaticClusterWeight(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.SuspendClusters": schema_pkg_apis_policy_v1alpha1_SuspendClusters(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.Suspension": schema_pkg_apis_policy_v1alpha1_Suspension(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.YAMLPatchOperation": schema_pkg_apis_policy_v1alpha1_YAMLPatchOperation(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterAffinity": schema_pkg_apis_remedy_v1alpha1_ClusterAffinity(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterConditionRequirement": schema_pkg_apis_remedy_v1alpha1_ClusterConditionRequirement(ref),
|
||||
"github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.DecisionMatch": schema_pkg_apis_remedy_v1alpha1_DecisionMatch(ref),
|
||||
|
@ -4192,6 +4195,58 @@ func schema_pkg_apis_policy_v1alpha1_FederatedResourceQuotaStatus(ref common.Ref
|
|||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_policy_v1alpha1_FieldOverrider(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource. This allows changing a single field within the resource with multiple operations. It is designed to handle structured field values such as those found in ConfigMaps or Secrets. The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future. Note: In any given instance, FieldOverrider processes either JSON or YAML fields, but not both simultaneously.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"fieldPath": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "FieldPath specifies the initial location in the instance document where the operation should take place. The path uses RFC 6901 for navigating into nested structures. For example, the path \"/data/db-config.yaml\" specifies the configuration data key named \"db-config.yaml\" in a ConfigMap: \"/data/db-config.yaml\".",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"json": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "JSON represents the operations performed on the JSON document specified by the FieldPath.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.JSONPatchOperation"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"yaml": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "YAML represents the operations performed on the YAML document specified by the FieldPath.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.YAMLPatchOperation"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"fieldPath"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.JSONPatchOperation", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.YAMLPatchOperation"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_policy_v1alpha1_FieldSelector(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
|
@ -4288,6 +4343,44 @@ func schema_pkg_apis_policy_v1alpha1_ImagePredicate(ref common.ReferenceCallback
|
|||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_policy_v1alpha1_JSONPatchOperation(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "JSONPatchOperation represents a single field modification operation for JSON format.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"subPath": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SubPath specifies the relative location within the initial FieldPath where the operation should take place. The path uses RFC 6901 for navigating into nested structures.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"operator": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Operator indicates the operation on target field. Available operators are: \"add\", \"remove\", and \"replace\".",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"value": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Value is the new value to set for the specified field if the operation is \"add\" or \"replace\". For \"remove\" operation, this field is ignored.",
|
||||
Ref: ref("k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"subPath", "operator"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_policy_v1alpha1_LabelAnnotationOverrider(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
|
@ -4479,7 +4572,7 @@ func schema_pkg_apis_policy_v1alpha1_Overriders(ref common.ReferenceCallback) co
|
|||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
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",
|
||||
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 - FieldOverrider - Plaintext",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"plaintext": {
|
||||
|
@ -4566,11 +4659,25 @@ func schema_pkg_apis_policy_v1alpha1_Overriders(ref common.ReferenceCallback) co
|
|||
},
|
||||
},
|
||||
},
|
||||
"fieldOverrider": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "FieldOverrider represents the rules dedicated to modifying a specific field in any Kubernetes resource. This allows changing a single field within the resource with multiple operations. It is designed to handle structured field values such as those found in ConfigMaps or Secrets. The current implementation supports JSON and YAML formats, but can easily be extended to support XML in the future.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FieldOverrider"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.CommandArgsOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ImageOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.LabelAnnotationOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.PlaintextOverrider"},
|
||||
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.CommandArgsOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FieldOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ImageOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.LabelAnnotationOverrider", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.PlaintextOverrider"},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5176,6 +5283,44 @@ func schema_pkg_apis_policy_v1alpha1_Suspension(ref common.ReferenceCallback) co
|
|||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_policy_v1alpha1_YAMLPatchOperation(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "YAMLPatchOperation represents a single field modification operation for YAML format.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"subPath": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SubPath specifies the relative location within the initial FieldPath where the operation should take place. The path uses RFC 6901 for navigating into nested structures.",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"operator": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Operator indicates the operation on target field. Available operators are: \"add\", \"remove\", and \"replace\".",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"value": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Value is the new value to set for the specified field if the operation is \"add\" or \"replace\". For \"remove\" operation, this field is ignored.",
|
||||
Ref: ref("k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"subPath", "operator"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_remedy_v1alpha1_ClusterAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
|
|
Loading…
Reference in New Issue