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

Add Neutron's default route annotations #722

Merged

Conversation

elvgarrui
Copy link
Contributor

@elvgarrui elvgarrui commented Mar 22, 2024

When the webhook calls for Neutron defaults, it should also write the route override annotation on Neutron's CR section so that the route gets modified.

Currently it is failing when I try to modify the openstack controlplane CR, and I don't get to see anything under neutron apiOverride on the yaml. But I do see the Annotation applied on the OverrideSpec object. I assume I'm doing something wrong here, any help appreciated!

(Goes together with openstack-k8s-operators/neutron-operator#324)
Depends-On: openstack-k8s-operators/neutron-operator#324

@openshift-ci openshift-ci bot requested review from abays and dprince March 22, 2024 11:52
Copy link
Contributor

openshift-ci bot commented Mar 22, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: elvgarrui
Once this PR has been reviewed and has the lgtm label, please assign viroel for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Mar 22, 2024

Hi @elvgarrui. Thanks for your PR.

I'm waiting for a openstack-k8s-operators member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/dcaa1d794753416fa1f9a5d8bd4a477f

openstack-k8s-operators-content-provider FAILURE in 8m 22s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@dprince
Copy link
Contributor

dprince commented Mar 22, 2024

@elvgarrui hi, just left you a comment on the neutron-operator CR. I think you just need to move the validation into the core NeutronAPISpecCore.Default() validation function which currently has nothing in it. There is actually a comment in the Neutron code that says 'only container image validations go here' for the NeutronAPISpec.Default() function. I'm not sure what else we can do other than have a comment to go along with these things.

@dprince
Copy link
Contributor

dprince commented Mar 22, 2024

One more comment: We haven't actually switched to the core structs in OpenStackControlplane yet. But soon will once the OpenStackVersion stuff lands.

@booxter
Copy link
Contributor

booxter commented Mar 22, 2024

It would be nice to include a functional test here confirming that the default is set for neutron as expected.

openstackcontrolplanelog.Info("Neutron Route Override initialized")

}
r.Spec.Neutron.APIOverride.Route.AddAnnotation(r.Spec.Neutron.Template.GetDefaultRouteAnnotations())
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 this is the important part and you don't need a new field in neutron struct at all.

