-
Notifications
You must be signed in to change notification settings - Fork 261
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
🐛 Fix sub-ports not deleted with trunks #2081
🐛 Fix sub-ports not deleted with trunks #2081
Conversation
Hi @mquhuy. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, it looks pretty good!
Please make lint-update
to fix the linting error.
86c9d6e
to
796af8e
Compare
/retest |
796af8e
to
2d230c5
Compare
/cc @mdbooth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good. Just a request to move some code for consistency.
Thank you @mdbooth! I have to go now, but I'll make the change asap tomorrow. |
2d230c5
to
4e979cc
Compare
4e979cc
to
c23bf37
Compare
c23bf37
to
c64a89d
Compare
5f01e18
to
34406b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to merge this, but I recommend considering how best to test it. Some unit tests covering error cases might be one way. I think (but I haven't checked) we create a port with a trunk in one of the e2e tests. Perhaps we could also add a subport to it, which would cause the test to fail if it isn't cleaned up properly. Just some ideas.
@@ -77,6 +79,44 @@ func (s *Service) getOrCreateTrunkForPort(eventObject runtime.Object, port *port | |||
return trunk, nil | |||
} | |||
|
|||
func (s *Service) RemoveTrunkSubports(trunkID string) error { | |||
mc := metrics.NewMetricPrometheusContext("trunk", "deletesubports") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really need a metrics strategy. I'd probably leave this out, tbh, but in absence of any related policy I'm not going to object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like this is a duplicate. We are already getting the metrics in networking.go
above.
Can you remove this @mquhuy ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure. Coming up
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mdbooth The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, except the duplicate metrics
@@ -77,6 +79,44 @@ func (s *Service) getOrCreateTrunkForPort(eventObject runtime.Object, port *port | |||
return trunk, nil | |||
} | |||
|
|||
func (s *Service) RemoveTrunkSubports(trunkID string) error { | |||
mc := metrics.NewMetricPrometheusContext("trunk", "deletesubports") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like this is a duplicate. We are already getting the metrics in networking.go
above.
Can you remove this @mquhuy ?
Thank you. I'm wondering if this is the one you were thinking of? https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/pkg/cloud/services/networking/port_test.go#L309 I'm not sure if I understand it correctly, but it seems to me the test is only checking if the port could be created. Do you think we should also test if it can be cleaned? If it turned out to be in a bigger scope, I'd be happy to do it in another PR. |
34406b5
to
4a91e03
Compare
Signed-off-by: Huy Mai <[email protected]>
4a91e03
to
dabce29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/unhold |
Looks like that's only testing port creation. You might want a new unit test for the delete flow. But something similar to that. For the e2e test I was thinking of this: cluster-api-provider-openstack/test/e2e/suites/e2e/e2e_test.go Lines 447 to 455 in 046d6b7
If we updated the test to add a subport to that trunk we'd presumably get an error if the test didn't clean it up properly. |
/cherrypick release-0.9 |
@mquhuy: only kubernetes-sigs org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually. In response to this:
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-sigs/prow repository. |
What this PR does / why we need it:
Sometimes, when a trunk is associated with sub ports, deletion of the trunk will not lead to deletion of the subports, which is not expected. This PR adds the check to ensure the deletion of the subports in such cases.
Special notes for your reviewer:
TODOs:
/hold