cybozu-go/coil

Egress NAT Deployment does not rollout restart

masa213f opened this issue · 0 comments

Describe the bug

I tried to restart the Egress NAT Deployment by kubectl rollout restart.
But the NAT Deployment does not restart.

$ kubectl rollout restart deploy test-nat
$ kubectl get pod -w
NAME                           READY   STATUS    RESTARTS   AGE
test-nat-5f67c6947d-54rjk      1/1     Running   0          108s
test-nat-5f67c6947d-szxst      1/1     Running   0          108s
test-nat-7f9df9488b-pjvbg      0/1     Pending   0          0s   // The new pod is created.
test-nat-7f9df9488b-pjvbg      0/1     Pending   0          0s
test-nat-7f9df9488b-pjvbg      0/1     ContainerCreating   0          0s
test-nat-7f9df9488b-pjvbg      0/1     Terminating         0          0s // The new pod is terminated immediately.
test-nat-7f9df9488b-pjvbg      1/1     Terminating         0          1s
test-nat-7f9df9488b-pjvbg      0/1     Terminating         0          32s
test-nat-7f9df9488b-pjvbg      0/1     Terminating         0          32s
test-nat-7f9df9488b-pjvbg      0/1     Terminating         0          32s

Environments

  • Version: coil v2.0.14

To Reproduce

  1. Create an Egress resource.
  2. kubectl rollout restart deploy <NAT_Deployment>

Expected behavior
The old NAT pods be terminated. And the new pods become running.

Additional context

kubectl rollout restart deployment adds a kubectl.kubernetes.io/restartedAt annotation to the pod template of the Deployment for creating the new ReplicaSet.
But the egress controller will overwirte the annotation.
https://github.com/cybozu-go/coil/blob/v2.0.14/v2/controllers/egress_controller.go#L118