diff --git a/go.mod b/go.mod index 6416df0ea..d6a564407 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,6 @@ require ( k8s.io/component-base v0.21.0-rc.0 k8s.io/klog/v2 v2.8.0 k8s.io/kube-aggregator v0.21.0-rc.0 - open-cluster-management.io/api v0.0.0-20210610125115-f57c747b84aa + open-cluster-management.io/api v0.0.0-20210727123024-41c7397e9f2d sigs.k8s.io/controller-runtime v0.6.1-0.20200829232221-efc74d056b24 ) diff --git a/go.sum b/go.sum index 6e3d8e742..6f94362e4 100644 --- a/go.sum +++ b/go.sum @@ -964,8 +964,8 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -open-cluster-management.io/api v0.0.0-20210610125115-f57c747b84aa h1:Jw/Jo3Om1xXgdcn6xDfyREkc48nUcW/DqhMHffLCCww= -open-cluster-management.io/api v0.0.0-20210610125115-f57c747b84aa/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE= +open-cluster-management.io/api v0.0.0-20210727123024-41c7397e9f2d h1:hPi9yvMjTi7z/y7ruzKubCf9STZxVtQBd9MqYmj15SM= +open-cluster-management.io/api v0.0.0-20210727123024-41c7397e9f2d/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml b/manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml index 665c87c5c..6ee4d706e 100644 --- a/manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml +++ b/manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml @@ -39,6 +39,54 @@ spec: on the managed cluster. type: object properties: + deleteOption: + description: DeleteOption represents deletion strategy when the manifestwork + is deleted. Foreground deletion strategy is applied to all the resource + in this manifestwork if it is not set. + type: object + properties: + propagationPolicy: + description: propagationPolicy can be Foreground, Orphan or SelectivelyOrphan + SelectivelyOrphan should be rarely used. It is provided for + cases where particular resources is transfering ownership from + one ManifestWork to another or another management unit. Setting + this value will allow a flow like 1. create manifestwork/2 to + manage foo 2. update manifestwork/1 to selectively orphan foo + 3. remove foo from manifestwork/1 without impacting continuity + because manifestwork/2 adopts it. + type: string + default: ForeGround + selectivelyOrphans: + description: selectivelyOrphan represents a list of resources + following orphan deletion stratecy + type: object + properties: + orphaningRules: + description: orphaningRules defines a slice of orphaningrule. + Each orphaningrule identifies a single resource included + in this manifestwork + type: array + items: + description: OrphaningRule identifies a single resource + included in this manifestwork + type: object + properties: + Name: + description: Name is the names of the resources in the + workload that the strategy is applied + type: string + Namespace: + description: Namespace is the namespaces of the resources + in the workload that the strategy is applied + type: string + group: + description: Group is the api group of the resources + in the workload that the strategy is applied + type: string + resource: + description: Resource is the resources in the workload + that the strategy is applied + type: string workload: description: Workload represents the manifest workload to be deployed on a managed cluster. diff --git a/pkg/operators/clustermanager/bindata/bindata.go b/pkg/operators/clustermanager/bindata/bindata.go index d9ef18c0d..9fdbd7b4b 100644 --- a/pkg/operators/clustermanager/bindata/bindata.go +++ b/pkg/operators/clustermanager/bindata/bindata.go @@ -652,6 +652,54 @@ spec: on the managed cluster. type: object properties: + deleteOption: + description: DeleteOption represents deletion strategy when the manifestwork + is deleted. Foreground deletion strategy is applied to all the resource + in this manifestwork if it is not set. + type: object + properties: + propagationPolicy: + description: propagationPolicy can be Foreground, Orphan or SelectivelyOrphan + SelectivelyOrphan should be rarely used. It is provided for + cases where particular resources is transfering ownership from + one ManifestWork to another or another management unit. Setting + this value will allow a flow like 1. create manifestwork/2 to + manage foo 2. update manifestwork/1 to selectively orphan foo + 3. remove foo from manifestwork/1 without impacting continuity + because manifestwork/2 adopts it. + type: string + default: ForeGround + selectivelyOrphans: + description: selectivelyOrphan represents a list of resources + following orphan deletion stratecy + type: object + properties: + orphaningRules: + description: orphaningRules defines a slice of orphaningrule. + Each orphaningrule identifies a single resource included + in this manifestwork + type: array + items: + description: OrphaningRule identifies a single resource + included in this manifestwork + type: object + properties: + Name: + description: Name is the names of the resources in the + workload that the strategy is applied + type: string + Namespace: + description: Namespace is the namespaces of the resources + in the workload that the strategy is applied + type: string + group: + description: Group is the api group of the resources + in the workload that the strategy is applied + type: string + resource: + description: Resource is the resources in the workload + that the strategy is applied + type: string workload: description: Workload represents the manifest workload to be deployed on a managed cluster. diff --git a/vendor/modules.txt b/vendor/modules.txt index c8580f27c..4fa0311c7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -982,7 +982,7 @@ k8s.io/utils/net k8s.io/utils/path k8s.io/utils/pointer k8s.io/utils/trace -# open-cluster-management.io/api v0.0.0-20210610125115-f57c747b84aa +# open-cluster-management.io/api v0.0.0-20210727123024-41c7397e9f2d ## explicit open-cluster-management.io/api/addon/v1alpha1 open-cluster-management.io/api/client/addon/clientset/versioned diff --git a/vendor/open-cluster-management.io/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml b/vendor/open-cluster-management.io/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml index 665c87c5c..6ee4d706e 100644 --- a/vendor/open-cluster-management.io/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml +++ b/vendor/open-cluster-management.io/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml @@ -39,6 +39,54 @@ spec: on the managed cluster. type: object properties: + deleteOption: + description: DeleteOption represents deletion strategy when the manifestwork + is deleted. Foreground deletion strategy is applied to all the resource + in this manifestwork if it is not set. + type: object + properties: + propagationPolicy: + description: propagationPolicy can be Foreground, Orphan or SelectivelyOrphan + SelectivelyOrphan should be rarely used. It is provided for + cases where particular resources is transfering ownership from + one ManifestWork to another or another management unit. Setting + this value will allow a flow like 1. create manifestwork/2 to + manage foo 2. update manifestwork/1 to selectively orphan foo + 3. remove foo from manifestwork/1 without impacting continuity + because manifestwork/2 adopts it. + type: string + default: ForeGround + selectivelyOrphans: + description: selectivelyOrphan represents a list of resources + following orphan deletion stratecy + type: object + properties: + orphaningRules: + description: orphaningRules defines a slice of orphaningrule. + Each orphaningrule identifies a single resource included + in this manifestwork + type: array + items: + description: OrphaningRule identifies a single resource + included in this manifestwork + type: object + properties: + Name: + description: Name is the names of the resources in the + workload that the strategy is applied + type: string + Namespace: + description: Namespace is the namespaces of the resources + in the workload that the strategy is applied + type: string + group: + description: Group is the api group of the resources + in the workload that the strategy is applied + type: string + resource: + description: Resource is the resources in the workload + that the strategy is applied + type: string workload: description: Workload represents the manifest workload to be deployed on a managed cluster. diff --git a/vendor/open-cluster-management.io/api/work/v1/types.go b/vendor/open-cluster-management.io/api/work/v1/types.go index 7591d739c..f21fd4945 100644 --- a/vendor/open-cluster-management.io/api/work/v1/types.go +++ b/vendor/open-cluster-management.io/api/work/v1/types.go @@ -30,6 +30,11 @@ type ManifestWork struct { type ManifestWorkSpec struct { // Workload represents the manifest workload to be deployed on a managed cluster. Workload ManifestsTemplate `json:"workload,omitempty"` + + // DeleteOption represents deletion strategy when the manifestwork is deleted. + // Foreground deletion strategy is applied to all the resource in this manifestwork if it is not set. + // +optional + DeleteOption *DeleteOption `json:"deleteOption,omitempty"` } // Manifest represents a resource to be deployed on managed cluster. @@ -46,6 +51,59 @@ type ManifestsTemplate struct { Manifests []Manifest `json:"manifests,omitempty"` } +type DeleteOption struct { + // propagationPolicy can be Foreground, Orphan or SelectivelyOrphan + // SelectivelyOrphan should be rarely used. It is provided for cases where particular resources is transfering + // ownership from one ManifestWork to another or another management unit. + // Setting this value will allow a flow like + // 1. create manifestwork/2 to manage foo + // 2. update manifestwork/1 to selectively orphan foo + // 3. remove foo from manifestwork/1 without impacting continuity because manifestwork/2 adopts it. + // +kubebuilder:default=ForeGround + PropagationPolicy DeletePropagationPolicyType `json:"propagationPolicy"` + + // selectivelyOrphan represents a list of resources following orphan deletion stratecy + SelectivelyOrphan *SelectivelyOrphan `json:"selectivelyOrphans,omitempty"` +} + +type DeletePropagationPolicyType string + +const ( + // DeletePropagationPolicyTypeForeground represents that all the resources in the manifestwork is should + // be fourground deleted. + DeletePropagationPolicyTypeForeground DeletePropagationPolicyType = "Foreground" + // DeletePropagationPolicyTypeOrphan represents that all the resources in the manifestwork is orphaned + // when the manifestwork is deleted. + DeletePropagationPolicyTypeOrphan DeletePropagationPolicyType = "Orphan" + // DeletePropagationPolicyTypeSelectivelyOrphan represents that only selected resources in the manifestwork + // is orphaned when the manifestwork is deleted. + DeletePropagationPolicyTypeSelectivelyOrphan DeletePropagationPolicyType = "SelectivelyOrphan" +) + +// SelectivelyOrphan represents a list of resources following orphan deletion stratecy +type SelectivelyOrphan struct { + // orphaningRules defines a slice of orphaningrule. + // Each orphaningrule identifies a single resource included in this manifestwork + // +optional + OrphaningRules []OrphaningRule `json:"orphaningRules,omitempty"` +} + +// OrphaningRule identifies a single resource included in this manifestwork +type OrphaningRule struct { + // Group is the api group of the resources in the workload that the strategy is applied + // +required + Group string `json:"group"` + // Resource is the resources in the workload that the strategy is applied + // +required + Resource string `json:"resource"` + // Namespace is the namespaces of the resources in the workload that the strategy is applied + // +optional + Namespace string `json:"Namespace"` + // Name is the names of the resources in the workload that the strategy is applied + // +required + Name string `json:"Name"` +} + // ManifestResourceMeta represents the group, version, kind, as well as the group, version, resource, name and namespace of a resoure. type ManifestResourceMeta struct { // Ordinal represents the index of the manifest on spec. diff --git a/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go index fe872a4ba..c5e3e7edc 100644 --- a/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go @@ -123,6 +123,27 @@ func (in *AppliedManifestWorkStatus) DeepCopy() *AppliedManifestWorkStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeleteOption) DeepCopyInto(out *DeleteOption) { + *out = *in + if in.SelectivelyOrphan != nil { + in, out := &in.SelectivelyOrphan, &out.SelectivelyOrphan + *out = new(SelectivelyOrphan) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteOption. +func (in *DeleteOption) DeepCopy() *DeleteOption { + if in == nil { + return nil + } + out := new(DeleteOption) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Manifest) DeepCopyInto(out *Manifest) { *out = *in @@ -268,6 +289,11 @@ func (in *ManifestWorkList) DeepCopyObject() runtime.Object { func (in *ManifestWorkSpec) DeepCopyInto(out *ManifestWorkSpec) { *out = *in in.Workload.DeepCopyInto(&out.Workload) + if in.DeleteOption != nil { + in, out := &in.DeleteOption, &out.DeleteOption + *out = new(DeleteOption) + (*in).DeepCopyInto(*out) + } return } @@ -327,3 +353,40 @@ func (in *ManifestsTemplate) DeepCopy() *ManifestsTemplate { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OrphaningRule) DeepCopyInto(out *OrphaningRule) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrphaningRule. +func (in *OrphaningRule) DeepCopy() *OrphaningRule { + if in == nil { + return nil + } + out := new(OrphaningRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SelectivelyOrphan) DeepCopyInto(out *SelectivelyOrphan) { + *out = *in + if in.OrphaningRules != nil { + in, out := &in.OrphaningRules, &out.OrphaningRules + *out = make([]OrphaningRule, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelectivelyOrphan. +func (in *SelectivelyOrphan) DeepCopy() *SelectivelyOrphan { + if in == nil { + return nil + } + out := new(SelectivelyOrphan) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go index af4d08407..edc90bc74 100644 --- a/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go @@ -64,6 +64,15 @@ func (AppliedManifestWorkStatus) SwaggerDoc() map[string]string { return map_AppliedManifestWorkStatus } +var map_DeleteOption = map[string]string{ + "propagationPolicy": "propagationPolicy can be Foreground, Orphan or SelectivelyOrphan SelectivelyOrphan should be rarely used. It is provided for cases where particular resources is transfering ownership from one ManifestWork to another or another management unit. Setting this value will allow a flow like 1. create manifestwork/2 to manage foo 2. update manifestwork/1 to selectively orphan foo 3. remove foo from manifestwork/1 without impacting continuity because manifestwork/2 adopts it.", + "selectivelyOrphans": "selectivelyOrphan represents a list of resources following orphan deletion stratecy", +} + +func (DeleteOption) SwaggerDoc() map[string]string { + return map_DeleteOption +} + var map_Manifest = map[string]string{ "": "Manifest represents a resource to be deployed on managed cluster.", } @@ -127,8 +136,9 @@ func (ManifestWorkList) SwaggerDoc() map[string]string { } var map_ManifestWorkSpec = map[string]string{ - "": "ManifestWorkSpec represents a desired configuration of manifests to be deployed on the managed cluster.", - "workload": "Workload represents the manifest workload to be deployed on a managed cluster.", + "": "ManifestWorkSpec represents a desired configuration of manifests to be deployed on the managed cluster.", + "workload": "Workload represents the manifest workload to be deployed on a managed cluster.", + "deleteOption": "DeleteOption represents deletion strategy when the manifestwork is deleted. Foreground deletion strategy is applied to all the resource in this manifestwork if it is not set.", } func (ManifestWorkSpec) SwaggerDoc() map[string]string { @@ -154,4 +164,25 @@ func (ManifestsTemplate) SwaggerDoc() map[string]string { return map_ManifestsTemplate } +var map_OrphaningRule = map[string]string{ + "": "OrphaningRule identifies a single resource included in this manifestwork", + "group": "Group is the api group of the resources in the workload that the strategy is applied", + "resource": "Resource is the resources in the workload that the strategy is applied", + "Namespace": "Namespace is the namespaces of the resources in the workload that the strategy is applied", + "Name": "Name is the names of the resources in the workload that the strategy is applied", +} + +func (OrphaningRule) SwaggerDoc() map[string]string { + return map_OrphaningRule +} + +var map_SelectivelyOrphan = map[string]string{ + "": "SelectivelyOrphan represents a list of resources following orphan deletion stratecy", + "orphaningRules": "orphaningRules defines a slice of orphaningrule. Each orphaningrule identifies a single resource included in this manifestwork", +} + +func (SelectivelyOrphan) SwaggerDoc() map[string]string { + return map_SelectivelyOrphan +} + // AUTO-GENERATED FUNCTIONS END HERE