-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deletion Modes] Introduce a managed field for each module in the Kyma CR Modules List #1566
Comments
I have two question marks here.
Then: is this field mutable?
How should Lifecycle-Manager process this deletion? Using the |
Regarding the field being optional with default Non-option// +kubebuilder:default:=true
Managed bool `json:"managed,omitempty"` This does NOT work. When setting Option 1// +kubebuilder:default:=true
Managed bool `json:"managed"` This will make
Option 2If we want to have a behavior where the field can be omitted, and a missing field defaulting to true, we would need to implement it as follows: // note no default
Managed *bool `json:"managed,omitempty"`
func (m *Module) IsManaged() bool {
if m.Managed == nil {
return true
}
return *m.Managed
} The empty value is a nil pointer. We use a helper method that defaults the nil pointer to
Personally, I would favor Option 1 as it is more explicit compared to internally handling an unset value / nil pointer as true. Also, we do want to make the attribute mandatory anyway. |
Re. API compatibility of Option 2: I think it should be good. I tested the behavior multiple times now. When shipping the new fields (updating lifecycle manager and Kyma CRD at the sime time), the KymaCR in KCP gets an entry with I also tried the same thing with keeping the current lifecycle-manager, and only updating the CRD. Not knowing the field, lifecycle-manager seems to ignore it (no crashes), but it syncs the CRD correctly which also leads to CRs having Looking at the literature... it is a bit tricky to be exactly sure... Here it mentions that fields can be added given that reasonable defaults are defined:
Here it however lists adding a required field as an incompatible change. However, I think we are good on points #1 and #2 (all API calls will remain to work as expected). One point that may be problematic in theory: "4. It must be possible to round-trip your change (convert to different API versions and back) with no loss of information.". If we had a scenario where a component not aware of the new
|
summary:
|
Feature branch is created now: https://github.com/kyma-project/lifecycle-manager/tree/feat/deletion-mode |
Re-opening this as we have an edge case to clarify... A key assumption is, that we can never know when a reconciliation of the KymaCR will happen (e.g., due to delays of KLM) and that a KymaCR may be changed multiple times by the customer before the next reconciliation happens. Problematic scenario: Given a customers sets a module to // T1 last reconciled state
spec:
modules:
- name: template-operator
managed: true
// ...
---
//T2 no reconciliation happened on this state
spec:
modules:
- name: template-operator
managed: false
// ...
---
//T3 next reconciliation after the last one at T1
spec:
modules:
// ... When KLM fetches the current state at T3, we only see that the module is gone, but we don't know that it had been previously set to TODOs
|
discussed with the team to keep this field and go forward with the approach defined in #1427 |
Description
In order to support deletion modes for modules, there should be a flag while enabling each module in the Kyma CR to indicate whether the module is managed or not.
Reasons
To support unmanaged modules.
Acceptance Criteria
optionalrequiredManaged
field to each module in the Kyma CR modules listtrue
Update issue comment to ensure the newly introduced field is mandatory in new API version: Modularization API Upgrade #776 (comment)Feature Testing
No response
Testing approach
No response
Attachments
No response
The text was updated successfully, but these errors were encountered: