Restructure nova-operator to multigroup layout#1075
Conversation
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/9d4a0ce79e3449eebd1aeaa76a18bbc6 ❌ openstack-meta-content-provider FAILURE in 6m 18s |
0284901 to
66b2f48
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/0dc601b27ecb471db71801bb82f75085 ❌ openstack-meta-content-provider FAILURE in 9m 50s |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/1f5ad0ec578345b391db2fb308e12bd1 ❌ openstack-meta-content-provider FAILURE in 9m 21s |
Makefile
Outdated
| manifests: gowork controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. | ||
| $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases && \ | ||
| rm -f api/bases/* && cp -a config/crd/bases api/ | ||
| $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./apis/..." paths="./internal/..." paths="./cmd/..." output:crd:artifacts:config=config/crd/bases && \ |
There was a problem hiding this comment.
we added extra paths (internal and cmd) here for rbac permissions
scan ./apis for CRDs, ./internal and ./cmd for RBAC markers
go.mod
Outdated
| ) | ||
|
|
||
| replace github.com/openstack-k8s-operators/nova-operator/api => ./api | ||
| replace github.com/openstack-k8s-operators/nova-operator/apis => ./apis //allow-merging |
There was a problem hiding this comment.
so here used apis/ (like infra operator) instead of api/ (like openstack-operator)
to make it clear nova operator will host multiple API groups (nova, placement and eventually cyborg).
6a10cec to
237e678
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/76476cf72e7246409d658ce620195916 ❌ openstack-meta-content-provider FAILURE in 9m 24s |
237e678 to
e1e0ed6
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/cf355f8c619047b8b17bd61514e4978d ❌ openstack-meta-content-provider FAILURE in 9m 39s |
gibizer
left a comment
There was a problem hiding this comment.
Changes in the api structure looks good to me.
Next steps are restructuring
- the internal dir
- the tests dir
- the template dir
e1e0ed6 to
e64527a
Compare
|
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
e64527a to
c7c309f
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/2711da5fa9654671b5ad6ef374ee5bfc ❌ openstack-meta-content-provider FAILURE in 9m 20s |
c7c309f to
f69bd0b
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/0ed8a84c04cc412299e80d8f3d8e39fb ❌ openstack-meta-content-provider FAILURE in 9m 25s |
f69bd0b to
0fe60cf
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/8ff0f09c94b14360b0634ab21f3f8ddc ❌ openstack-meta-content-provider FAILURE in 10m 16s |
|
/test functional |
|
/test functional |
|
/retest |
|
recheck |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/6b02784f89d94c039ae23031e055bae6 ❌ openstack-meta-content-provider FAILURE in 10m 20s |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/28e8e4bcd5174967950cea13fe2eab90 ❌ openstack-meta-content-provider FAILURE in 9m 37s |
b6a2296 to
cfb555b
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/d1c5ecc03cc04fbe879b9a9f56f05c6b ❌ openstack-meta-content-provider FAILURE in 9m 41s |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/ab7deb0cfc1044819eef6b13b0db5367 ❌ openstack-meta-content-provider FAILURE in 10m 36s |
d7bd87c to
bdaba18
Compare
|
recheck |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/aec41231b080409f877b5b5ea6055b1f ❌ openstack-meta-content-provider FAILURE in 9m 53s |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/456337024070429cb6ab1c1abc99bb52 ❌ openstack-meta-content-provider FAILURE in 9m 56s |
06efdf9 to
b37ccc7
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/20bbd08ba9854fe18fa4c668d11055d0 ❌ openstack-meta-content-provider FAILURE in 10m 39s |
Makefile
Outdated
There was a problem hiding this comment.
In my local testing the symlink seems to be ignored by the build and golang package resolution logic. If I replace the symlink with a direct copy of the directory, then controller-gen picks up both directory as source of CRD definitions so we will have duplicated CRD definitions which will fail the build. If I tell controller-gen here to only look for CRD definitions in ./api/nova/... (for now) then I can build this change locally together with an unmodified openstack-operator. So this can be the first step.
Then we can modify openstack-operator to start importing api/nova/v1beta1 instead of api/v1beta1.
Then we can remove the api/v1beta1 directory (the copy) from nova-operator and restore the paths="./..." here in the makefile.
There was a problem hiding this comment.
for me make manifests and generate works fine.
can you please tell how exactly you noticed symlink is being ignored.
There was a problem hiding this comment.
removed symlink and updated as suggested.
controller-gen taking paths="./api/nova/..."
---
$ make manifests generate build
test -f go.work || GOTOOLCHAIN=go1.24.0 go work init
go work use .
go work use ./api
go work sync
test -s /home/auniyal/my_wd/operators/repo/nova-operator/bin/controller-gen && /home/auniyal/my_wd/operators/repo/nova-operator/bin/controller-gen --version | grep -q v0.18.0 || \
GOBIN=/home/auniyal/my_wd/operators/repo/nova-operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.18.0
/home/auniyal/my_wd/operators/repo/nova-operator/bin/controller-gen crd webhook paths="./api/nova/..." output:crd:artifacts:config=config/crd/bases && \
/home/auniyal/my_wd/operators/repo/nova-operator/bin/controller-gen rbac:roleName=manager-role paths="./..." output:dir=config/rbac && \
rm -f api/bases/* && cp -a config/crd/bases api/
/home/auniyal/my_wd/operators/repo/nova-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./api/nova/..."
move entire api/v1beta1/ directory to api/nova/v1beta1/
- Move all Nova controllers from internal/controller/ to internal/controller/nova/ - Follows openstack-operator and infra-operator pattern - Uses singular controller (not controllers)
internal/webhook/v1beta1/ to internal/webhook/nova/v1beta1/
Rename internal/novaapi/ to internal/nova/api/ and others
'multigroup: true' to PROJECT file Restrict controller-gen to api/nova to add backward compat
b37ccc7 to
a8ea01b
Compare
|
recheck CI passed but rechecking because |
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/82cd09c7bbef4dfdb437c2d3909ddea4 ❌ openstack-meta-content-provider FAILURE in 16m 04s |
|
recheck |
gibizer
left a comment
There was a problem hiding this comment.
Code builds and deploys for me with the current openstack-operator so lets land it and then continue from there with the followings:
- fix my new comments inline in a follow up (allow-merge, package naming)
- update the opentack-operator to use the new nova/v1beta1 imports
- remove the duplicated v1beta files from nova-operator
- the templates directory needs a similar restructure
- the test directory needs a similar restructure
| ) | ||
|
|
||
| replace github.com/openstack-k8s-operators/nova-operator/api => ./api | ||
| replace github.com/openstack-k8s-operators/nova-operator/api => ./api //allow-merging |
There was a problem hiding this comment.
Strange if the github action started to reject this without the tag. Such a replace is whitelisted explicitly in
Are you sure the //allow-merging is now needed here?
| limitations under the License. | ||
| */ | ||
|
|
||
| package controller |
There was a problem hiding this comment.
here and below. Now that the package is moved from the controller to the controller/nova directory the package name should be aligned too. See the pacakge names in https://github.com/openstack-k8s-operators/openstack-operator/tree/main/internal/controller as example.
There was a problem hiding this comment.
A Go package has both a name and a path. The package name is specified in the package statement of its source files; client code uses it as the prefix for the package’s exported names. Client code uses the package path when importing the package. By convention, the last element of the package path is the package name:
| limitations under the License. | ||
| */ | ||
|
|
||
| package novaapi |
There was a problem hiding this comment.
ditto, here and below align with the new path
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: auniyal61, gibizer The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5701277
into
openstack-k8s-operators:main
Restructure nova to multigroup layout api/nova/v1beta1
Placement will be added in a separate PR.