From 417065fbbaf0cd2ec817e4d540444ec9d978baf8 Mon Sep 17 00:00:00 2001 From: Mateusz Czubak Date: Mon, 30 Nov 2020 13:11:31 +0100 Subject: [PATCH 1/2] Add support for the service session affinity --- README.md | 1 + templates/service.yaml | 3 +++ values.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 9d99ae25f..0cd7947d8 100755 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ The following tables lists the configurable parameters of the Ambassador chart a | `service.ports` | List of ports Ambassador is listening on | `[{"name": "http","port": 80,"targetPort": 8080},{"name": "https","port": 443,"targetPort": 8443}]` | | `service.loadBalancerIP` | IP address to assign (if cloud provider supports it) | `""` | | `service.loadBalancerSourceRanges` | Passed to cloud provider load balancer if created (e.g: AWS ELB) | None | +| `service.sessionAffinity` | Sets the session affinity policy for the service | `""` | | `service.type` | Service type to be used | `LoadBalancer` | | `service.externalIPs` | External IPs to route to the ambassador service | `[]` | | `serviceAccount.create` | If `true`, create a new service account | `true` | diff --git a/templates/service.yaml b/templates/service.yaml index 928121fc6..8bb8354fa 100644 --- a/templates/service.yaml +++ b/templates/service.yaml @@ -29,6 +29,9 @@ spec: {{- if .Values.service.externalTrafficPolicy }} externalTrafficPolicy: "{{ .Values.service.externalTrafficPolicy }}" {{- end }} + {{- if .Values.service.sessionAffinity }} + sessionAffinity: {{ .Values.service.sessionAffinity }} + {{- end }} ports: {{- range .Values.service.ports }} - name: {{ .name }} diff --git a/values.yaml b/values.yaml index d9f73b63e..d7bc8c527 100644 --- a/values.yaml +++ b/values.yaml @@ -151,6 +151,8 @@ service: externalTrafficPolicy: + sessionAffinity: + externalIPs: [] annotations: {} From 5c16f6ae6ebfad31be9388a9390f415760d00b80 Mon Sep 17 00:00:00 2001 From: Mateusz Czubak Date: Mon, 30 Nov 2020 15:36:25 +0100 Subject: [PATCH 2/2] Add support for the service session affinity config Beside from setting `service.sessionAffinity`, one can also set the maximum session sticky time by setting `service.sessionAffinityConfig`. Below configuration: ``` service: sessionAffinity: ClientIP sessionAffinityConfig: clientIP: timeoutSeconds: 100 ``` will set the session sticky time to 100 seconds, overriding the default value of 10800. --- README.md | 1 + templates/service.yaml | 4 ++++ values.yaml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 0cd7947d8..18f880888 100755 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ The following tables lists the configurable parameters of the Ambassador chart a | `service.loadBalancerIP` | IP address to assign (if cloud provider supports it) | `""` | | `service.loadBalancerSourceRanges` | Passed to cloud provider load balancer if created (e.g: AWS ELB) | None | | `service.sessionAffinity` | Sets the session affinity policy for the service | `""` | +| `service.sessionAffinityConfig` | Sets the session affinity config for the service | `""` | | `service.type` | Service type to be used | `LoadBalancer` | | `service.externalIPs` | External IPs to route to the ambassador service | `[]` | | `serviceAccount.create` | If `true`, create a new service account | `true` | diff --git a/templates/service.yaml b/templates/service.yaml index 8bb8354fa..fc7e91c2e 100644 --- a/templates/service.yaml +++ b/templates/service.yaml @@ -32,6 +32,10 @@ spec: {{- if .Values.service.sessionAffinity }} sessionAffinity: {{ .Values.service.sessionAffinity }} {{- end }} + {{- if .Values.service.sessionAffinityConfig }} + sessionAffinityConfig: + {{- toYaml .Values.service.sessionAffinityConfig | nindent 4 }} + {{- end }} ports: {{- range .Values.service.ports }} - name: {{ .name }} diff --git a/values.yaml b/values.yaml index d7bc8c527..0d0743fad 100644 --- a/values.yaml +++ b/values.yaml @@ -153,6 +153,8 @@ service: sessionAffinity: + sessionAffinityConfig: + externalIPs: [] annotations: {}