From 5cd4fcb953c75aad8581948c9385d42e4a1d171b Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Mon, 14 Oct 2024 17:41:26 +0200 Subject: [PATCH 01/10] add spec.manager --- api-version-compatibility-config.yaml | 1 + api/v1beta2/moduletemplate_types.go | 25 ++++++++++++++- api/v1beta2/zz_generated.deepcopy.go | 26 ++++++++++++++- ...rator.kyma-project.io_moduletemplates.yaml | 27 ++++++++++++++++ .../resources/03-moduletemplate.md | 32 +++++++++++++++++++ 5 files changed, 109 insertions(+), 2 deletions(-) diff --git a/api-version-compatibility-config.yaml b/api-version-compatibility-config.yaml index e625bfd6f6..2fce8f496b 100644 --- a/api-version-compatibility-config.yaml +++ b/api-version-compatibility-config.yaml @@ -26,4 +26,5 @@ operator.kyma-project.io_moduletemplates.yaml: - .spec.properties.customStateCheck.description - .spec.properties.resources - .spec.properties.info + - .spec.properties.manager - .spec.properties.associatedResources diff --git a/api/v1beta2/moduletemplate_types.go b/api/v1beta2/moduletemplate_types.go index 712b8294cb..1255447527 100644 --- a/api/v1beta2/moduletemplate_types.go +++ b/api/v1beta2/moduletemplate_types.go @@ -138,11 +138,34 @@ type ModuleTemplateSpec struct { // Info contains metadata about the module. // +optional - Info ModuleInfo `json:"info,omitempty"` + Info *ModuleInfo `json:"info,omitempty"` // AssociatedResources is a list of module related resources that usually must be cleaned when uninstalling a module. Informational purpose only. // +optional AssociatedResources []apimetav1.GroupVersionKind `json:"associatedResources,omitempty"` + + // Manager contains information identifying a module's resource that indicates the readiness of the module. Typically, this should be the manager Deployment of the module. + // +optional + Manager *Manager `json:"manager,omitempty"` +} + +// Manager defines the structure for the manager field in ModuleTemplateSpec. +type Manager struct { + // Group is the API group of the manager. + Group string `json:"group"` + + // Version is the API version of the manager. + Version string `json:"version"` + + // Kind is the kind of the manager. + Kind string `json:"kind"` + + // Namespace is the namespace of the manager. It is optional. + // +optional + Namespace string `json:"namespace,omitempty"` + + // Name is the name of the manager. + Name string `json:"name"` } type ModuleInfo struct { diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index e15a03b756..23a7fbaf39 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -216,6 +216,21 @@ func (in *KymaStatus) DeepCopy() *KymaStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Manager) DeepCopyInto(out *Manager) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Manager. +func (in *Manager) DeepCopy() *Manager { + if in == nil { + return nil + } + out := new(Manager) + 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 @@ -540,12 +555,21 @@ func (in *ModuleTemplateSpec) DeepCopyInto(out *ModuleTemplateSpec) { *out = make([]Resource, len(*in)) copy(*out, *in) } - in.Info.DeepCopyInto(&out.Info) + if in.Info != nil { + in, out := &in.Info, &out.Info + *out = new(ModuleInfo) + (*in).DeepCopyInto(*out) + } if in.AssociatedResources != nil { in, out := &in.AssociatedResources, &out.AssociatedResources *out = make([]v1.GroupVersionKind, len(*in)) copy(*out, *in) } + if in.Manager != nil { + in, out := &in.Manager, &out.Manager + *out = new(Manager) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleTemplateSpec. diff --git a/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml b/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml index f3f250d56d..52c966e14e 100644 --- a/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml +++ b/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml @@ -274,6 +274,33 @@ spec: - documentation - repository type: object + manager: + description: Manager contains information identifying a module's resource + which identify the readiness of the module, normally it should be + the manager Deployment of the module. + properties: + group: + description: Group is the API group of the manager. + type: string + kind: + description: Kind is the kind of the manager. + type: string + name: + description: Name is the name of the manager. + type: string + namespace: + description: Namespace is the namespace of the manager. It is + optional. + type: string + version: + description: Version is the API version of the manager. + type: string + required: + - group + - kind + - name + - version + type: object mandatory: description: |- Mandatory indicates whether the module is mandatory. It is used to enforce the installation of the module with diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index e7d5802a49..b56c88332b 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -75,6 +75,38 @@ spec: - documentation: The link to the documentation of the module. - icons: A list of icons of the module, each with a name and link. +### **.spec.manager** + +The `manager` field provides details about a module's resource that indicates its readiness. Typically, this is the +`Deployment` managing the module. If the resource is not namespaced, such as the module CR's `CRD`, the namespace can be +optional. + +For example, if the module has a manager `Deployment` in the `kyma-system` namespace: + +```yaml +spec: + manager: + group: apps + version: v1 + kind: Deployment + namespace: kyma-system + name: [module manager] +``` + +For a module without a manager, such as [cloud manager](https://github.com/kyma-project/cloud-manager): + +```yaml +spec: + manager: + group: apiextensions.k8s.io + version: v1 + kind: CustomResourceDefinition + name: [module CRD] +``` + +This field helps identify the module's manager, which is useful for determining whether a module is successfully +installed, especially in manual installation scenarios. + ### **.spec.customStateCheck** > **CAUTION:** This field was deprecated at the end of July 2024 and will be deleted in the next ModuleTemplate API version. As of the deletion day, you can define the custom state only in a module's custom resource. From b50e7dfbbc5053d46e9a018f038f150828b97c1b Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Tue, 15 Oct 2024 13:52:14 +0200 Subject: [PATCH 02/10] Update api/v1beta2/moduletemplate_types.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Schwägerl --- api/v1beta2/moduletemplate_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1beta2/moduletemplate_types.go b/api/v1beta2/moduletemplate_types.go index 1255447527..a235c5c720 100644 --- a/api/v1beta2/moduletemplate_types.go +++ b/api/v1beta2/moduletemplate_types.go @@ -144,7 +144,7 @@ type ModuleTemplateSpec struct { // +optional AssociatedResources []apimetav1.GroupVersionKind `json:"associatedResources,omitempty"` - // Manager contains information identifying a module's resource that indicates the readiness of the module. Typically, this should be the manager Deployment of the module. + // Manager contains information for identifying a module's resource that can be used as indicator for the installation readiness of the module. Typically, this is the manager Deployment of the module. In exceptional cases, it may also be another resource. // +optional Manager *Manager `json:"manager,omitempty"` } From 7149550d9d1f8adc0c1fdf2a4b4377e9b9761079 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Tue, 15 Oct 2024 13:56:10 +0200 Subject: [PATCH 03/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Schwägerl --- docs/contributor/resources/03-moduletemplate.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index b56c88332b..92a06ef7f4 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -77,9 +77,7 @@ spec: ### **.spec.manager** -The `manager` field provides details about a module's resource that indicates its readiness. Typically, this is the -`Deployment` managing the module. If the resource is not namespaced, such as the module CR's `CRD`, the namespace can be -optional. +The `manager` field provides information for identifying a module's resource that can be used as indicator for the installation readiness of the module. Typically, this is the manager Deployment of the module. In exceptional cases, it may also be another resource. If the resource is not namespaced, such as the module CR's `CRD`, the namespace can be optional. For example, if the module has a manager `Deployment` in the `kyma-system` namespace: From 1ebb7b4aaee31cce5bc9afc026328e7a37d8c0f5 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Tue, 15 Oct 2024 13:56:21 +0200 Subject: [PATCH 04/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Schwägerl --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 92a06ef7f4..1eb2709302 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -88,7 +88,7 @@ spec: version: v1 kind: Deployment namespace: kyma-system - name: [module manager] + name: [module manager name] ``` For a module without a manager, such as [cloud manager](https://github.com/kyma-project/cloud-manager): From 16b3346b058f31a55cb848e91a0595e61053d36e Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Tue, 15 Oct 2024 13:56:28 +0200 Subject: [PATCH 05/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Schwägerl --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 1eb2709302..9ca3490f6d 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -99,7 +99,7 @@ spec: group: apiextensions.k8s.io version: v1 kind: CustomResourceDefinition - name: [module CRD] + name: [module CRD name] ``` This field helps identify the module's manager, which is useful for determining whether a module is successfully From c9076e351f2fd4b7bc4cf87767fa65db45c8f2b0 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Tue, 15 Oct 2024 14:07:26 +0200 Subject: [PATCH 06/10] replace with apimetav1.GroupVersionKind --- api/v1beta2/moduletemplate_types.go | 11 ++--------- api/v1beta2/zz_generated.deepcopy.go | 1 + .../operator.kyma-project.io_moduletemplates.yaml | 10 ++++------ docs/contributor/resources/03-moduletemplate.md | 4 ---- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/api/v1beta2/moduletemplate_types.go b/api/v1beta2/moduletemplate_types.go index a235c5c720..39412ace2d 100644 --- a/api/v1beta2/moduletemplate_types.go +++ b/api/v1beta2/moduletemplate_types.go @@ -144,21 +144,14 @@ type ModuleTemplateSpec struct { // +optional AssociatedResources []apimetav1.GroupVersionKind `json:"associatedResources,omitempty"` - // Manager contains information for identifying a module's resource that can be used as indicator for the installation readiness of the module. Typically, this is the manager Deployment of the module. In exceptional cases, it may also be another resource. + // Manager contains information for identifying a module's resource that can be used as indicator for the installation readiness of the module. Typically, this is the manager Deployment of the module. In exceptional cases, it may also be another resource. // +optional Manager *Manager `json:"manager,omitempty"` } // Manager defines the structure for the manager field in ModuleTemplateSpec. type Manager struct { - // Group is the API group of the manager. - Group string `json:"group"` - - // Version is the API version of the manager. - Version string `json:"version"` - - // Kind is the kind of the manager. - Kind string `json:"kind"` + apimetav1.GroupVersionKind `json:",inline"` // Namespace is the namespace of the manager. It is optional. // +optional diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 23a7fbaf39..0a706f894c 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -219,6 +219,7 @@ func (in *KymaStatus) DeepCopy() *KymaStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Manager) DeepCopyInto(out *Manager) { *out = *in + out.GroupVersionKind = in.GroupVersionKind } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Manager. diff --git a/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml b/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml index 52c966e14e..7ded5e140b 100644 --- a/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml +++ b/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml @@ -275,15 +275,14 @@ spec: - repository type: object manager: - description: Manager contains information identifying a module's resource - which identify the readiness of the module, normally it should be - the manager Deployment of the module. + description: Manager contains information for identifying a module's + resource that can be used as indicator for the installation readiness + of the module. Typically, this is the manager Deployment of the + module. In exceptional cases, it may also be another resource. properties: group: - description: Group is the API group of the manager. type: string kind: - description: Kind is the kind of the manager. type: string name: description: Name is the name of the manager. @@ -293,7 +292,6 @@ spec: optional. type: string version: - description: Version is the API version of the manager. type: string required: - group diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 9ca3490f6d..3d4bc21e9f 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -101,10 +101,6 @@ spec: kind: CustomResourceDefinition name: [module CRD name] ``` - -This field helps identify the module's manager, which is useful for determining whether a module is successfully -installed, especially in manual installation scenarios. - ### **.spec.customStateCheck** > **CAUTION:** This field was deprecated at the end of July 2024 and will be deleted in the next ModuleTemplate API version. As of the deletion day, you can define the custom state only in a module's custom resource. From 00defdc9c19d38e18c7e13653442830b6c36a817 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Wed, 16 Oct 2024 10:44:01 +0200 Subject: [PATCH 07/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 3d4bc21e9f..503e0f5406 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -77,7 +77,7 @@ spec: ### **.spec.manager** -The `manager` field provides information for identifying a module's resource that can be used as indicator for the installation readiness of the module. Typically, this is the manager Deployment of the module. In exceptional cases, it may also be another resource. If the resource is not namespaced, such as the module CR's `CRD`, the namespace can be optional. +The `manager` field provides information for identifying a module's resource that can indicate the module's installation readiness. Typically, the manager is the module's `Deployment` resource. In exceptional cases, it may also be another resource. The **namespace** parameter is optional if the resource is not namespaced. For example, if the resource is the module CR's `CustomResourceDefinition`. For example, if the module has a manager `Deployment` in the `kyma-system` namespace: From 1da8d5a35ecf1be09d4496e2486027017c1fe5ed Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Wed, 16 Oct 2024 10:44:15 +0200 Subject: [PATCH 08/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 503e0f5406..9bde536228 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -79,7 +79,7 @@ spec: The `manager` field provides information for identifying a module's resource that can indicate the module's installation readiness. Typically, the manager is the module's `Deployment` resource. In exceptional cases, it may also be another resource. The **namespace** parameter is optional if the resource is not namespaced. For example, if the resource is the module CR's `CustomResourceDefinition`. -For example, if the module has a manager `Deployment` in the `kyma-system` namespace: +In this example, the module's manager is the `Deployment` resource in the `kyma-system` namespace. ```yaml spec: From b662e136d34e136816f73969e62e15b953ee2013 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Wed, 16 Oct 2024 10:46:24 +0200 Subject: [PATCH 09/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 9bde536228..8d94f796aa 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -91,7 +91,7 @@ spec: name: [module manager name] ``` -For a module without a manager, such as [cloud manager](https://github.com/kyma-project/cloud-manager): +In this example, the module doesn't have a manager and in the **manager** field you specifie the module's `CustomResourceDefinition`. For example, of the [Cloud Manager](https://github.com/kyma-project/cloud-manager) module: ```yaml spec: From 02932215b93f7cb475ba265ba3c8d915a97dcce3 Mon Sep 17 00:00:00 2001 From: Xin Ruan Date: Wed, 16 Oct 2024 11:15:26 +0200 Subject: [PATCH 10/10] Update docs/contributor/resources/03-moduletemplate.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Małgorzata Świeca --- docs/contributor/resources/03-moduletemplate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributor/resources/03-moduletemplate.md b/docs/contributor/resources/03-moduletemplate.md index 8d94f796aa..570d6f66d1 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -91,7 +91,7 @@ spec: name: [module manager name] ``` -In this example, the module doesn't have a manager and in the **manager** field you specifie the module's `CustomResourceDefinition`. For example, of the [Cloud Manager](https://github.com/kyma-project/cloud-manager) module: +In this example, the module's manager is the module's `CustomResourceDefinition` that does not require the **namespace** parameter. ```yaml spec: