Open janmedrek opened 6 months ago
Acceptance Criteria for EPIC:
Timebox: 2 Days
Sub Issues:
I think we should use K8s explicit types and avoid obscure solutions (like mounted ConfigMaps/Secrets) for the Module Catalogue.
That's why I propose to have the Module Catalogue defined as:
Module Catalogue is a collection of Module Templates in the cluster the Lifecycle-Manger is deployed.
A given module should be available in multiple different versions, users should be able to enable a specific version in their cluster. This requirement does not contradict the channel concept. It should still be possible to "subscribe" to a given channel (which will be one of the versions marked with that channel).
[...]
- modules:
- name: my-module
version: 1.0.0
[...]
[...]
- modules:
- name: my-module
channel: fast
[...]
This requirement implies there are many versions of the given module to choose from. It is best modelled with many ModuleTemplate CRs - one for each version of the module. It's better to have multiple ModuleTemplates (one for a version) instead of one "big" ModuleTemplate for all versions, because the ModuleTemplate should be immutable. The benefits of immutability is, for example, much easier caching of the data. If we have a single ModuleTemplate CR for a given module that describes all of it's versions, then when a new version appears this ModuleTemplate CR must be edited (mutated). That's why it's better to have a single ModuleTemplate CR for a given version of a given module.
Another requirement is that versions may "belong to" a set of channels, so there is a mapping between versions and channels. A version may be assigned to a (possibly empty) set of channels. It seems reasonable then to add this mapping to the ModuleTemplate CR.
version
attribute in the Module list. The channel
attribute should be optional as well. User must provide either the version
or the channel
attribute.version
attribute in the ModuleTemplate type. The reason for that is to make the version explicit in the ModuleTemplate type. In later API versions, this attribute should be mandatory.name
an explicit attribute of ModuleTemplate spec. This should be optional in the next API version, eventually it should be required.ModuleTemplate:
An example of current ModuleTemplate CR type (version is an annotation):
kind: ModuleTemplate
metadata:
name: template-operator-regular
namespace: kcp-system
labels:
"operator.kyma-project.io/module-name": "template-operator"
annotations:
"operator.kyma-project.io/doc-url": "https://kyma-project.io"
"operator.kyma-project.io/is-cluster-scoped": "false"
"operator.kyma-project.io/module-version": "0.1.2"
spec:
channel: regular
mandatory: false
data:
[...]
descriptor:
[...]
An example of the "new" ModuleTemplate CR type with the version attribute:
kind: ModuleTemplate
metadata:
name: template-operator-0-1-2
namespace: kcp-system
labels:
"operator.kyma-project.io/module-name": "template-operator"
annotations:
"operator.kyma-project.io/doc-url": "https://kyma-project.io"
"operator.kyma-project.io/is-cluster-scoped": "false"
spec:
name: "template-operator"
channels: ["regular", "fast"]
version: 0.1.2
mandatory: false
data:
[...]
descriptor:
[...]
In addition I would like to have the module name be an explicit attribute in the ModuleTemplate CR. The label may remain for easier searching, but the module name should be explicit.
At this moment we only allow users to select the channel
.
After the change, the user will also be able to select the version
.
for that to work, the version
must refer to a unique ModuleTemplate.
I propose to make the following changes in the ModuleTemplate API:
Example:
A module version defined in the "regular" channel
kind: ModuleTemplate
[...]
spec:
channels: ["regular"]
version: 0.1.1
A module version defined in two channels:
kind: ModuleTemplate
[...]
spec:
channels: ["regular", "fast"]
version: 0.1.2
A standalone module version (no channel):
kind: ModuleTemplate
[...]
spec:
channels: []
version: 0.1.3
What if the team releases a module version as standalone, and later wants to publish it in the fast
channel? Similarly - what if the team initially publishes a module version in fast
channel and later on decides to publish it also in the regular
channel?
We have two options here:
channels
attribute to be modified in the ModuleTemplateI opt for option 2. as it simplifies module management - as ModuleTemplates are immutable, it's simpler to distribute/cache them.
For each module, there should be a list of "domain CRDs" that this module brings (i.e. Serverless will have Functions, Istio will have Gateways, Virtual Services...) that can be used to see which CRDs correspond to which module.
Option 1:
This can be done during the ModuleTemplate creation. We can extends modulectl create module
command (not yet existing) to parse the resources in order to find the CRDs. In addition we may allow user to explicitly add some CRDs manually.
kind: ModuleTemplate
metadata:
name: kyma-istio
namespace: kcp-system
spec:
version: 1.2.3
mandatory: false
managedResources:
- apiVersion: "networking.istio.io/v1beta1"
kind: "Gateway"
- apiVersion: "networking.istio.io/v1beta1"
kind: "VirtualService"
[...]
Option 2:
The managedResources
list is just a part of the module and is stored as a separate layer in the module artifact. The advantage of this approach is that the managedResources
is bound to the module definition at the module creation time, and it cannot be easily changed. This eliminates all sorts of errors related to invalid module configuration in the control-plane.
For the restricted markets there should be an option to configure the repository from which manifests are fetched (i.e. China market will use the China-restricted repository).
For now there is not enough information provided about the possible scenarios here. But it looks like we can implement this in the Lifecycle-Manager code, without affecting the API. One possible solution would be to add additional metadata to some ModuleTemplate CRs that would define the alternative repository URL. It could be an annotation. The Lifecycle-Manager would then use this metadata instead of the original repository URLs (taken from OCM descriptor) to fetch the relevant manifests.
Hi @pbochynski ,
We have some questions here, based on the current shipping kcp concept, we are versioning release channel, with the current approach, KLM is possible to use the latest channel version to get a list of latest module version.
However, in order to support the following request:
A given module should be available in multiple different versions, users should be able to enable a specific version in their cluster. This requirement does not contradict the channel concept. It should still be possible to "subscribe" to a given channel (which will be one of the versions marked with that channel).
How it aligned with the channel version then, to support multiple module versions, KLM must know all history versions of the channel first.
e.g:
channel/fast:1.0.0
contains istio:1.0.0
channel/fast:1.0.1
contains istio:1.1.0
to provide istio 1.0.0 and istio 1.1.0 to user in fast channel, KLM must know OCM component channel/fast
have two versions(1.0.0
, 1.0.1
) exists. Which means KLM have to introduce a process to scan all channel/fast
in OCM registry to build a reference between module and channel upfront. Is it necessary? But then, is it better we consider channel as a label attribute to kyma module?
Other questions:
1.0.0
contains v1alpha1
, in 1.1.0
introduce v1alpha1, v1alpha2
, in 1.2.0
deprecated v1alpha1
, but this version should make sure handle the version upgrade properly, then in 1.3.0
only keep v1alpha2
, if user directly jump from 1.0.0
to 1.3.0
, it's not possible, API server will not allow apply the CRD without v1alpha1
You can have a look at my PoC where I describe all component versions available in all channels: https://raw.githubusercontent.com/kyma-project/community-modules/main/model.json I use channels as a version attribute there. You do not need to know the history of the channel: you just apply the version for the channel or apply the version selected by the user. As in the current solution, you prevent downgrades based on semantic versioning. The only difference to the current logic is that if the current version is older than the oldest version listed in the shipment you automatically upgrade it (the user can't stay behind). This behavior is the same as what we have now with the regular channel (you can't stay behind regular channel also in the future)
The value of the feature is that you can decide about timing. You can still have a test cluster pinned to the fast channel, but your production channel you will upgrade when your SRE/dev team is available, and customers won't be affected. You can switch your production cluster to the version from the fast channel the next day after you successfully tested it on another cluster. So it is more control for the user. Of course, if you don't upgrade in 2 weeks (or whatever time we still support that version) you will be upgraded automatically.
After clarified with @pbochynski:
@pbochynski Hi Piotr, I have a question related to "managedResources". In your POC this list is common to all module versions. Is there a chance that this list changes from version to version? I think it's a valid use case. What then? The team must release a new module, with a different name?
Regarding the following statement from PB (see https://github.com/kyma-project/lifecycle-manager/issues/1472#issuecomment-2129344858):
You do not need to know the history of the channel: you just apply the version for the channel or apply the version selected by the user. As in the current solution, you prevent downgrades based on semantic versioning. The only difference to the current logic is that if the current version is older than the oldest version listed in the shipment you automatically upgrade it (the user can't stay behind). This behavior is the same as what we have now with the regular channel (you can't stay behind regular channel also in the future)
Not exactly sure what "shipment" means, but I would interpret this as follows:
- support for a module version may be sunset at a given point in time ("the current version is older than the oldest version listed in the shipment")
- when it has been sunset, an automatic update is forced on the version
If this understanding is correct, we need to clarify:
- [ ] a) what version to update to? Newest one, oldest still supported one, ...
- [ ] b) how to display the forced update to the user (see https://github.com/kyma-project/lifecycle-manager/issues/1590#issuecomment-2165708413)
- [ ] c) how to determine the module version is sunset (e.g., when no module template/version resource is found for a given version identifier)
EDIT: discussed the above with Xin. Basically, this is already described in point 4. here: https://github.com/kyma-project/lifecycle-manager/issues/1472#issuecomment-2129614726. If the user configured a channel, e.g., regular
, the module version will be auto updated with the evolution in the channel. If the user configured a fixed version, and the support for this version is dropped, we are not auto updating it and the module becomes unmanaged.
TODO: Consider introducing module version in MT's spec field
Description
Module catalogue (in this case - collection of Module Templates setup) should be adapted to the new requirements:
As for the implementation options, there are two main ones:
Reasons
We should adapt to the changing requirements and Community Modules concept.
Acceptance Criteria
Open Questions
Related Tickets