✨ 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.
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.
okay, just setting the unpack as failed in 0306c9d
| 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.
Unpack state is pending, but we're setting Unpacked=False, Failed?
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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 <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
e5952e4 to
f678a7c
Compare
* Replace ReasonCreateDynamicWatchFailed w/ ReasonInstallationFailed Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove unused ReasonInstallationSucceeded Signed-off-by: Brett Tofel <btofel@redhat.com> * Drop usage of ConditionUnknown on Pending Install Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove ReasonUnpackPending/InstallationsStatusUnk Signed-off-by: Brett Tofel <btofel@redhat.com> * Update related TODO in ClusterExtension controller Signed-off-by: Brett Tofel <btofel@redhat.com> * Rm InstalledStatus->nil on upack & add comment Signed-off-by: Brett Tofel <btofel@redhat.com> * Align CRD for added Go doc on InstalledBundle Signed-off-by: Brett Tofel <btofel@redhat.com> * Move comment on InstalledBundle field Signed-off-by: Brett Tofel <btofel@redhat.com> * Commit manifest changes for godoc change Signed-off-by: Brett Tofel <btofel@redhat.com> * Decouple bundle unpacking and installed statuses Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove unneeded unpack stage helper method Signed-off-by: Brett Tofel <btofel@redhat.com> --------- Signed-off-by: Brett Tofel <btofel@redhat.com>
* Replace ReasonCreateDynamicWatchFailed w/ ReasonInstallationFailed Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove unused ReasonInstallationSucceeded Signed-off-by: Brett Tofel <btofel@redhat.com> * Drop usage of ConditionUnknown on Pending Install Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove ReasonUnpackPending/InstallationsStatusUnk Signed-off-by: Brett Tofel <btofel@redhat.com> * Update related TODO in ClusterExtension controller Signed-off-by: Brett Tofel <btofel@redhat.com> * Rm InstalledStatus->nil on upack & add comment Signed-off-by: Brett Tofel <btofel@redhat.com> * Align CRD for added Go doc on InstalledBundle Signed-off-by: Brett Tofel <btofel@redhat.com> * Move comment on InstalledBundle field Signed-off-by: Brett Tofel <btofel@redhat.com> * Commit manifest changes for godoc change Signed-off-by: Brett Tofel <btofel@redhat.com> * Decouple bundle unpacking and installed statuses Signed-off-by: Brett Tofel <btofel@redhat.com> * Remove unneeded unpack stage helper method Signed-off-by: Brett Tofel <btofel@redhat.com> --------- Signed-off-by: Brett Tofel <btofel@redhat.com>
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