Merge pull request #3810 from RainbowMango/pr_pp_conflict_resolution
Add conflict resolution API to PP and CPP
This commit is contained in:
commit
df1b7915ab
|
@ -17251,6 +17251,10 @@
|
||||||
"description": "Association tells if relevant resources should be selected automatically. e.g. a ConfigMap referred by a Deployment. default false. Deprecated: in favor of PropagateDeps.",
|
"description": "Association tells if relevant resources should be selected automatically. e.g. a ConfigMap referred by a Deployment. default false. Deprecated: in favor of PropagateDeps.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"conflictResolution": {
|
||||||
|
"description": "ConflictResolution declares how potential conflict should be handled when a resource that is being propagated already exists in the target cluster.\n\nIt defaults to \"Abort\" which means stop propagating to avoid unexpected overwrites. The \"Overwrite\" might be useful when migrating legacy cluster resources to Karmada, in which case conflict is predictable and can be instructed to Karmada take over the resource by overwriting.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"dependentOverrides": {
|
"dependentOverrides": {
|
||||||
"description": "DependentOverrides represents the list of overrides(OverridePolicy) which must present before the current PropagationPolicy takes effect.\n\nIt used to explicitly specify overrides which current PropagationPolicy rely on. A typical scenario is the users create OverridePolicy(ies) and resources at the same time, they want to ensure the new-created policies would be adopted.\n\nNote: For the overrides, OverridePolicy(ies) in current namespace and ClusterOverridePolicy(ies), which not present in this list will still be applied if they matches the resources.",
|
"description": "DependentOverrides represents the list of overrides(OverridePolicy) which must present before the current PropagationPolicy takes effect.\n\nIt used to explicitly specify overrides which current PropagationPolicy rely on. A typical scenario is the users create OverridePolicy(ies) and resources at the same time, they want to ensure the new-created policies would be adopted.\n\nNote: For the overrides, OverridePolicy(ies) in current namespace and ClusterOverridePolicy(ies), which not present in this list will still be applied if they matches the resources.",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -18147,6 +18151,10 @@
|
||||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.TargetCluster"
|
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.TargetCluster"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"conflictResolution": {
|
||||||
|
"description": "ConflictResolution declares how potential conflict should be handled when a resource that is being propagated already exists in the target cluster.\n\nIt defaults to \"Abort\" which means stop propagating to avoid unexpected overwrites. The \"Overwrite\" might be useful when migrating legacy cluster resources to Karmada, in which case conflict is predictable and can be instructed to Karmada take over the resource by overwriting.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"failover": {
|
"failover": {
|
||||||
"description": "Failover indicates how Karmada migrates applications in case of failures. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).",
|
"description": "Failover indicates how Karmada migrates applications in case of failures. It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).",
|
||||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.FailoverBehavior"
|
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.FailoverBehavior"
|
||||||
|
|
|
@ -49,6 +49,19 @@ spec:
|
||||||
automatically. e.g. a ConfigMap referred by a Deployment. default
|
automatically. e.g. a ConfigMap referred by a Deployment. default
|
||||||
false. Deprecated: in favor of PropagateDeps.'
|
false. Deprecated: in favor of PropagateDeps.'
|
||||||
type: boolean
|
type: boolean
|
||||||
|
conflictResolution:
|
||||||
|
default: Abort
|
||||||
|
description: "ConflictResolution declares how potential conflict should
|
||||||
|
be handled when a resource that is being propagated already exists
|
||||||
|
in the target cluster. \n It defaults to \"Abort\" which means stop
|
||||||
|
propagating to avoid unexpected overwrites. The \"Overwrite\" might
|
||||||
|
be useful when migrating legacy cluster resources to Karmada, in
|
||||||
|
which case conflict is predictable and can be instructed to Karmada
|
||||||
|
take over the resource by overwriting."
|
||||||
|
enum:
|
||||||
|
- Abort
|
||||||
|
- Overwrite
|
||||||
|
type: string
|
||||||
dependentOverrides:
|
dependentOverrides:
|
||||||
description: "DependentOverrides represents the list of overrides(OverridePolicy)
|
description: "DependentOverrides represents the list of overrides(OverridePolicy)
|
||||||
which must present before the current PropagationPolicy takes effect.
|
which must present before the current PropagationPolicy takes effect.
|
||||||
|
|
|
@ -45,6 +45,19 @@ spec:
|
||||||
automatically. e.g. a ConfigMap referred by a Deployment. default
|
automatically. e.g. a ConfigMap referred by a Deployment. default
|
||||||
false. Deprecated: in favor of PropagateDeps.'
|
false. Deprecated: in favor of PropagateDeps.'
|
||||||
type: boolean
|
type: boolean
|
||||||
|
conflictResolution:
|
||||||
|
default: Abort
|
||||||
|
description: "ConflictResolution declares how potential conflict should
|
||||||
|
be handled when a resource that is being propagated already exists
|
||||||
|
in the target cluster. \n It defaults to \"Abort\" which means stop
|
||||||
|
propagating to avoid unexpected overwrites. The \"Overwrite\" might
|
||||||
|
be useful when migrating legacy cluster resources to Karmada, in
|
||||||
|
which case conflict is predictable and can be instructed to Karmada
|
||||||
|
take over the resource by overwriting."
|
||||||
|
enum:
|
||||||
|
- Abort
|
||||||
|
- Overwrite
|
||||||
|
type: string
|
||||||
dependentOverrides:
|
dependentOverrides:
|
||||||
description: "DependentOverrides represents the list of overrides(OverridePolicy)
|
description: "DependentOverrides represents the list of overrides(OverridePolicy)
|
||||||
which must present before the current PropagationPolicy takes effect.
|
which must present before the current PropagationPolicy takes effect.
|
||||||
|
|
|
@ -264,6 +264,19 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
conflictResolution:
|
||||||
|
default: Abort
|
||||||
|
description: "ConflictResolution declares how potential conflict should
|
||||||
|
be handled when a resource that is being propagated already exists
|
||||||
|
in the target cluster. \n It defaults to \"Abort\" which means stop
|
||||||
|
propagating to avoid unexpected overwrites. The \"Overwrite\" might
|
||||||
|
be useful when migrating legacy cluster resources to Karmada, in
|
||||||
|
which case conflict is predictable and can be instructed to Karmada
|
||||||
|
take over the resource by overwriting."
|
||||||
|
enum:
|
||||||
|
- Abort
|
||||||
|
- Overwrite
|
||||||
|
type: string
|
||||||
failover:
|
failover:
|
||||||
description: Failover indicates how Karmada migrates applications
|
description: Failover indicates how Karmada migrates applications
|
||||||
in case of failures. It inherits directly from the associated PropagationPolicy(or
|
in case of failures. It inherits directly from the associated PropagationPolicy(or
|
||||||
|
|
|
@ -264,6 +264,19 @@ spec:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
conflictResolution:
|
||||||
|
default: Abort
|
||||||
|
description: "ConflictResolution declares how potential conflict should
|
||||||
|
be handled when a resource that is being propagated already exists
|
||||||
|
in the target cluster. \n It defaults to \"Abort\" which means stop
|
||||||
|
propagating to avoid unexpected overwrites. The \"Overwrite\" might
|
||||||
|
be useful when migrating legacy cluster resources to Karmada, in
|
||||||
|
which case conflict is predictable and can be instructed to Karmada
|
||||||
|
take over the resource by overwriting."
|
||||||
|
enum:
|
||||||
|
- Abort
|
||||||
|
- Overwrite
|
||||||
|
type: string
|
||||||
failover:
|
failover:
|
||||||
description: Failover indicates how Karmada migrates applications
|
description: Failover indicates how Karmada migrates applications
|
||||||
in case of failures. It inherits directly from the associated PropagationPolicy(or
|
in case of failures. It inherits directly from the associated PropagationPolicy(or
|
||||||
|
|
|
@ -123,6 +123,19 @@ type PropagationSpec struct {
|
||||||
// If this value is nil, failover is disabled.
|
// If this value is nil, failover is disabled.
|
||||||
// +optional
|
// +optional
|
||||||
Failover *FailoverBehavior `json:"failover,omitempty"`
|
Failover *FailoverBehavior `json:"failover,omitempty"`
|
||||||
|
|
||||||
|
// ConflictResolution declares how potential conflict should be handled when
|
||||||
|
// a resource that is being propagated already exists in the target cluster.
|
||||||
|
//
|
||||||
|
// It defaults to "Abort" which means stop propagating to avoid unexpected
|
||||||
|
// overwrites. The "Overwrite" might be useful when migrating legacy cluster
|
||||||
|
// resources to Karmada, in which case conflict is predictable and can be
|
||||||
|
// instructed to Karmada take over the resource by overwriting.
|
||||||
|
//
|
||||||
|
// +kubebuilder:default="Abort"
|
||||||
|
// +kubebuilder:validation:Enum=Abort;Overwrite
|
||||||
|
// +optional
|
||||||
|
ConflictResolution ConflictResolution `json:"conflictResolution,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceSelector the resources will be selected.
|
// ResourceSelector the resources will be selected.
|
||||||
|
@ -476,6 +489,19 @@ const (
|
||||||
PreemptNever PreemptionBehavior = "Never"
|
PreemptNever PreemptionBehavior = "Never"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ConflictResolution describes how to resolve the conflict during the process
|
||||||
|
// of propagation especially the resource already in a member cluster.
|
||||||
|
type ConflictResolution string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ConflictOverwrite means that resolve the conflict by overwriting the
|
||||||
|
// resource with the propagating resource template.
|
||||||
|
ConflictOverwrite ConflictResolution = "Overwrite"
|
||||||
|
|
||||||
|
// ConflictAbort means that do not resolve the conflict and stop propagating.
|
||||||
|
ConflictAbort ConflictResolution = "Abort"
|
||||||
|
)
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// PropagationPolicyList contains a list of PropagationPolicy.
|
// PropagationPolicyList contains a list of PropagationPolicy.
|
||||||
|
|
|
@ -107,6 +107,19 @@ type ResourceBindingSpec struct {
|
||||||
// It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
|
// It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
|
||||||
// +optional
|
// +optional
|
||||||
Failover *policyv1alpha1.FailoverBehavior `json:"failover,omitempty"`
|
Failover *policyv1alpha1.FailoverBehavior `json:"failover,omitempty"`
|
||||||
|
|
||||||
|
// ConflictResolution declares how potential conflict should be handled when
|
||||||
|
// a resource that is being propagated already exists in the target cluster.
|
||||||
|
//
|
||||||
|
// It defaults to "Abort" which means stop propagating to avoid unexpected
|
||||||
|
// overwrites. The "Overwrite" might be useful when migrating legacy cluster
|
||||||
|
// resources to Karmada, in which case conflict is predictable and can be
|
||||||
|
// instructed to Karmada take over the resource by overwriting.
|
||||||
|
//
|
||||||
|
// +kubebuilder:default="Abort"
|
||||||
|
// +kubebuilder:validation:Enum=Abort;Overwrite
|
||||||
|
// +optional
|
||||||
|
ConflictResolution policyv1alpha1.ConflictResolution `json:"conflictResolution,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectReference contains enough information to locate the referenced object inside current cluster.
|
// ObjectReference contains enough information to locate the referenced object inside current cluster.
|
||||||
|
|
|
@ -4323,6 +4323,13 @@ func schema_pkg_apis_policy_v1alpha1_PropagationSpec(ref common.ReferenceCallbac
|
||||||
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior"),
|
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"conflictResolution": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "ConflictResolution declares how potential conflict should be handled when a resource that is being propagated already exists in the target cluster.\n\nIt defaults to \"Abort\" which means stop propagating to avoid unexpected overwrites. The \"Overwrite\" might be useful when migrating legacy cluster resources to Karmada, in which case conflict is predictable and can be instructed to Karmada take over the resource by overwriting.",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"resourceSelectors"},
|
Required: []string{"resourceSelectors"},
|
||||||
},
|
},
|
||||||
|
@ -6230,6 +6237,13 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingSpec(ref common.ReferenceCallb
|
||||||
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior"),
|
Ref: ref("github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"conflictResolution": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "ConflictResolution declares how potential conflict should be handled when a resource that is being propagated already exists in the target cluster.\n\nIt defaults to \"Abort\" which means stop propagating to avoid unexpected overwrites. The \"Overwrite\" might be useful when migrating legacy cluster resources to Karmada, in which case conflict is predictable and can be instructed to Karmada take over the resource by overwriting.",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"resource"},
|
Required: []string{"resource"},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue