🐛 Fix sub-ports not deleted with trunks#2081
🐛 Fix sub-ports not deleted with trunks#2081k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
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. DetailsInstructions 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 |
lentzi90
left a comment
There was a problem hiding this comment.
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 |
mdbooth
left a comment
There was a problem hiding this comment.
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
mdbooth
left a comment
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| func (s *Service) RemoveTrunkSubports(trunkID string) error { | ||
| mc := metrics.NewMetricPrometheusContext("trunk", "deletesubports") |
There was a problem hiding this comment.
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.
It looks to me like this is a duplicate. We are already getting the metrics in networking.go above.
Can you remove this @mquhuy ?
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
lentzi90
left a comment
There was a problem hiding this comment.
This looks good, except the duplicate metrics
| } | ||
|
|
||
| func (s *Service) RemoveTrunkSubports(trunkID string) error { | ||
| mc := metrics.NewMetricPrometheusContext("trunk", "deletesubports") |
There was a problem hiding this comment.
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 <huy.mai@est.tech>
4a91e03 to
dabce29
Compare
|
/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. DetailsIn 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