Skip to content

✨ OPRUN-3763: Consolidate api directory #1800

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

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

tmshort
Copy link
Contributor

@tmshort tmshort commented Feb 20, 2025

Move operator-controller APIs into apis/operator-controller Move catalogd APIs into apis/catalogd

There's a conflict in types, both have a CatalogSource type that we may not be able to easily rename, so the simplest solution was to keep the two APIs serparate

Description

Reviewer Checklist

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

Move operator-controller APIs into apis/operator-controller
Move catalogd APIs into apis/catalogd

There's a conflict in types, both have a CatalogSource type that we may
not be able to easily rename, so the simplest solution was to keep the
two APIs serparate

Signed-off-by: Todd Short <[email protected]>
@tmshort tmshort requested a review from a team as a code owner February 20, 2025 22:12
Copy link

netlify bot commented Feb 20, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 8541ad2
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67b7a8ebf27fe7000801220e
😎 Deploy Preview https://deploy-preview-1800--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 Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.32%. Comparing base (9b888eb) to head (8541ad2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1800      +/-   ##
==========================================
- Coverage   68.34%   68.32%   -0.02%     
==========================================
  Files          63       63              
  Lines        5117     5117              
==========================================
- Hits         3497     3496       -1     
- Misses       1390     1391       +1     
  Partials      230      230              
Flag Coverage Δ
e2e 51.62% <ø> (-0.08%) ⬇️
unit 55.89% <ø> (-0.02%) ⬇️

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.

rm -f $(KUSTOMIZE_OPCON_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
# Generate the catalogd manifests
rm -rf $(KUSTOMIZE_CATD_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=$(KUSTOMIZE_CATD_CRDS_DIR)
rm -rf $(KUSTOMIZE_CATD_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/catalogd/... output:crd:artifacts:config=$(KUSTOMIZE_CATD_CRDS_DIR)
Copy link
Contributor

Choose a reason for hiding this comment

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

By consolidating the API, I thunk we no longer need to generate rules webhooks and crd spllited
We can just

$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

Also, I think we need to stop to rm the files.
We should run the commands and the make verify should fail if has a diff instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't a 100% consolidation, as the CRDs are still put into separate locations of the config to keep them with their corresponding manager, which is desirable as far as downstream is concerned.

I'm looking at a fixup commit to this one that does the 100% consolidation, and it is starting out to be much bigger and complicated...

I would have to look at why/when rm was added, and I think it was to properly make all the files and clean up those that don't need to exist any more? But it was put there for a reason.

Copy link
Contributor

@camilamacedo86 camilamacedo86 Feb 21, 2025

Choose a reason for hiding this comment

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

I think the rm was added to ensure that we always generate it.
but for all we can either do that in a follow-up.
So, there is no reason to block this one

--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME);

rm -f $(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME)
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/catalogd/api \
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api/catalogd \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not simplify here as well ./...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not if the API docs are in different locations, if we wish to consolidate the documentation, then that's a possibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to consolidate all.
They are the same API group.
I do not think we should have the catalogd and operator-controller dir at all.

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2025
@camilamacedo86
Copy link
Contributor

Because we are moving the dir the check [go-apidiff / go-apidiff (pull_request)](https://github.com/operator-framework/operator-controller/actions/runs/13445656712/job/37570296783?pr=1800)F will fail :-(

We need to disable it, merge and then enable :-(

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm cancel

We need to discuss the path for the API

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2025
@tmshort
Copy link
Contributor Author

tmshort commented Feb 22, 2025

/lgtm cancel

We need to discuss the path for the API

As I said, I'm working on a fixup to combine it all into api/v1, but it requires extensive renaming and changes. One of the requirements is that the CRD outputs are placed into separate kustomize directories, associated with each manager (i.e. ClusterExtension with operator-controller, and ClusterCatalog with catalogd). This is necessary for downstream.

@camilamacedo86 camilamacedo86 dismissed their stale review February 24, 2025 08:22

I do not want to block it.

@azych
Copy link
Contributor

azych commented Feb 24, 2025

Given some decisions about the code layout from here: #1707 (comment)
I'm wondering what code specific to catalogd/ will be left in catalogd/ once this and then also #1744 are done?

It seems like catalogd/ would become redundant at that point and we would have instead moved to a nested structure with

  • cmd/project_name
  • api/project_name
  • internal/project_name

combined Makefile etc.

@camilamacedo86
Copy link
Contributor

Hi @azych

I'm wondering what code specific to catalogd/ will be left in catalogd/ once this and then also #1744 are done?

The catalogd/ dir will no longer exist when we finish the whole work,

@camilamacedo86 camilamacedo86 self-requested a review February 24, 2025 09:32
@grokspawn grokspawn added this pull request to the merge queue Feb 24, 2025
Merged via the queue into operator-framework:main with commit 8fd4464 Feb 24, 2025
18 of 20 checks passed
@tmshort tmshort changed the title ✨ Consolidate api directory ✨ OPRUN-3763: Consolidate api directory Feb 26, 2025
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.

4 participants