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..39412ace2d 100644 --- a/api/v1beta2/moduletemplate_types.go +++ b/api/v1beta2/moduletemplate_types.go @@ -138,11 +138,27 @@ 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 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 { + apimetav1.GroupVersionKind `json:",inline"` + + // 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..0a706f894c 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -216,6 +216,22 @@ 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 + out.GroupVersionKind = in.GroupVersionKind +} + +// 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 +556,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..7ded5e140b 100644 --- a/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml +++ b/config/crd/bases/operator.kyma-project.io_moduletemplates.yaml @@ -274,6 +274,31 @@ spec: - documentation - repository type: object + manager: + 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: + type: string + kind: + 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: + 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..570d6f66d1 100644 --- a/docs/contributor/resources/03-moduletemplate.md +++ b/docs/contributor/resources/03-moduletemplate.md @@ -75,6 +75,32 @@ 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 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`. + +In this example, the module's manager is the `Deployment` resource in the `kyma-system` namespace. + +```yaml +spec: + manager: + group: apps + version: v1 + kind: Deployment + namespace: kyma-system + name: [module manager name] +``` + +In this example, the module's manager is the module's `CustomResourceDefinition` that does not require the **namespace** parameter. + +```yaml +spec: + manager: + group: apiextensions.k8s.io + version: v1 + kind: CustomResourceDefinition + name: [module CRD name] +``` ### **.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.