nginxinc / nginx-loadbalancer-kubernetes

A Kubernetes Controller to synchronize NGINX+ Resources with Kubernetes Ingress Resources
Apache License 2.0
58 stars 19 forks source link

Use obj2 for Updated Object in handleUpdateEvent Method #131

Closed ciroque closed 10 months ago

ciroque commented 11 months ago

Describe the bug

The Certificates::handleUpdateEvent method uses the first argument to update the value of the Certificate. The first argument represents the old value, the second argument is the new value.

This bug will cause Certificate rotation to fail.

To reproduce

With a running nginx-loadbalancer-kubernetes, update one of the Secrets containing a Certificate. Updating the NGINX Plus host(s) may fail, depending on how aggressively certificate management is implemented.

Expected behavior

The internal state should be updated with the new certificate value.

Additional context

In the handleUpdateEvent method, it should use obj2 instead of obj to get the updated value of the object to reflect the latest changes.