From 77830aada36fda8e36d1456be2a8fbe1448916a3 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Tue, 2 Feb 2021 11:20:29 +0800 Subject: [PATCH] Add DependentOverriders field to PropagationPolicy Signed-off-by: RainbowMango Co-authored-by: Kevin Wang --- .../policy.karmada.io_propagationpolicies.yaml | 12 ++++++++++++ pkg/apis/policy/v1alpha1/propagation_types.go | 12 ++++++++++++ pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go | 5 +++++ 3 files changed, 29 insertions(+) diff --git a/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml b/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml index ca3316efa..dba87eec3 100644 --- a/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml +++ b/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml @@ -42,6 +42,18 @@ spec: automatically. e.g. a ConfigMap referred by a Deployment. default false. type: boolean + dependentOverrides: + description: "DependentOverrides represents the list of overrides(OverridePolicy) + which must present before the current PropagationPolicy takes effect. + \n It 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 Note: 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." + items: + type: string + type: array placement: description: Placement represents the rule for select clusters to propagate resources. diff --git a/pkg/apis/policy/v1alpha1/propagation_types.go b/pkg/apis/policy/v1alpha1/propagation_types.go index cfebb61a8..0b5802e74 100644 --- a/pkg/apis/policy/v1alpha1/propagation_types.go +++ b/pkg/apis/policy/v1alpha1/propagation_types.go @@ -33,6 +33,18 @@ type PropagationSpec struct { // Placement represents the rule for select clusters to propagate resources. Placement Placement `json:"placement,omitempty"` + // DependentOverrides represents the list of overrides(OverridePolicy) + // which must present before the current PropagationPolicy takes effect. + // + // It 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. + // + // Note: 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. + // +optional + DependentOverrides []string `json:"dependentOverrides,omitempty"` + // SchedulerName represents which scheduler to proceed the scheduling. // If specified, the policy will be dispatched by specified scheduler. // If not specified, the policy will be dispatched by default scheduler. diff --git a/pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go index 1e2131f48..3c673a0f7 100644 --- a/pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go @@ -495,6 +495,11 @@ func (in *PropagationSpec) DeepCopyInto(out *PropagationSpec) { } } in.Placement.DeepCopyInto(&out.Placement) + if in.DependentOverrides != nil { + in, out := &in.DependentOverrides, &out.DependentOverrides + *out = make([]string, len(*in)) + copy(*out, *in) + } return }