@@ -381,6 +382,14 @@ func (r *OpenStackControlPlane) DefaultServices() {

// Neutron
r.Spec.Neutron.Template.Default()
// WIP: Error when trying to trigger webhook by modifying the CR.
if r.Spec.Neutron.APIOverride.Route == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic may be helpful for other services, consider introducing a helper function that would receive an override object and default annotations and that would initialize the override route accordingly.

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 should be defined in lib-common, right? Should I propose it there and then change it here on a follow-up patch? Or is there a better way?

Copy link
Contributor

Choose a reason for hiding this comment

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

You could have it here for now since the code that will use it will be here too, no? If it implies lib-common, definitely don't go there not to slow down merging it.

(Other projects should probably take it from there and iterate over all service CRs to initialize defaults.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, at first I thought of creating the function with a receiver, and that can only be done from the lib-common repository, but I can pass the * OverrideSpec as an argument.

// WIP: Error when trying to trigger webhook by modifying the CR.
if r.Spec.Neutron.APIOverride.Route == nil {
r.Spec.Neutron.APIOverride.Route = &route.OverrideSpec{}
openstackcontrolplanelog.Info("Neutron Route Override initialized")
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the logs

@elvgarrui
Copy link
Contributor Author

pushed some of the requested changes and also rebased, but it is still missing the functional test

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/a665d21a41f243e583df3da62ae18375

openstack-k8s-operators-content-provider FAILURE in 8m 09s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 8ddc851 to 722467e Compare March 26, 2024 15:29
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/f51f0adc131949d5971b7f57e03c74ef

openstack-k8s-operators-content-provider FAILURE in 8m 02s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@@ -318,6 +319,13 @@ func (r *OpenStackControlPlane) Default() {
r.DefaultServices()
}

// Helper function to initialize overrideSpec object. Could be moved to lib-common.
func initializeOverride(override **route.OverrideSpec) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it would also receive route annotations as arg, then it would

override.Route.AddAnnotations(annotations)...

otherwise this helper is very bare and probably is not very helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh I see... I have changed it now to include that. Let me know if it looks better. Functional test was also added.

@booxter
Copy link
Contributor

booxter commented Mar 26, 2024

looks fine but need a test, thanks

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 722467e to 8b2a577 Compare March 27, 2024 19:55
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/c9a4bb09236541d5bdbb8fe7e2aff526

openstack-k8s-operators-content-provider FAILURE in 8m 43s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 8b2a577 to 1c976b7 Compare March 27, 2024 20:32
@fao89
Copy link
Contributor

fao89 commented Mar 27, 2024

/ok-to-test

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/bce6346a44804b7bad9d85282ef6da35

openstack-k8s-operators-content-provider FAILURE in 8m 24s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@karelyatin
Copy link
Contributor

recheck zuul one with Depends-On

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/27f6cc34a4894b9ea4f92d28fdf5f3b5

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 56m 15s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 11m 33s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 21m 01s
openstack-operator-tempest-multinode FAILURE in 1h 34m 45s

@abays
Copy link
Contributor

abays commented Apr 1, 2024

/retest-required

@abays
Copy link
Contributor

abays commented Apr 1, 2024

recheck

@abays
Copy link
Contributor

abays commented Apr 1, 2024

I think this needs a go get -u github.com/openstack-k8s-operators/neutron-operator/api

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/66a972c5d0f44c3b9a8d9d09c667bb28

openstack-k8s-operators-content-provider FAILURE in 8m 02s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@elvgarrui
Copy link
Contributor Author

elvgarrui commented Apr 1, 2024

I think this needs a go get -u github.com/openstack-k8s-operators/neutron-operator/api

@abays

Hi! I've tried running that command, and it creates no changes on the go.mod or any other file.
I've tried rebasing and running the command too but there was also no output from it.
I'm uploading the rebased version anyway, in case it helps.

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 1c976b7 to 0c0b3e3 Compare April 1, 2024 10:09
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/3873c3bc3cce4d8782f3268697c7d194

openstack-k8s-operators-content-provider FAILURE in 8m 07s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@abays
Copy link
Contributor

abays commented Apr 1, 2024

I think this needs a go get -u github.com/openstack-k8s-operators/neutron-operator/api

@abays

Hi! I've tried running that command, and it creates no changes on the go.mod or any other file. I've tried rebasing and running the command too but there was also no output from it. I'm uploading the rebased version anyway, in case it helps.

@elvgarrui My bad, the command needs @latest at the end:

go get -u github.com/openstack-k8s-operators/neutron-operator/api@latest

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 0c0b3e3 to 840aebe Compare April 1, 2024 10:29
@elvgarrui
Copy link
Contributor Author

@abays Oooh that makes sense, thanks :)
It's updated now in both the root directory and the apis/ one.
Hope it passes the CI this time.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/ef6518f661d747858d36e08787e71a08

openstack-k8s-operators-content-provider FAILURE in 6m 22s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-data-plane-adoption-osp-17-to-extracted-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@abays
Copy link
Contributor

abays commented Apr 1, 2024

@elvgarrui Bah, I'm so sorry. I was wrong again. I was thinking of containers, not Golang. The proper command is:

go get -u github.com/openstack-k8s-operators/neutron-operator/api@main

@elvgarrui elvgarrui force-pushed the route_default_timeout branch from 840aebe to e3a9c72 Compare April 1, 2024 11:57
@elvgarrui
Copy link
Contributor Author

@abays Nevermind! I'm really grateful for the quick help :) Re-pushed again with tags from main

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/c7648470749d41619f621c0cc077d38a

openstack-k8s-operators-content-provider FAILURE in 6m 17s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-data-plane-adoption-osp-17-to-extracted-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

When the webhook calls for Neutron defaults, it should also write the
route override annotation on Neutron's CR section.

Signed-off-by: Elvira García <[email protected]>
@elvgarrui elvgarrui force-pushed the route_default_timeout branch from e3a9c72 to e655525 Compare April 1, 2024 15:11
@karelyatin
Copy link
Contributor

/lgtm neutron-operator updated as part of #716

@averdagu
Copy link
Contributor

averdagu commented Apr 2, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 2, 2024
@karelyatin karelyatin merged commit 0219303 into openstack-k8s-operators:main Apr 2, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants