To test how the operator handles pod evictions and ZPDB enforcement, you can simulate a node drain.
- Watch pod status in a continuous loop:
while true; do kubectl get pods -n rollout-operator-development; sleep 1; clear; done
- Issue a drain in a separate shell:
kubectl drain --pod-selector rollout-group=test-app minikube &; sleep 5; kubectl uncordon minikube
Important: The uncordon command is required in local single-node environments (like Minikube) to allow pods from the first zone to be re-deployed. Without re-deployment, the operator will not proceed to evict pods in the next zone.
Manually test the pod eviction webhook:
You can trigger the admission webhook manually using curl to verify it processes Eviction requests correctly:
curl --insecure -X POST "https://127.0.0.1:8443/admission/pod-eviction" \
-H "Content-Type: application/json" \
--data '{...}'
# Watch pod status
while true; do kubectl get pods -n rollout-operator-development; sleep 1; clear; done
# Issue a drain
kubectl drain --pod-selector rollout-group=test-app minikube &; sleep 5; kubectl uncordon minikube
# Manual webhook test
curl --insecure -X POST "https://127.0.0.1:8443/admission/pod-eviction" \
-H "Content-Type: application/json" \
--data '{ "apiVersion": "admission.k8s.io/v1", "kind": "AdmissionReview", "request": { "uid": "test-eviction-123", "kind": {"group": "policy", "version": "v1", "kind": "Eviction"}, "resource": {"group": "policy", "version": "v1", "resource": "evictions"}, "name": "test-app-zone-a-0", "namespace": "rollout-operator-development", "operation": "CREATE", "subResource": "eviction", "userInfo": {"username": "test-user"}, "dryRun": false, "object": { "apiVersion": "policy/v1", "kind": "Eviction", "metadata": {"name": "test-app-zone-a-0", "namespace": "rollout-operator-development"}, "deleteOptions": {"gracePeriodSeconds": 30} } } }'