Delete loadbalancers and floatingips for service and ingress
This patch makes the regex more broad to cover both services and ingresses that create load balancers in octavia. In cloud-provider-openstack repo, the load balancer description is defined in: -f056677572/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go (L459)
-f056677572/pkg/ingress/controller/openstack/octavia.go (L316)
The floating ip description is defined in: -f056677572/pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go (L1063)
-f056677572/pkg/ingress/controller/openstack/neutron.go (L72)
Change-Id: I7ce38e38de0d66fac340e287ce520de4c4bf679d Story: 2004839
This commit is contained in:
parent
f0b6d3e1fe
commit
d2f36a2ed1
|
@ -25,15 +25,14 @@ def delete_floatingip(context, fix_port_id, cluster):
|
||||||
"""Deletes the floating IP associated with the fix_port_id.
|
"""Deletes the floating IP associated with the fix_port_id.
|
||||||
|
|
||||||
Only delete the floating IP if it's created and associated with the
|
Only delete the floating IP if it's created and associated with the
|
||||||
LoadBalancer type service in Kubernetes cluster.
|
the load balancers that corresponding to the services and ingresses in
|
||||||
|
Kubernetes cluster.
|
||||||
|
|
||||||
This method only works with the Kubernetes cluster with
|
This method only works with the Kubernetes cluster with
|
||||||
cloud-provider-openstack controller manager deployed, patched with
|
cloud-provider-openstack controller manager deployed.
|
||||||
this PR:
|
|
||||||
https://github.com/kubernetes/cloud-provider-openstack/pull/433
|
|
||||||
"""
|
"""
|
||||||
pattern = (r'Floating IP for Kubernetes external service \w+ from cluster '
|
pattern = (r'Floating IP for Kubernetes .+ from cluster %s$' %
|
||||||
r'%s$' % cluster.uuid)
|
cluster.uuid)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
n_client = clients.OpenStackClients(context).neutron()
|
n_client = clients.OpenStackClients(context).neutron()
|
||||||
|
|
|
@ -52,15 +52,17 @@ def wait_for_lb_deleted(octavia_client, deleted_lbs):
|
||||||
|
|
||||||
|
|
||||||
def delete_loadbalancers(context, cluster):
|
def delete_loadbalancers(context, cluster):
|
||||||
"""Delete loadbalancers for k8s service.
|
"""Delete loadbalancers for kubernetes resources.
|
||||||
|
|
||||||
This method only works for the k8s cluster with
|
This method only works for the k8s cluster with
|
||||||
cloud-provider-openstack manager or controller-manager patched with
|
cloud-provider-openstack manager or controller-manager patched with
|
||||||
this PR:
|
this PR:
|
||||||
https://github.com/kubernetes/cloud-provider-openstack/pull/223
|
https://github.com/kubernetes/cloud-provider-openstack/pull/223
|
||||||
|
|
||||||
|
The load balancers created for kubernetes services and ingresses are
|
||||||
|
deleted.
|
||||||
"""
|
"""
|
||||||
pattern = (r'Kubernetes external service \w+ from cluster %s$' %
|
pattern = (r'Kubernetes .+ from cluster %s$' % cluster.uuid)
|
||||||
cluster.uuid)
|
|
||||||
valid_status = ["ACTIVE", "ERROR", "PENDING_DELETE", "DELETED"]
|
valid_status = ["ACTIVE", "ERROR", "PENDING_DELETE", "DELETED"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue