-
Notifications
You must be signed in to change notification settings - Fork 54
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
✨ Cleaner Condition Types & Reasons #1007
✨ Cleaner Condition Types & Reasons #1007
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1007 +/- ##
==========================================
+ Coverage 72.75% 72.93% +0.17%
==========================================
Files 31 31
Lines 1883 1862 -21
==========================================
- Hits 1370 1358 -12
+ Misses 375 366 -9
Partials 138 138
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
NB: |
setStatusUnpackPending(ext, unpackResult.Message) | ||
setInstalledStatusConditionUnknown(ext, "installation has not been attempted as unpack is pending") | ||
setStatusInstallFalseUnpackFailed(ext, unpackResult.Message) | ||
setInstalledStatusConditionInstalledFalse(ext, "installation has not been attempted as unpack is pending") |
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.
Installed=False is not always correct here. If we have previously installed a bundle, and now the unpack of the next bundle is pending, we still have an installed bundle.
The installation status and the bundle unpack status are not related to each other.
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.
okay, just setting the unpack as failed in 0306c9d
@@ -273,13 +273,12 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp | |||
|
|||
switch unpackResult.State { | |||
case rukpaksource.StatePending: | |||
setStatusUnpackPending(ext, unpackResult.Message) | |||
setInstalledStatusConditionUnknown(ext, "installation has not been attempted as unpack is pending") | |||
setStatusInstallFalseUnpackFailed(ext, unpackResult.Message) |
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.
Unpack state is pending, but we're setting Unpacked=False, Failed
?
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.
Well this was changed to acknowledge that we've switched to direct image registry and that as far as opr-ctrl is concerned we can't really be in an Unknown state, we're either failed or not. Perhaps we should just not process StatePending here?
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'm not sure we should write this code with specific knowledge of the underlying Source
implementation. In theory, the source could be switched out to a different implementation that can return StatePending
. I've been tinkering with an async direct image client, so this is not entirely hypothetical.
More broadly, I wonder if we even need an Unpacked
condition type? I don't see it in the diagram in the RFC. The only reason we are unpacking a bundle is so that we can install it. So can we rollup unpacking status into Progressing and/or Installed conditions?
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.
That's farther than the RFC went, but I think it's in the same spirit. I think we can roll it into TypeInstalled
. I think TypeProgressing would actually be adding a new type?
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.
as noted above there is no TypeProgressing
currently, if we want to eliminate TypeUnpacked
in favor of TypeInstalled
@joelanford, these two helper methods encapsulate all the places changes would be needed:
func setStatusUnpackFailed(ext *ocv1alpha1.ClusterExtension, message string) {
ext.Status.InstalledBundle = nil
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: ocv1alpha1.TypeUnpacked,
Status: metav1.ConditionFalse,
Reason: ocv1alpha1.ReasonUnpackFailed,
Message: message,
ObservedGeneration: ext.GetGeneration(),
})
}
func setStatusUnpacked(ext *ocv1alpha1.ClusterExtension, message string) {
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: ocv1alpha1.TypeUnpacked,
Status: metav1.ConditionTrue,
Reason: ocv1alpha1.ReasonUnpackSuccess,
Message: message,
ObservedGeneration: ext.GetGeneration(),
})
}
So on the fail case we'd want TypeInstalled
as ConditionUnknown
and same on the success case. The reason would be the difference. But I wonder if the success case is a bit odd: TypeInstalled
is Uknown and the reason is Unpack success?
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 TypeInstalled
should literally just be based on: "is there a helm release secret with status deployed
? if so, Installed=True. If not "Installed=False". If there was an error looking up helm release secrets (other than "not found"), then "Installed=Unknown".
Nothing else should play into it.
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 created #1027 to capture this need. I'd like to keep this PR limited to the RFC covered items.
@joelanford are you ok with this? |
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
e5952e4
to
f678a7c
Compare
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
58c5776
* Replace ReasonCreateDynamicWatchFailed w/ ReasonInstallationFailed Signed-off-by: Brett Tofel <[email protected]> * Remove unused ReasonInstallationSucceeded Signed-off-by: Brett Tofel <[email protected]> * Drop usage of ConditionUnknown on Pending Install Signed-off-by: Brett Tofel <[email protected]> * Remove ReasonUnpackPending/InstallationsStatusUnk Signed-off-by: Brett Tofel <[email protected]> * Update related TODO in ClusterExtension controller Signed-off-by: Brett Tofel <[email protected]> * Rm InstalledStatus->nil on upack & add comment Signed-off-by: Brett Tofel <[email protected]> * Align CRD for added Go doc on InstalledBundle Signed-off-by: Brett Tofel <[email protected]> * Move comment on InstalledBundle field Signed-off-by: Brett Tofel <[email protected]> * Commit manifest changes for godoc change Signed-off-by: Brett Tofel <[email protected]> * Decouple bundle unpacking and installed statuses Signed-off-by: Brett Tofel <[email protected]> * Remove unneeded unpack stage helper method Signed-off-by: Brett Tofel <[email protected]> --------- Signed-off-by: Brett Tofel <[email protected]>
* Replace ReasonCreateDynamicWatchFailed w/ ReasonInstallationFailed Signed-off-by: Brett Tofel <[email protected]> * Remove unused ReasonInstallationSucceeded Signed-off-by: Brett Tofel <[email protected]> * Drop usage of ConditionUnknown on Pending Install Signed-off-by: Brett Tofel <[email protected]> * Remove ReasonUnpackPending/InstallationsStatusUnk Signed-off-by: Brett Tofel <[email protected]> * Update related TODO in ClusterExtension controller Signed-off-by: Brett Tofel <[email protected]> * Rm InstalledStatus->nil on upack & add comment Signed-off-by: Brett Tofel <[email protected]> * Align CRD for added Go doc on InstalledBundle Signed-off-by: Brett Tofel <[email protected]> * Move comment on InstalledBundle field Signed-off-by: Brett Tofel <[email protected]> * Commit manifest changes for godoc change Signed-off-by: Brett Tofel <[email protected]> * Decouple bundle unpacking and installed statuses Signed-off-by: Brett Tofel <[email protected]> * Remove unneeded unpack stage helper method Signed-off-by: Brett Tofel <[email protected]> --------- Signed-off-by: Brett Tofel <[email protected]>
Description
Fixes: #996
Cleaner Condition Types & Reasons. See commit messages for coverage of this PR and its sync to the RFC recommendations. https://docs.google.com/document/d/1JWJxnDXM0X1JQ67ZIDx5j1ayb1d7ajrK_uSDDaz0G98
Reviewer Checklist