Skip to content

Commit

Permalink
Merge pull request #5885 from RainbowMango/pr_statepreserve_api
Browse files Browse the repository at this point in the history
Introduce StatePreservation to PropagationPolicy API
  • Loading branch information
karmada-bot authored Nov 27, 2024
2 parents 5c3594f + 87ef7d0 commit b399c8b
Show file tree
Hide file tree
Showing 10 changed files with 463 additions and 1 deletion.
49 changes: 49 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18289,6 +18289,10 @@
"purgeMode": {
"description": "PurgeMode represents how to deal with the legacy applications on the cluster from which the application is migrated. Valid options are \"Immediately\", \"Graciously\" and \"Never\". Defaults to \"Graciously\".",
"type": "string"
},
"statePreservation": {
"description": "StatePreservation defines the policy for preserving and restoring state data during failover events for stateful applications.\n\nWhen an application fails over from one cluster to another, this policy enables the extraction of critical data from the original resource configuration. Upon successful migration, the extracted data is then re-injected into the new resource, ensuring that the application can resume operation with its previous state intact. This is particularly useful for stateful applications where maintaining data consistency across failover events is crucial. If not specified, means no state data will be preserved.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.StatePreservation"
}
}
},
Expand Down Expand Up @@ -19309,6 +19313,43 @@
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.StatePreservation": {
"description": "StatePreservation defines the policy for preserving state during failover events.",
"type": "object",
"required": [
"rules"
],
"properties": {
"rules": {
"description": "Rules contains a list of StatePreservationRule configurations. Each rule specifies a JSONPath expression targeting specific pieces of state data to be preserved during failover events. An AliasLabelName is associated with each rule, serving as a label key when the preserved data is passed to the new cluster.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.StatePreservationRule"
}
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.StatePreservationRule": {
"description": "StatePreservationRule defines a single rule for state preservation. It includes a JSONPath expression and an alias name that will be used as a label key when passing state information to the new cluster.",
"type": "object",
"required": [
"aliasLabelName",
"jsonPath"
],
"properties": {
"aliasLabelName": {
"description": "AliasLabelName is the name that will be used as a label key when the preserved data is passed to the new cluster. This facilitates the injection of the preserved state back into the application resources during recovery.",
"type": "string",
"default": ""
},
"jsonPath": {
"description": "JSONPath is the JSONPath template used to identify the state data to be preserved from the original resource configuration. The JSONPath syntax follows the Kubernetes specification: https://kubernetes.io/docs/reference/kubectl/jsonpath/\n\nNote: The JSONPath expression will start searching from the \"status\" field of the API resource object by default. For example, to extract the \"availableReplicas\" from a Deployment, the JSONPath expression should be \"{.availableReplicas}\", not \"{.status.availableReplicas}\".",
"type": "string",
"default": ""
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.StaticClusterAssignment": {
"description": "StaticClusterAssignment represents the set of desired hard limits for a specific cluster.",
"type": "object",
Expand Down Expand Up @@ -20075,6 +20116,14 @@
"description": "Message is a human-readable message indicating details about the eviction. This may be an empty string.",
"type": "string"
},
"preservedLabelState": {
"description": "PreservedLabelState represents the application state information collected from the original cluster, and it will be injected into the new cluster in form of application labels.",
"type": "object",
"additionalProperties": {
"type": "string",
"default": ""
}
},
"producer": {
"description": "Producer indicates the controller who triggered the eviction.",
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,59 @@ spec:
- Graciously
- Never
type: string
statePreservation:
description: |-
StatePreservation defines the policy for preserving and restoring state data
during failover events for stateful applications.
When an application fails over from one cluster to another, this policy enables
the extraction of critical data from the original resource configuration.
Upon successful migration, the extracted data is then re-injected into the new
resource, ensuring that the application can resume operation with its previous
state intact.
This is particularly useful for stateful applications where maintaining data
consistency across failover events is crucial.
If not specified, means no state data will be preserved.
properties:
rules:
description: |-
Rules contains a list of StatePreservationRule configurations.
Each rule specifies a JSONPath expression targeting specific pieces of
state data to be preserved during failover events. An AliasLabelName is associated
with each rule, serving as a label key when the preserved data is passed
to the new cluster.
items:
description: |-
StatePreservationRule defines a single rule for state preservation.
It includes a JSONPath expression and an alias name that will be used
as a label key when passing state information to the new cluster.
properties:
aliasLabelName:
description: |-
AliasLabelName is the name that will be used as a label key when the preserved
data is passed to the new cluster. This facilitates the injection of the
preserved state back into the application resources during recovery.
type: string
jsonPath:
description: |-
JSONPath is the JSONPath template used to identify the state data
to be preserved from the original resource configuration.
The JSONPath syntax follows the Kubernetes specification:
https://kubernetes.io/docs/reference/kubectl/jsonpath/
Note: The JSONPath expression will start searching from the "status" field of
the API resource object by default. For example, to extract the "availableReplicas"
from a Deployment, the JSONPath expression should be "{.availableReplicas}", not
"{.status.availableReplicas}".
type: string
required:
- aliasLabelName
- jsonPath
type: object
type: array
required:
- rules
type: object
required:
- decisionConditions
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,59 @@ spec:
- Graciously
- Never
type: string
statePreservation:
description: |-
StatePreservation defines the policy for preserving and restoring state data
during failover events for stateful applications.
When an application fails over from one cluster to another, this policy enables
the extraction of critical data from the original resource configuration.
Upon successful migration, the extracted data is then re-injected into the new
resource, ensuring that the application can resume operation with its previous
state intact.
This is particularly useful for stateful applications where maintaining data
consistency across failover events is crucial.
If not specified, means no state data will be preserved.
properties:
rules:
description: |-
Rules contains a list of StatePreservationRule configurations.
Each rule specifies a JSONPath expression targeting specific pieces of
state data to be preserved during failover events. An AliasLabelName is associated
with each rule, serving as a label key when the preserved data is passed
to the new cluster.
items:
description: |-
StatePreservationRule defines a single rule for state preservation.
It includes a JSONPath expression and an alias name that will be used
as a label key when passing state information to the new cluster.
properties:
aliasLabelName:
description: |-
AliasLabelName is the name that will be used as a label key when the preserved
data is passed to the new cluster. This facilitates the injection of the
preserved state back into the application resources during recovery.
type: string
jsonPath:
description: |-
JSONPath is the JSONPath template used to identify the state data
to be preserved from the original resource configuration.
The JSONPath syntax follows the Kubernetes specification:
https://kubernetes.io/docs/reference/kubectl/jsonpath/
Note: The JSONPath expression will start searching from the "status" field of
the API resource object by default. For example, to extract the "availableReplicas"
from a Deployment, the JSONPath expression should be "{.availableReplicas}", not
"{.status.availableReplicas}".
type: string
required:
- aliasLabelName
- jsonPath
type: object
type: array
required:
- rules
type: object
required:
- decisionConditions
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,59 @@ spec:
- Graciously
- Never
type: string
statePreservation:
description: |-
StatePreservation defines the policy for preserving and restoring state data
during failover events for stateful applications.
When an application fails over from one cluster to another, this policy enables
the extraction of critical data from the original resource configuration.
Upon successful migration, the extracted data is then re-injected into the new
resource, ensuring that the application can resume operation with its previous
state intact.
This is particularly useful for stateful applications where maintaining data
consistency across failover events is crucial.
If not specified, means no state data will be preserved.
properties:
rules:
description: |-
Rules contains a list of StatePreservationRule configurations.
Each rule specifies a JSONPath expression targeting specific pieces of
state data to be preserved during failover events. An AliasLabelName is associated
with each rule, serving as a label key when the preserved data is passed
to the new cluster.
items:
description: |-
StatePreservationRule defines a single rule for state preservation.
It includes a JSONPath expression and an alias name that will be used
as a label key when passing state information to the new cluster.
properties:
aliasLabelName:
description: |-
AliasLabelName is the name that will be used as a label key when the preserved
data is passed to the new cluster. This facilitates the injection of the
preserved state back into the application resources during recovery.
type: string
jsonPath:
description: |-
JSONPath is the JSONPath template used to identify the state data
to be preserved from the original resource configuration.
The JSONPath syntax follows the Kubernetes specification:
https://kubernetes.io/docs/reference/kubectl/jsonpath/
Note: The JSONPath expression will start searching from the "status" field of
the API resource object by default. For example, to extract the "availableReplicas"
from a Deployment, the JSONPath expression should be "{.availableReplicas}", not
"{.status.availableReplicas}".
type: string
required:
- aliasLabelName
- jsonPath
type: object
type: array
required:
- rules
type: object
required:
- decisionConditions
type: object
Expand Down Expand Up @@ -377,6 +430,13 @@ spec:
This may be an empty string.
maxLength: 1024
type: string
preservedLabelState:
additionalProperties:
type: string
description: |-
PreservedLabelState represents the application state information collected from the original cluster,
and it will be injected into the new cluster in form of application labels.
type: object
producer:
description: Producer indicates the controller who triggered
the eviction.
Expand Down
Loading

0 comments on commit b399c8b

Please sign in to comment.