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

⚠ REMOVE extension api from main branch #820

Merged
merged 1 commit into from
May 14, 2024

Conversation

acmenezes
Copy link
Contributor

Description

The intent is to remove this API and its controllers for the v1.0.0 release. Once we've released 1.0.0, we plan to re-introduce the Extension API and controllers.

@joelanford, please take a look and tell me if that's what you had in mind. I did a flat removal of all the references to the api as well. Didn't try to circumvent or redesign around any errors. Any suggestions or changes are welcomed. Saving this as a draft PR to be safe.

My question, and I think it's an important one, would we pull the main branch's code to some secondary branch as a reference for after v1.0.0 before merging this if we plan to reintroduce it?

Solves #735

Reviewer Checklist

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 2, 2024
Copy link

netlify bot commented May 2, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 5f83813
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/66437b470d70e70008b3e7a8
😎 Deploy Preview https://deploy-preview-820--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 May 2, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 81.80%. Comparing base (6d73b73) to head (ca00f4a).

Files Patch % Lines
...nternal/controllers/clusterextension_controller.go 57.14% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #820       +/-   ##
===========================================
+ Coverage   71.02%   81.80%   +10.78%     
===========================================
  Files          17       15        -2     
  Lines        1301      907      -394     
===========================================
- Hits          924      742      -182     
+ Misses        304      120      -184     
+ Partials       73       45       -28     
Flag Coverage Δ
e2e 59.75% <61.11%> (+17.02%) ⬆️
unit 73.76% <66.66%> (+10.16%) ⬆️

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.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 2, 2024
@joelanford
Copy link
Member

I don't think we need to save the code off. The git history is there, so we can just come back to the commit prior to this PR if necessary.

But I suspect we don't even do that. I think it is more likely that we'll essentially copy ClusterExtension back over to Extension and make the few tweaks necessary for it to work as a namespace-scoped API. And we'll do a similar thing for the controller.

Comment on lines 124 to 130
// +optional
InstalledBundle *BundleMetadata `json:"installedBundle,omitempty"`
// +optional
ResolvedBundle *BundleMetadata `json:"resolvedBundle,omitempty"`

Copy link
Member

Choose a reason for hiding this comment

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

These should stay. If BundleMetadata is defined in extension_types.go, let's move those definitions to this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines -32 to -33
- apiGroups:
- kappctrl.k14s.io
Copy link
Member

Choose a reason for hiding this comment

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

