feat: add LB session persistence and listener idle timeout features #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PS: Still waiting for my OCA agreement to be accepted.
Subject: feat: Add LB Cookie Session Persistence and Listener Idle Timeout
Related Issue: Fixes #106 + Add LB side Cookie Session Persistence
Description:
This pull request introduces two significant enhancements to the OCI Native Ingress Controller, allowing finer-grained control over OCI Load Balancer configurations through
IngressClassParameters
:lbCookieSessionPersistenceConfiguration
field can now be defined withinIngressClassParameters
. This allows users to enable and configure LB cookie stickiness (e.g., cookie name, max-age/timeout, path, domain, security attributes) for backend sets.ingress
controller now applies this configuration to backend sets created based onIngress
rules.ingressclass
controller also applies this configuration to the default backend set of the Load Balancer.defaultListenerIdleTimeoutInSeconds
field can be specified inIngressClassParameters
.ingress
controller uses this value to configure the idle timeout on listeners (e.g., HTTP, HTTPS) it provisions forIngress
resources.Summary of Changes:
api/v1beta1/ingressclassparameters_types.go
):lbCookieSessionPersistenceConfiguration
(and itsLbCookieSessionPersistenceConfigurationDetails
struct) toIngressClassParametersSpec
.defaultListenerIdleTimeoutInSeconds
toIngressClassParametersSpec
.pkg/controllers/ingressclass/ingressclass.go
: Updated to handlelbCookieSessionPersistenceConfiguration
for the default backend set.pkg/controllers/ingress/ingress.go
:defaultListenerIdleTimeoutInSeconds
during listener creation and updates.syncBackendSet
to applylbCookieSessionPersistenceConfiguration
to Ingress-derived backend sets during creation and updates, ensuring a consolidated update approach.pkg/loadbalancer/loadbalancer.go
(CreateListener
,UpdateListener
,CreateBackendSet
,UpdateBackendSet
) to support the new parameters.LoadBalancerInterface
inpkg/oci/client/loadbalancer.go
(e.g., addedGetBackendSet
) and its implementation.IngressClassParameters
YAML (deploy/example/customresource/ingressclassparameter.yaml
) has been updated with commented-out sections for the new configurations.Documentation Impact:
README.md
or other documentation detailingIngressClassParameters
fields will need to be updated to describelbCookieSessionPersistenceConfiguration
anddefaultListenerIdleTimeoutInSeconds
.Validation Steps:
Prerequisites:
IngressClassParameters
CRD manifest (e.g., usingcontroller-gen crd paths=./api/v1beta1/... output:crd:dir=./deploy/manifests/oci-native-ingress-controller/crds
) and apply the updated CRD to your Kubernetes cluster (kubectl apply -f ...
). (Already commited with this done)1. Validate LB Cookie Session Persistence:
a. Define an
IngressClassParameters
resource with thelbCookieSessionPersistenceConfiguration
section (e.g., setcookieName
,timeoutInSeconds
).b. Create an
IngressClass
referencing these parameters.c. Deploy an application with an
Ingress
using thisIngressClass
.d. Verify in OCI Console: Check the OCI Load Balancer. The backend set corresponding to your Ingress rule should have the specified cookie session persistence settings.
e. Test Stickiness: Make multiple requests from a single client to your application's endpoint. Verify requests are routed to the same backend pod and check for the presence of the configured cookie in HTTP responses.
2. Validate Default Listener Idle Timeout:
a. Define an
IngressClassParameters
resource settingdefaultListenerIdleTimeoutInSeconds
(e.g., to120
).b. Ensure your
IngressClass
uses these parameters.c. Deploy an
Ingress
that creates listeners.d. Verify in OCI Console: Check the listeners on the OCI Load Balancer. Their "Idle Timeout" should match the value from
defaultListenerIdleTimeoutInSeconds
.