-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: (helm) - in some rare helm install cases, status is missing InstallSuccessful #3735
fix: (helm) - in some rare helm install cases, status is missing InstallSuccessful #3735
Conversation
status.SetCondition(types.HelmAppCondition{ | ||
Type: types.ConditionDeployed, | ||
Status: types.StatusTrue, | ||
Reason: types.ReasonInstallSuccessful, | ||
Message: manager.ReleaseMessage(), | ||
}) |
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.
Can you move this to line ~334? We should just always set the condition.
At that point, we can also look at expectedRelease
, so I don't think we need the extra manager functions.
Lastly, we should look at the release version to know whether to set ReasonInstallSuccessful
or ReasonUpgradeSuccessful
.
WDYT? Will the problem be still be solved if those tweaks are made?
Also, I think this would be a bug fix that should have a changelog fragment. Would you mind adding that as well? |
@@ -0,0 +1,4 @@ | |||
entries: | |||
- description: Fixed a bug that caused the Helm operator not to set the `InstallSuccessful` status. |
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.
- description: Fixed a bug that caused the Helm operator not to set the `InstallSuccessful` status. | |
- description: Ensures that the `InstallSuccessful` status will be set always by checking if the release info. |
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.
IHMO ^
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.
I think @mikeshng's version reads more clearly with one tweak though.
- description: Fixed a bug that caused the Helm operator not to set the `InstallSuccessful` status. | |
- description: Fixed a bug that caused the Helm operator not to set the `InstallSuccessful` and `UpgradeSuccessful` status reasons when the status update fails during installation and upgrade. |
…allSuccessful Signed-off-by: Mike Ng <[email protected]>
reason := types.ReasonUpgradeSuccessful | ||
if expectedRelease.Version == 1 { | ||
reason = types.ReasonInstallSuccessful | ||
} |
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.
Now it makes more sense for me 👍
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.
When I ran the helm ls
command it showed:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nginx-sample default 1 2020-08-13 14:09:57.443165995 -0400 EDT deployed nginx-0.1.0 1.16.0
So I thought Version
is APP VERSION
which means its not going to be 1
for fresh install case. Then I double checked and it seems like Version
is infact the REVISION
from the output above so I changed it back to what Joe suggested earlier.
Signed-off-by: Mike Ng <[email protected]>
Type: types.ConditionDeployed, | ||
Status: types.StatusTrue, | ||
Reason: reason, | ||
Message: expectedRelease.Info.Notes, |
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.
we need to check if the info is not nil. Such as :
operator-sdk/internal/helm/controller/reconcile.go
Lines 212 to 215 in ed95c5a
message := "" | |
if installedRelease.Info != nil { | |
message = installedRelease.Info.Notes | |
} |
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 for the good catch.
…ing the Notes Signed-off-by: Mike Ng <[email protected]>
// ContainsCondition checks if the condition with the passed condition type from | ||
// the status object is already present. If present then return true. | ||
// Otherwise, return false. | ||
func (s *HelmAppStatus) ContainsCondition(conditionType HelmAppConditionType) bool { | ||
for i := range s.Conditions { | ||
if s.Conditions[i].Type == conditionType { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
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 function is no longer necessary, right?
…ion because it's no longer necessary Signed-off-by: Mike Ng <[email protected]>
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.
Now it shows ok for me 👍 Great work btw 🥇
But I did not test it locally yet.
Let's see what @joelanford think about.
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.
/lgtm
Thanks for the contribution! Great find and fix!
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.
/lgtm
…allSuccessful (operator-framework#3735) Fixed a bug that caused the Helm operator not to set the `InstallSuccessful` and `UpgradeSuccessful` status reasons when the status update fails during installation and upgrade. Closes operator-framework#3728
Signed-off-by: Mike Ng [email protected]
Description of the change:
In some rare cases, the InstallSuccessful reason is not stamped to the helm operator based CR after a successful helm install.
This fix is to make sure that it will keep trying to put the InstallSuccessful into the status.
Motivation for the change:
Closes #3728
Checklist
If the pull request includes user-facing changes, extra documentation is required:
changelog/fragments
(seechangelog/fragments/00-template.yaml
)website/content/en/docs