From 521f411c16638316ada934e34a75ec1d87ac3483 Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Tue, 2 Jul 2024 13:27:33 +0200 Subject: [PATCH 01/10] Add managedResources to ManifestSpec --- api/v1beta2/manifest_types.go | 4 ++++ api/v1beta2/zz_generated.deepcopy.go | 5 +++++ .../bases/operator.kyma-project.io_manifests.yaml | 14 ++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index ac52970a71..dcd14a1bfe 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -62,6 +62,10 @@ type ManifestSpec struct { // +nullable // Resource specifies a resource to be watched for state updates Resource *unstructured.Unstructured `json:"resource,omitempty"` + + // ManagedResources specifies a list of resources that are managed. The resources have the following format: + // //. + ManagedResources []string `json:"managedResources,omitempty"` } // ImageSpec defines OCI Image specifications. diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index c7376ac24d..35fb8c8f4b 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -289,6 +289,11 @@ func (in *ManifestSpec) DeepCopyInto(out *ManifestSpec) { in, out := &in.Resource, &out.Resource *out = (*in).DeepCopy() } + if in.ManagedResources != nil { + in, out := &in.ManagedResources, &out.ManagedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestSpec. diff --git a/config/crd/bases/operator.kyma-project.io_manifests.yaml b/config/crd/bases/operator.kyma-project.io_manifests.yaml index 35d03a9db8..f7d7cf3826 100644 --- a/config/crd/bases/operator.kyma-project.io_manifests.yaml +++ b/config/crd/bases/operator.kyma-project.io_manifests.yaml @@ -136,6 +136,13 @@ spec: - name - source type: object + managedResources: + description: |- + ManagedResources specifies a list of resources that are managed. The resources have the following format: + //. + items: + type: string + type: array remote: description: Remote indicates if Manifest should be installed on a remote cluster @@ -406,6 +413,13 @@ spec: - name - source type: object + managedResources: + description: |- + ManagedResources specifies a list of resources that are managed. The resources have the following format: + //. + items: + type: string + type: array remote: description: Remote indicates if Manifest should be installed on a remote cluster From 5b0de9dabdb253af2e32eab58f84587484e8bbed Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Tue, 2 Jul 2024 16:07:17 +0200 Subject: [PATCH 02/10] Add managedResources to ManifestSpec --- api/v1beta2/manifest_types.go | 4 ++-- .../crd/bases/operator.kyma-project.io_manifests.yaml | 8 ++++---- docs/technical-reference/api/manifest-cr.md | 11 +++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index dcd14a1bfe..76e6aa7959 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -63,8 +63,8 @@ type ManifestSpec struct { // Resource specifies a resource to be watched for state updates Resource *unstructured.Unstructured `json:"resource,omitempty"` - // ManagedResources specifies a list of resources that are managed. The resources have the following format: - // //. + // ManagedResources specifies a list of resources which are managed manually by the user. The resources have the + // following format: //. ManagedResources []string `json:"managedResources,omitempty"` } diff --git a/config/crd/bases/operator.kyma-project.io_manifests.yaml b/config/crd/bases/operator.kyma-project.io_manifests.yaml index f7d7cf3826..e501f647f6 100644 --- a/config/crd/bases/operator.kyma-project.io_manifests.yaml +++ b/config/crd/bases/operator.kyma-project.io_manifests.yaml @@ -138,8 +138,8 @@ spec: type: object managedResources: description: |- - ManagedResources specifies a list of resources that are managed. The resources have the following format: - //. + ManagedResources specifies a list of resources which are managed manually by the user. The resources have the + following format: //. items: type: string type: array @@ -415,8 +415,8 @@ spec: type: object managedResources: description: |- - ManagedResources specifies a list of resources that are managed. The resources have the following format: - //. + ManagedResources specifies a list of resources which are managed manually by the user. The resources have the + following format: //. items: type: string type: array diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index e6ee00ef8c..2115367119 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -85,6 +85,17 @@ The [internal spec resolver](../../../internal/manifest/spec_resolver.go) uses t The resource is the default data that should be initialized for the module and is directly copied from **.spec.data** of the ModuleTemplate CR after normalizing it with the **namespace** for the synchronized module. +### **.spec.managedResources** + +The managedResources are the resources which are managed manually by the user. They are represented by the `group/version/kind` format. +If the module is managed and gets deleted from the Kyma CR, module resources remain undeleted until all custom resources with GVK listed in the spec.managedResources are removed manually by the user. +```yaml +spec: + managedResources: + - serverless.kyma-project.io/v1alpha2/functions + - operator.kyma-project.io/v1alpha1/serverlesses +``` + ### **.status** The Manifest CR status is set based on the following logic, managed by the manifest reconciler: From ff9b953e54800745054d700ecb1304a7b622362d Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Tue, 2 Jul 2024 16:13:41 +0200 Subject: [PATCH 03/10] Fix docs deadlink --- docs/user-tutorials/01-10-control-plane-quick-start.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-tutorials/01-10-control-plane-quick-start.md b/docs/user-tutorials/01-10-control-plane-quick-start.md index 9a337dd20c..d7506fe4f7 100644 --- a/docs/user-tutorials/01-10-control-plane-quick-start.md +++ b/docs/user-tutorials/01-10-control-plane-quick-start.md @@ -39,7 +39,7 @@ To use Lifecycle Manager in a local setup, you need the following prerequisites: kubectl apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/charts/crds/crds/crd-servicemonitors.yaml ``` -You can also follow the official [Prometheus Operator quick start](https://prometheus-operator.dev/docs/prologue/quick-start/) guide to deploy a full set of Prometheus Operator features into your cluster. +You can also follow the official [Prometheus Operator quick start](https://prometheus-operator.dev/docs/getting-started/quick-start/) guide to deploy a full set of Prometheus Operator features into your cluster. ### Deploy Lifecycle Manager From b491c7741cce97f8ee6a535032cc1ed40913a295 Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Tue, 2 Jul 2024 16:19:59 +0200 Subject: [PATCH 04/10] Adjust docs --- api/v1beta2/manifest_types.go | 4 ++-- config/crd/bases/operator.kyma-project.io_manifests.yaml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index 76e6aa7959..95cedc3d51 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -63,8 +63,8 @@ type ManifestSpec struct { // Resource specifies a resource to be watched for state updates Resource *unstructured.Unstructured `json:"resource,omitempty"` - // ManagedResources specifies a list of resources which are managed manually by the user. The resources have the - // following format: //. + // ManagedResources specifies a list of resources which are managed + // manually by the user. The resources have the following format: //. ManagedResources []string `json:"managedResources,omitempty"` } diff --git a/config/crd/bases/operator.kyma-project.io_manifests.yaml b/config/crd/bases/operator.kyma-project.io_manifests.yaml index e501f647f6..c06c08e5e6 100644 --- a/config/crd/bases/operator.kyma-project.io_manifests.yaml +++ b/config/crd/bases/operator.kyma-project.io_manifests.yaml @@ -138,8 +138,8 @@ spec: type: object managedResources: description: |- - ManagedResources specifies a list of resources which are managed manually by the user. The resources have the - following format: //. + ManagedResources specifies a list of resources which are managed + manually by the user. The resources have the following format: //. items: type: string type: array @@ -415,8 +415,8 @@ spec: type: object managedResources: description: |- - ManagedResources specifies a list of resources which are managed manually by the user. The resources have the - following format: //. + ManagedResources specifies a list of resources which are managed + manually by the user. The resources have the following format: //. items: type: string type: array From 3e1cd494611b921251d5aa08724baeeb2a2ff204 Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Thu, 4 Jul 2024 09:19:23 +0200 Subject: [PATCH 05/10] Code review comments --- api/v1beta2/manifest_types.go | 1 + docs/technical-reference/api/manifest-cr.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index 95cedc3d51..1acf8bc1fc 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -65,6 +65,7 @@ type ManifestSpec struct { // ManagedResources specifies a list of resources which are managed // manually by the user. The resources have the following format: //. + // +optional ManagedResources []string `json:"managedResources,omitempty"` } diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index 2115367119..643e9edf83 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -88,7 +88,7 @@ The resource is the default data that should be initialized for the module and i ### **.spec.managedResources** The managedResources are the resources which are managed manually by the user. They are represented by the `group/version/kind` format. -If the module is managed and gets deleted from the Kyma CR, module resources remain undeleted until all custom resources with GVK listed in the spec.managedResources are removed manually by the user. +If the module is managed and gets deleted from the Kyma CR, module deletion is suspended until all custom resources with GVK listed in the spec.managedResources are removed manually by the user. ```yaml spec: managedResources: From 09259b58c66c849b8e543613b75d6651ebb7aa54 Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Thu, 4 Jul 2024 10:43:38 +0200 Subject: [PATCH 06/10] TWS review --- docs/technical-reference/api/manifest-cr.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index 643e9edf83..93564b8440 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -87,8 +87,8 @@ The resource is the default data that should be initialized for the module and i ### **.spec.managedResources** -The managedResources are the resources which are managed manually by the user. They are represented by the `group/version/kind` format. -If the module is managed and gets deleted from the Kyma CR, module deletion is suspended until all custom resources with GVK listed in the spec.managedResources are removed manually by the user. +The managed resources are the resources that are handled manually by the user. They are represented by the `group/version/kind` format. +Suppose the module is managed and gets deleted from the Kyma CR. In that case, the module deletion is suspended until all custom resources with GVK listed in the **spec.managedResources** are removed manually by the user. ```yaml spec: managedResources: From 8f334281bcd98674dbcf3ab90c3d99bb18dfe75f Mon Sep 17 00:00:00 2001 From: "Badr, Nesma" Date: Mon, 8 Jul 2024 11:47:51 +0200 Subject: [PATCH 07/10] Renaming ManagedResources to AssociatedResources --- api/v1beta2/manifest_types.go | 6 ++-- api/v1beta2/zz_generated.deepcopy.go | 4 +-- .../operator.kyma-project.io_manifests.yaml | 28 +++++++++---------- docs/technical-reference/api/manifest-cr.md | 6 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index 1acf8bc1fc..a8f0485c51 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -63,10 +63,10 @@ type ManifestSpec struct { // Resource specifies a resource to be watched for state updates Resource *unstructured.Unstructured `json:"resource,omitempty"` - // ManagedResources specifies a list of resources which are managed - // manually by the user. The resources have the following format: //. + // AssociatedResources specifies a list of resources which are not managed + // by the lifecycle manager. The resources have the following format: //. // +optional - ManagedResources []string `json:"managedResources,omitempty"` + AssociatedResources []string `json:"associatedResources,omitempty"` } // ImageSpec defines OCI Image specifications. diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 35fb8c8f4b..74f9f5ade7 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -289,8 +289,8 @@ func (in *ManifestSpec) DeepCopyInto(out *ManifestSpec) { in, out := &in.Resource, &out.Resource *out = (*in).DeepCopy() } - if in.ManagedResources != nil { - in, out := &in.ManagedResources, &out.ManagedResources + if in.AssociatedResources != nil { + in, out := &in.AssociatedResources, &out.AssociatedResources *out = make([]string, len(*in)) copy(*out, *in) } diff --git a/config/crd/bases/operator.kyma-project.io_manifests.yaml b/config/crd/bases/operator.kyma-project.io_manifests.yaml index c06c08e5e6..d866be8855 100644 --- a/config/crd/bases/operator.kyma-project.io_manifests.yaml +++ b/config/crd/bases/operator.kyma-project.io_manifests.yaml @@ -49,6 +49,13 @@ spec: spec: description: ManifestSpec defines the desired state of Manifest. properties: + associatedResources: + description: |- + AssociatedResources specifies a list of resources which are not managed + by the lifecycle manager. The resources have the following format: //. + items: + type: string + type: array config: description: Config specifies OCI image configuration for Manifest properties: @@ -136,13 +143,6 @@ spec: - name - source type: object - managedResources: - description: |- - ManagedResources specifies a list of resources which are managed - manually by the user. The resources have the following format: //. - items: - type: string - type: array remote: description: Remote indicates if Manifest should be installed on a remote cluster @@ -326,6 +326,13 @@ spec: spec: description: ManifestSpec defines the desired state of Manifest. properties: + associatedResources: + description: |- + AssociatedResources specifies a list of resources which are not managed + by the lifecycle manager. The resources have the following format: //. + items: + type: string + type: array config: description: Config specifies OCI image configuration for Manifest properties: @@ -413,13 +420,6 @@ spec: - name - source type: object - managedResources: - description: |- - ManagedResources specifies a list of resources which are managed - manually by the user. The resources have the following format: //. - items: - type: string - type: array remote: description: Remote indicates if Manifest should be installed on a remote cluster diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index 93564b8440..b4c384d7e6 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -85,13 +85,13 @@ The [internal spec resolver](../../../internal/manifest/spec_resolver.go) uses t The resource is the default data that should be initialized for the module and is directly copied from **.spec.data** of the ModuleTemplate CR after normalizing it with the **namespace** for the synchronized module. -### **.spec.managedResources** +### **.spec.associatedResources** -The managed resources are the resources that are handled manually by the user. They are represented by the `group/version/kind` format. +The associated resources are the resources that are not managed by the lifecycle manager. They are represented by the `group/version/kind` format. Suppose the module is managed and gets deleted from the Kyma CR. In that case, the module deletion is suspended until all custom resources with GVK listed in the **spec.managedResources** are removed manually by the user. ```yaml spec: - managedResources: + associatedResources: - serverless.kyma-project.io/v1alpha2/functions - operator.kyma-project.io/v1alpha1/serverlesses ``` From 403680ba8ec3c6edc6c7f40592e54af327264dbd Mon Sep 17 00:00:00 2001 From: Nesma Badr Date: Mon, 8 Jul 2024 12:24:54 +0200 Subject: [PATCH 08/10] Update manifest-cr.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/technical-reference/api/manifest-cr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index b4c384d7e6..90fcb183e0 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -87,7 +87,7 @@ The resource is the default data that should be initialized for the module and i ### **.spec.associatedResources** -The associated resources are the resources that are not managed by the lifecycle manager. They are represented by the `group/version/kind` format. +Associated resources are resources that are not managed by Lifecycle Manager. They are represented by the `group/version/kind` format. Suppose the module is managed and gets deleted from the Kyma CR. In that case, the module deletion is suspended until all custom resources with GVK listed in the **spec.managedResources** are removed manually by the user. ```yaml spec: From 7724afb34d02c39ea5c136e661facae39b98ba49 Mon Sep 17 00:00:00 2001 From: Nesma Badr Date: Mon, 8 Jul 2024 12:25:01 +0200 Subject: [PATCH 09/10] Update manifest-cr.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/technical-reference/api/manifest-cr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/technical-reference/api/manifest-cr.md b/docs/technical-reference/api/manifest-cr.md index 90fcb183e0..73a6c388a4 100644 --- a/docs/technical-reference/api/manifest-cr.md +++ b/docs/technical-reference/api/manifest-cr.md @@ -88,7 +88,7 @@ The resource is the default data that should be initialized for the module and i ### **.spec.associatedResources** Associated resources are resources that are not managed by Lifecycle Manager. They are represented by the `group/version/kind` format. -Suppose the module is managed and gets deleted from the Kyma CR. In that case, the module deletion is suspended until all custom resources with GVK listed in the **spec.managedResources** are removed manually by the user. +Suppose the module is managed and gets deleted from the Kyma CR. In that case, the module deletion is suspended until all custom resources with GVK listed in the **spec.associatedResources** are removed manually by the user. ```yaml spec: associatedResources: From 0395b3839bb0801b733a452a6d29d8c3451503dc Mon Sep 17 00:00:00 2001 From: Nesma Badr Date: Mon, 8 Jul 2024 12:27:02 +0200 Subject: [PATCH 10/10] Update manifest_types.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- api/v1beta2/manifest_types.go | 2 +- config/crd/bases/operator.kyma-project.io_manifests.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v1beta2/manifest_types.go b/api/v1beta2/manifest_types.go index a8f0485c51..e8fd1e6e31 100644 --- a/api/v1beta2/manifest_types.go +++ b/api/v1beta2/manifest_types.go @@ -64,7 +64,7 @@ type ManifestSpec struct { Resource *unstructured.Unstructured `json:"resource,omitempty"` // AssociatedResources specifies a list of resources which are not managed - // by the lifecycle manager. The resources have the following format: //. + // by Lifecycle Manager. The resources have the following format: //. // +optional AssociatedResources []string `json:"associatedResources,omitempty"` } diff --git a/config/crd/bases/operator.kyma-project.io_manifests.yaml b/config/crd/bases/operator.kyma-project.io_manifests.yaml index d866be8855..146c8df820 100644 --- a/config/crd/bases/operator.kyma-project.io_manifests.yaml +++ b/config/crd/bases/operator.kyma-project.io_manifests.yaml @@ -52,7 +52,7 @@ spec: associatedResources: description: |- AssociatedResources specifies a list of resources which are not managed - by the lifecycle manager. The resources have the following format: //. + by Lifecycle Manager. The resources have the following format: //. items: type: string type: array @@ -329,7 +329,7 @@ spec: associatedResources: description: |- AssociatedResources specifies a list of resources which are not managed - by the lifecycle manager. The resources have the following format: //. + by Lifecycle Manager. The resources have the following format: //. items: type: string type: array