-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Openstack delete dynamic floating ip in delete cluster #7045
Openstack delete dynamic floating ip in delete cluster #7045
Conversation
pkg/resources/openstack/lb.go
Outdated
var resourceTrackers []*resources.Resource | ||
|
||
if os.osCloud.UseOctavia() { |
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.
@zetaab I am not overly familiar with octavia if you could give this a look.
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.
if using octavia we do not need delete any subresources (listener,monitor,pool,members). Instead we can just delete loadbalancer itself and use cascade option there. So most part of the code is useless if using octavia. Example when using octavia https://github.com/kubernetes/kops/blob/master/pkg/resources/openstack/lb.go#L53-L56
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 ill update to reflect this.
36bd12b
to
a56b5c4
Compare
/retest |
pkg/resources/openstack/lb.go
Outdated
var resourceTrackers []*resources.Resource | ||
|
||
if os.osCloud.UseOctavia() { |
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.
remove this whole if structure
/hold |
…cally added ones as well, allowing for subnet deletion Bazel updates Updating deletion logic for octavia clusters
a56b5c4
to
7c53b35
Compare
There may be some ports associated to the loadbalancer which will not be cleaned up. |
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.
% openstack loadbalancer list
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
| id | name | project_id | vip_address | provisioning_status | provider |
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
| 083287cc-c449-47df-93af-3aa871e571bd | api.testlb.k8s.local | 9ebaa4069d4d4e009a94e85a811ea8a1 | 10.1.32.13 | ACTIVE | octavia |
| 45d8fef4-7ccb-4167-8369-2e7841a1106a | kube_service_kubernetes_ingress-nginx-external_ingress-nginx-external | 9ebaa4069d4d4e009a94e85a811ea8a1 | 10.1.32.7 | ACTIVE | octavia |
| 0c998bb7-b15e-434b-b062-56a3e5a2b5a0 | kube_service_kubernetes_ingress-nginx-internal_ingress-nginx-internal | 9ebaa4069d4d4e009a94e85a811ea8a1 | 10.1.32.11 | ACTIVE | octavia |
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
# trying to delete cluster with current master version:
% kops delete cluster testlb.k8s.local --yes
....
I0526 12:51:57.043185 56063 context.go:231] hit maximum retries 5 with error error deleting subnet: Expected HTTP response code [] when accessing [DELETE https://helpa1.company.com13696/v2.0/subnets/29bda375-0dad-450c-b37c-6e91cdf34da6], but got 409 instead
{"NeutronError": {"message": "Unable to complete operation on subnet 29bda375-0dad-450c-b37c-6e91cdf34da6: One or more ports have an IP allocation from this subnet.", "type": "SubnetInUse", "detail": ""}}
Subnet:29bda375-0dad-450c-b37c-6e91cdf34da6 error deleting resources, will retry: error deleting subnet: Expected HTTP response code [] when accessing [DELETE https://helpa1.company.com:13696/v2.0/subnets/29bda375-0dad-450c-b37c-6e91cdf34da6], but got 409 instead
{"NeutronError": {"message": "Unable to complete operation on subnet 29bda375-0dad-450c-b37c-6e91cdf34da6: One or more ports have an IP allocation from this subnet.", "type": "SubnetInUse", "detail": ""}}
I0526 12:51:57.478440 56063 context.go:231] hit maximum retries 5 with error error deleting network: Expected HTTP response code [] when accessing [DELETE https://helpa1.company.com:13696/v2.0/networks/4e0541b8-c7dc-4209-8f5a-45250a7ebab7], but got 409 instead
...
% openstack loadbalancer list
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
| id | name | project_id | vip_address | provisioning_status | provider |
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
| 45d8fef4-7ccb-4167-8369-2e7841a1106a | kube_service_kubernetes_ingress-nginx-external_ingress-nginx-external | 9ebaa4069d4d4e009a94e85a811ea8a1 | 10.1.32.7 | ACTIVE | octavia |
| 0c998bb7-b15e-434b-b062-56a3e5a2b5a0 | kube_service_kubernetes_ingress-nginx-internal_ingress-nginx-internal | 9ebaa4069d4d4e009a94e85a811ea8a1 | 10.1.32.11 | ACTIVE | octavia |
+--------------------------------------+-----------------------------------------------------------------------+----------------------------------+-------------+---------------------+----------+
# Trying with this PR version
% kops delete cluster testlb.k8s.local --yes
I0526 12:57:25.275267 56879 s3context.go:87] Found S3_ENDPOINT="https://s3.company.com", using as non-AWS S3 backend
TYPE NAME ID
LoadBalancer kube_service_kubernetes_ingress-nginx-external_ingress-nginx-external 45d8fef4-7ccb-4167-8369-2e7841a1106a
LoadBalancer kube_service_kubernetes_ingress-nginx-internal_ingress-nginx-internal 0c998bb7-b15e-434b-b062-56a3e5a2b5a0
Network testlb.k8s.local 4e0541b8-c7dc-4209-8f5a-45250a7ebab7
Subnet zone-1.testlb.k8s.local 29bda375-0dad-450c-b37c-6e91cdf34da6
LoadBalancer:45d8fef4-7ccb-4167-8369-2e7841a1106a ok
LoadBalancer:0c998bb7-b15e-434b-b062-56a3e5a2b5a0 ok
Subnet:29bda375-0dad-450c-b37c-6e91cdf34da6 ok
Network:4e0541b8-c7dc-4209-8f5a-45250a7ebab7 ok
Deleted kubectl config for testlb.k8s.local
Deleted cluster: "testlb.k8s.local"
This works as should if we are using octavia. @drekle if you can fix that neutron-lbaas port problem then we are good to go
@zetaab I have not changed ports to query all ports on the cluster network, and then delete them. Previously this was trying to grep by name. There was an empty name for dynamically created ports. |
/hold cancel |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: drekle, zetaab 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 |
Instead of using the cluster name to search for the appropriate loadbalancers, which limits this to the api loadbalancer provisioned by kops, I have updated this to search for loadbalancers on the subnets which kops provisions which will clean up the resources created by LoadBalancer services internal to the cluster.
Without the change
kops delete cluster
will fail attempting to delete a subnet with associated ports./sig openstack