From fff5ed5991e349d58464e233ba347d9e9b55ea8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 3 Jul 2024 15:51:55 +0200 Subject: [PATCH] feat: Re-add `.spec.modules[].managed` to KymaCR (#1661) feat: Re-add '.spec.modules[].managed' to KymaCR --- api/v1beta2/kyma_types.go | 5 ++++ .../bases/operator.kyma-project.io_kymas.yaml | 14 +++++++++ docs/technical-reference/api/kyma-cr.md | 29 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/api/v1beta2/kyma_types.go b/api/v1beta2/kyma_types.go index dff905ad65..110d9073c1 100644 --- a/api/v1beta2/kyma_types.go +++ b/api/v1beta2/kyma_types.go @@ -82,6 +82,11 @@ type Module struct { // +kubebuilder:default:=CreateAndDelete CustomResourcePolicy `json:"customResourcePolicy,omitempty"` + + // Managed is determining whether the module is managed or not. If the module is unmanaged, the user is responsible + // for the lifecycle of the module. + // +kubebuilder:default:=true + Managed bool `json:"managed"` } // CustomResourcePolicy determines how a ModuleTemplate should be parsed. When CustomResourcePolicy is set to diff --git a/config/crd/bases/operator.kyma-project.io_kymas.yaml b/config/crd/bases/operator.kyma-project.io_kymas.yaml index 304b0cc8cd..a4927b64a9 100644 --- a/config/crd/bases/operator.kyma-project.io_kymas.yaml +++ b/config/crd/bases/operator.kyma-project.io_kymas.yaml @@ -84,6 +84,12 @@ spec: - CreateAndDelete - Ignore type: string + managed: + default: true + description: |- + Managed is determining whether the module is managed or not. If the module is unmanaged, the user is responsible + for the lifecycle of the module. + type: boolean name: description: |- Name is a unique identifier of the module. @@ -98,6 +104,7 @@ spec: It will be removed in the upcoming API version. type: string required: + - managed - name type: object type: array @@ -517,6 +524,12 @@ spec: - CreateAndDelete - Ignore type: string + managed: + default: true + description: |- + Managed is determining whether the module is managed or not. If the module is unmanaged, the user is responsible + for the lifecycle of the module. + type: boolean name: description: |- Name is a unique identifier of the module. @@ -531,6 +544,7 @@ spec: It will be removed in the upcoming API version. type: string required: + - managed - name type: object type: array diff --git a/docs/technical-reference/api/kyma-cr.md b/docs/technical-reference/api/kyma-cr.md index 713c04248e..02ea4366e0 100644 --- a/docs/technical-reference/api/kyma-cr.md +++ b/docs/technical-reference/api/kyma-cr.md @@ -73,11 +73,38 @@ spec: > **CAUTION:** > Module referencing using NamespacedName and FQDN (Fully Qualified Domain Name) has been deprecated. +### **.spec.modules[].managed** + +For each module, it must be defined whether it is `managed` or `unmanaged`. +If it is `managed`, Lifecycle Manager takes care of the module's lifecycle (creating, updating, deleting). +If it is `unmanaged`, Lifecycle Manager ignores the module and the users must take care of the lifecycle themselves. +To define this, the **managed** flag must be either `true` or `false`. +By default, the **managed** flag is set to `true` and the module is therefore `managed` by Lifecycle Manager. + +```yaml +spec: + channel: regular + modules: + - name: module-name-from-label + managed: true +``` + ### **.spec.modules[].customResourcePolicy** -In addition to this very flexible way of referencing modules, there is also another flag that can be important for users requiring more flexibility during module initialization. The `customResourcePolicy` flag is used to define one of `CreateAndDelete` and `Ignore`. +A module may be initialized with preconfigured default data. +To control the configuration, use the **customResourcePolicy** flag. +The value can either be `CreateAndDelete` or `Ignore`. While `CreateAndDelete` causes the ModuleTemplate CR's **.spec.data** to be created and deleted to initialize a module with preconfigured defaults, `Ignore` can be used to only initialize the operator without initializing any default data. This allows users to be fully flexible in regard to when and how to initialize their module. +By default, the **customResourcePolicy** flag is `CreateAndDelete` which makes the module preconfigured. + +```yaml +spec: + channel: regular + modules: + - name: module-name-from-label + customResourcePolicy: CreateAndDelete +``` ### **.status.state**