We should remove the kapp dependency (I think you'll see breadcrumbs in Makefile and the install script template).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. Thanks I will check on that one yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @joelanford , I finally removed kapp from Makefile, install scripts and also from the scheme package I put on the last PR. I guess that should cover it. Let me know.

@@ -121,17 +121,14 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
// Lookup the bundle that corresponds to the ClusterExtension's desired package.
bundle, err := r.resolve(ctx, ext)
if err != nil {
ext.Status.InstalledBundle = nil
Copy link
Member

@joelanford joelanford May 3, 2024

Choose a reason for hiding this comment

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

Re: keeping these fields in ClusterExtension, we also want to keep the ClusterExtension reconciler logic intact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Ack. Keeping it intact.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 3, 2024
@@ -106,6 +115,7 @@ func init() {
TypePackageDeprecated,
TypeChannelDeprecated,
TypeBundleDeprecated,
TypeProgressing,
Copy link
Contributor

Choose a reason for hiding this comment

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

Unit tests are probably failing due to the Progressing type being added to the set of conditions but it never being set on the ClusterExtension during the reconciliation process.

I would keep the type definitions for the condition and reasons but would remove them from the list here. IMO to keep the scope of this PR small, the implementation/usage of them should take place in #747

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @everettraven , actually it will fail another test and ask me to add it to the list. What I did was adding that to the list but then it requires me to actually set progressing status in the ClusterExtension controller. That part I'm honestly not sure if I did right. I appreciate some eyes on this. On the other hand if you really want to keep the type out of the list of conditions sets then we may have to change some tests. Happy to go either way. I count on your directions here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that is interesting. I didn't realize there was a test that we had the ensured those constants are added to the conditionsets.

I'm not sure this is really a valuable test for us at the moment. I'm not sure what the best path forward here is personally, maybe:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. I think we can talk about it on our meeting on Tuesday.

Copy link
Member

Choose a reason for hiding this comment

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

actually it will fail another test and ask me to add it to the list.

What was the specific test failure? I think @everettraven is correct that we should be able to let this status condition type be completely removed since it is currently only present in the Extension API.

Copy link
Contributor

Choose a reason for hiding this comment

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

@joelanford I think it is these test cases:

func TestClusterExtensionTypeRegistration(t *testing.T) {
types, err := parseConstants("Type")
if err != nil {
t.Fatalf("unable to parse Type constants %v", err)
}
for _, tt := range types {
if !slices.Contains(conditionsets.ConditionTypes, tt) && !slices.Contains(conditionsets.ExtensionConditionTypes, tt) {
t.Errorf("append Type%s to conditionsets.ConditionTypes in this package's init function", tt)
}
}
for _, tt := range conditionsets.ConditionTypes {
if !slices.Contains(types, tt) {
t.Errorf("there must be a Type%[1]s string literal constant for type %[1]q (i.e. 'const Type%[1]s = %[1]q')", tt)
}
}
for _, tt := range conditionsets.ExtensionConditionTypes {
if !slices.Contains(types, tt) {
t.Errorf("there must be a Type%[1]s string literal constant for type %[1]q (i.e. 'const Type%[1]s = %[1]q')", tt)
}
}
}
func TestClusterExtensionReasonRegistration(t *testing.T) {
reasons, err := parseConstants("Reason")
if err != nil {
t.Fatalf("unable to parse Reason constants %v", err)
}
for _, r := range reasons {
if !slices.Contains(conditionsets.ConditionReasons, r) && !slices.Contains(conditionsets.ExtensionConditionReasons, r) {
t.Errorf("append Reason%s to conditionsets.ConditionReasons in this package's init function.", r)
}
}
for _, r := range conditionsets.ConditionReasons {
if !slices.Contains(reasons, r) {
t.Errorf("there must be a Reason%[1]s string literal constant for reason %[1]q (i.e. 'const Reason%[1]s = %[1]q')", r)
}
}
for _, r := range conditionsets.ExtensionConditionReasons {
if !slices.Contains(reasons, r) {
t.Errorf("there must be a Reason%[1]s string literal constant for reason %[1]q (i.e. 'const Reason%[1]s = %[1]q')", r)
}
}
}

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

IMO the lint failures can be addressed via a //nolint:unused comment for now and be updated in #747 when they are used again.

This should help keep the scope of this PR smaller

@acmenezes acmenezes force-pushed the remove_extension branch 6 times, most recently from ca00f4a to b82812e Compare May 7, 2024 20:33
@acmenezes
Copy link
Contributor Author

IMO the lint failures can be addressed via a //nolint:unused comment for now and be updated in #747 when they are used again.

This should help keep the scope of this PR smaller

@everettraven good idea. I just added the comments there. I think no more lint issues are found. Thanks.

Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

Comment on lines 34 to 35
ReasonFailedToReachDesiredIntent = "FailedToReachDesiredIntent"
ReasonReachedDesiredIntent = "ReachedDesiredIntent"
Copy link
Member

Choose a reason for hiding this comment

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

IIRC these were related to upgrades and being used in extension-controller. These can be removed too.

@acmenezes acmenezes marked this pull request as ready for review May 14, 2024 15:24
@acmenezes acmenezes requested a review from a team as a code owner May 14, 2024 15:24
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 14, 2024
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

LGTM! Great work @acmenezes !

Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 14, 2024
@everettraven everettraven added this pull request to the merge queue May 14, 2024
Merged via the queue into operator-framework:main with commit a458282 May 14, 2024
14 of 15 checks passed
@acmenezes acmenezes mentioned this pull request Jun 5, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants