-
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
fix: Set manifest to deleting state; Raise errors on unexpected manager conditions #1833
Merged
kyma-bot
merged 5 commits into
kyma-project:main
from
c-pius:fix/explicit-errors-in-manager-state
Sep 9, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
30a4c5f
fix: Use explicit errors when determining manager state
c-pius 0c1c049
Merge branch 'main' into fix/explicit-errors-in-manager-state
lindnerby fc0461e
return early on deleting state; remove obsolete branch
c-pius 2db02ca
remove re-setting the state in setManifestState
c-pius 6c28f82
Merge branch 'main' into fix/explicit-errors-in-manager-state
c-pius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but inside this
setManifestState
, we did same thing, set state to deleting when manifest has deletiontimestamphttps://github.com/kyma-project/lifecycle-manager/blob/main/internal/declarative/v2/reconciler.go#L418-L420
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but consider rename this
setManifestState
, it's really misleading, if it's aset
method, I don't expect the inputstate
will be modified in the body of the function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks! I removed modifying the state arg in
setManifestState
. We need to check the deletion timestamp outside because we can't reliably determine the manager state if there is a deletion timestamp. And this way it is now also consistent. We first determine the state to transition to, then we callsetManfiestState
with that state.TBH, I am also a bit confused about the rest of the
setManifestState
method. If I understand it right, we set ConditionInstallation
toTrue
and set Last Operator Message toinstallation is ready and resources can be used
whenever we transition between states other than Processing. So if we go from Reay to Warning, we will keep this condition and message. If we go from Ready to Error, we will keep this condition and message, If we go from Processing to Error, we will keep this condition and message.... Is this expected or do we need to straighten out a few things?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the rest code is a bit bluring, I think we can improve it, but logically should fine I think.
When the reconcilation enter into
setManifestState
, we don't haveError
state case, this should already requeued in previous steps.So the rest state are
Ready
,Processing
,Warning
, basically all of these state means installation should be finished.if !meta.IsStatusConditionTrue(status.Conditions, installationCondition.Type) || status.State != state
this meaning:
status
), theInstallation
condition is false; basically this means the actual installation condition in cluster is false.status.State
) is different than the state to be updated (state
); this means we need to update the state,in both case, we should update the installation condition to true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I have created a follow-up to investigate this more thoroughly: #1846
Right now I don't know if I understand the setting of those conditions correctly. Let's discuss that.
But until then, we could merge this one as proposed if okay from your side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic prevents all follow steps, right? if Manifest CR is under deletion, it always requeue with set state to
Deleting
I think you need to update
if !manifest.GetDeletionTimestamp().IsZero() && manifest.status.state != "deleting"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I think it only requeus when we have a difference in state. First, we determine the "target" state which is "Deleting" if we have a deletion timestamp. With this we call the
setManfiestState
function:And in the
setManifestState
function, we only update the status and return theErrInstallationConditionRequiresUpdate
error if it actually differs (if newState != status.State
). To my understanding, we use this error to determine if the requeue is required. If we returnnil
, we don't requeue. I don't particularly like this, but I also think we should keep it for this chagne and then focus on improving with the created ticket.