Merge pull request #3810 from RainbowMango/pr_pp_conflict_resolution

Add conflict resolution API to PP and CPP
This commit is contained in:
karmada-bot 2023-07-20 17:44:33 +08:00 committed by GitHub
commit df1b7915ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 113 additions and 0 deletions

View File

@ -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.",
"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": {
"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",
@ -18147,6 +18151,10 @@
"$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": {
"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"

View File

@ -49,6 +49,19 @@ spec:
automatically. e.g. a ConfigMap referred by a Deployment. default
false. Deprecated: in favor of PropagateDeps.'
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:
description: "DependentOverrides represents the list of overrides(OverridePolicy)
which must present before the current PropagationPolicy takes effect.

View File

@ -45,6 +45,19 @@ spec:
automatically. e.g. a ConfigMap referred by a Deployment. default
false. Deprecated: in favor of PropagateDeps.'
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:
description: "DependentOverrides represents the list of overrides(OverridePolicy)
which must present before the current PropagationPolicy takes effect.

View File

@ -264,6 +264,19 @@ spec:
- name
type: object
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:
description: Failover indicates how Karmada migrates applications
in case of failures. It inherits directly from the associated PropagationPolicy(or

View File

@ -264,6 +264,19 @@ spec:
- name
type: object
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:
description: Failover indicates how Karmada migrates applications
in case of failures. It inherits directly from the associated PropagationPolicy(or

View File

@ -123,6 +123,19 @@ type PropagationSpec struct {
// If this value is nil, failover is disabled.
// +optional
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.
@ -476,6 +489,19 @@ const (
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
// PropagationPolicyList contains a list of PropagationPolicy.

View File

@ -107,6 +107,19 @@ type ResourceBindingSpec struct {
// It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
// +optional
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.

View File

@ -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"),
},
},
"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"},
},
@ -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"),
},
},
"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"},
},