NEGs not being deregistered on Service deletion
Closed this issue · 3 comments
I'm experimenting with the following simple nginx
service:
apiVersion: v1
kind: Service
metadata:
name: neg-demo-svc
annotations:
cloud.google.com/neg: '{"exposed_ports": {"80":{}}}'
controller.autoneg.dev/neg: '{"backend_services":{"80":[{"name":"some-backend-service","region":"europe-west2","max_rate_per_endpoint":100}]}}'
spec:
type: ClusterIP
selector:
app: nginx
ports:
- port: 80
protocol: TCP
I have NEG creation and association with the Backend Service working correctly. However, when I'm deleting the service, I'm running into problems. Based on the autoneg-controller
logs, it seems to deregister the NEGs successfully:
2022-02-25T16:45:12.987+0100 DEBUG controller-runtime.manager.events Normal {"object": {"kind":"Service","namespace":"default","name":"neg-demo-svc","uid":"affa73d3-10e3-4698-ae02-d1c1c22ad748","apiVersion":"v1","resourceVersion":"420760"}, "reason": "Delete", "message": "Deregistered NEGs for \"default/neg-demo-svc\" from backend service \"argon-gke-general-blue-01-psc-backend-service\" (port 80)"}
I believe that this is related to this logic here:
gke-autoneg-controller/controllers/autoneg.go
Lines 270 to 274 in d0e0f48
In this case, intendedBEKeys
is empty, which means we're going to skip the entire loop that checks for differences. Shouldn't it also iterate on keys from actualBE
to detect the removal of ports?
Please let me know if I'm missing something. Is there anything else I might provide?
Hey @danielvoros-form3, I'm looking at the code and I think the loop at line 330 is just in wrong indentation level.
@danielvoros-form3 I think I have a fix in #58, would you be able to try it out?