Repository navigation
Conversation
Signed-off-by: tushar.tg.goyal <tushar.tg.goyal@oracle.com>
|
PR #160 addresses the two principal controller defects:
|
Signed-off-by: tushar.tg.goyal <tushar.tg.goyal@oracle.com>
|
Since this can be considered a breaking change I would suggest you change the design a bit. It's better to make this configurable at Service level. Use a Service annotation such as oci-native-ingress.oraclecloud.com/backend-draining: "true" and only set drain=true when:
All other Ingress backends should preserve today’s behavior. |
Signed-off-by: tushar.tg.goyal <tushar.tg.goyal@oracle.com>
Updated in f03446f to make draining opt-in using oci-native-ingress.oraclecloud.com/backend-draining: "true". Without it, backends remain drain=false. With it, draining occurs only for a published Endpoint referencing the exact UID-matched terminating Pod. Tests and documentation were updated. |
|
[P1] Complete the Deployment example so it can be applied The example under Graceful Backend Draining omits the required |
|
[P2] Protect drain-only backend updates with the load balancer ETag
|
Signed-off-by: tushar.tg.goyal <tushar.tg.goyal@oracle.com>
Fixed. The example now includes matching selector/template labels, probes, 60-second shutdown configuration, and resource requests/limits. |
Fixed. Drain updates now use IfMatch, refresh the backend state and ETag between updates, and treat 412 responses as transient for retry. Tests also verify ETag refresh and preservation of non-drain fields. |
|
One thing to think through before merging: a backend marked as “draining” is still counted by the Load Balancer as a backend. OCI Load Balancers allow up to:
So a rollout can get stuck when the LB is already at either limit:
It would be good to decide the intended behavior at capacity:
My preference is to keep some slots for rolling updates, but it has to be managed across backendsets. |
Summary
This change adds support for draining terminating Pod backends in VCN-native clusters.
During backend reconciliation, when a published Kubernetes Endpoint references the exact Pod whose
DeletionTimestampis set, the controller keeps the existing OCI Load Balancer backend and setsdrain=true. Pod termination and Endpoint changes enqueue reconciliation immediately; the existing 10-second periodic reconciliation remains as a fallback.OCI drain mode stops new TCP connections and new non-sticky HTTP requests from being routed to that backend. Existing connections and persisted sessions can continue while the application performs graceful shutdown, subject to its shutdown behavior and Kubernetes termination grace period.
Changes
DeletionTimestamp.TargetRefnamespace, kind, and UID before using a cached Pod.drain=truewhile continuing to reconcile other addresses.UpdateBackendcalls when only drain state changes; retain full backend-set updates for membership changes.How it works
DeletionTimestampwhen Pod termination starts.drain=true.Backend removal may be delayed while an Endpoint temporarily references a Pod missing from the informer cache. During this skew, the controller retains that address as drained and continues reconciling the remaining addresses.
Configuration requirements
The terminating Endpoint must remain published long enough for the controller to observe and drain it:
Because this setting also publishes startup-failing and otherwise unready endpoints, use a dedicated Ingress-facing Service and do not reuse it for non-Ingress consumers.
Configure the OCI Load Balancer with an HTTP/HTTPS health check against the application's readiness endpoint instead of relying on the default TCP health check.
Size the Pod lifecycle budget using:
The drain wait should account for:
The application must handle
SIGTERM, stop accepting new work, and finish or bound in-flight, WebSocket, streaming, and other long-lived connections within the remaining grace period.This change does not delay Pod termination or provide Pod-level acknowledgement that OCI has applied drain mode. A fixed
preStopwait is therefore best-effort.See GettingStarted.md for the complete Service, Ingress, Deployment, timing, and verification guidance.
Validation
go test -mod=vendor ./...go test -race -mod=vendor -count=1 ./pkg/controllers/backend ./pkg/controllers/nodeBackend ./pkg/loadbalancer ./pkg/oci/client ./pkg/server ./pkg/utilgo vet -mod=vendor ./pkg/controllers/backend ./pkg/controllers/nodeBackend ./pkg/loadbalancer ./pkg/oci/client ./pkg/server ./pkg/util