Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bentito
Copy link
Contributor

@bentito bentito commented Jul 2, 2024

Description

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

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

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>
@bentito bentito requested a review from a team as a code owner July 2, 2024 15:31
Copy link

netlify bot commented Jul 2, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 1a0cc12
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/6685654bac241f0008920f1a
😎 Deploy Preview https://deploy-preview-1007--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.10%. Comparing base (872b7f7) to head (1a0cc12).
Report is 1 commits behind head on main.

Files Patch % Lines
...nternal/controllers/clusterextension_controller.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1007      +/-   ##
==========================================
- Coverage   77.19%   77.10%   -0.10%     
==========================================
  Files          17       17              
  Lines        1206     1201       -5     
==========================================
- Hits          931      926       -5     
  Misses        193      193              
  Partials       82       82              
Flag Coverage Δ
e2e 56.44% <0.00%> (-0.10%) ⬇️
unit 51.70% <77.77%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
@bentito
Copy link
Contributor Author

bentito commented Jul 3, 2024

NB: go-apidiff is an expected failing test as we're intentionally removing API items pre-GA.

@@ -167,7 +159,8 @@ type BundleMetadata struct {
Version string `json:"version"`
}

// ClusterExtensionStatus defines the observed state of ClusterExtension
// ClusterExtensionStatus defines the observed state of ClusterExtension.
// InstalledBundle should only be modified when a new bundle is successfully installed. This ensures that if you've previously successfully installed a bundle before, and an upgrade fails, it is still appropriately communicated to you that there is still a bundle that is currently installed and owned by the ClusterExtension.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments:

  1. I don't think the Status object is the right place for details of the InstalledBundle field. Move this comment to that field?
  2. We should be able to assess a "current installation" independent of a bunch of other reconcile tasks. Our reconcile behavior probably needs to go and actually lookup the currently installed bundle early on and affirmatively set status.conditions[type=Installed] and status.installedBundle based on what we find. If we fail trying to lookup the installed bundle, we should set the condition to Unknown, probably unset the installedBundle field, and then continue on with other unrelated reconcile tasks.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the Status object is the right place for details of the InstalledBundle field. Move this comment to that field?

@joelanford Not sure if I understand your comments fully. Currently InstalledBundle is part of ClusterExtensionStatus , I guess you are suggesting it should not?

type ClusterExtensionStatus struct {
	// +optional
	InstalledBundle *BundleMetadata `json:"installedBundle,omitempty"`
	// +optional
	ResolvedBundle *BundleMetadata `json:"resolvedBundle,omitempty"`
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I do not see any suggested change for the InstalledBundle in the RFC document.

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")
Copy link
Member

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.

@@ -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)
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants