Skip to content

Commit

Permalink
Proposing structured field overrider API
Browse files Browse the repository at this point in the history
Signed-off-by: RainbowMango <[email protected]>
  • Loading branch information
RainbowMango committed Sep 23, 2024
1 parent 721107d commit 8ad4b5a
Show file tree
Hide file tree
Showing 6 changed files with 716 additions and 3 deletions.
88 changes: 87 additions & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 8ad4b5a

Please sign in to comment.