From 80cf7057ceafa1dba0847fac65f0b9105ce0c981 Mon Sep 17 00:00:00 2001 From: Anas Date: Sun, 7 Jun 2020 10:37:45 +0200 Subject: [PATCH] [incubator/buzzfeed-sso] Add support for GCP BackendConfig (#22148) * Add support for GCP BackendConfig. Signed-off-by: Anas * Bump chart version. Signed-off-by: Anas * Document new variable. Signed-off-by: Anas --- incubator/buzzfeed-sso/Chart.yaml | 2 +- incubator/buzzfeed-sso/README.md | 1 + .../templates/ingress-backendconfigs.yaml | 15 +++++++++++++++ .../buzzfeed-sso/templates/proxy-service.yaml | 4 ++++ incubator/buzzfeed-sso/values.yaml | 6 ++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 incubator/buzzfeed-sso/templates/ingress-backendconfigs.yaml diff --git a/incubator/buzzfeed-sso/Chart.yaml b/incubator/buzzfeed-sso/Chart.yaml index dbd85dbbdf..bec5c0057d 100644 --- a/incubator/buzzfeed-sso/Chart.yaml +++ b/incubator/buzzfeed-sso/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Single sign-on for your Kubernetes services using Google OAuth name: buzzfeed-sso -version: 0.2.1 +version: 0.2.2 appVersion: 2.1.0 home: https://github.com/buzzfeed/sso sources: diff --git a/incubator/buzzfeed-sso/README.md b/incubator/buzzfeed-sso/README.md index 6574a48880..003e5c08d3 100644 --- a/incubator/buzzfeed-sso/README.md +++ b/incubator/buzzfeed-sso/README.md @@ -95,6 +95,7 @@ Parameter | Description | Default `ingress.extraLabels` | extra ingress labels | `{}` `ingress.hosts` | proxied hosts | `[]` `ingress.tls` | tls certificates for the proxied hosts | `[]` +`ingress.gcpBackendConfig` | GCP LB backend service configuration | `{}` `upstreams` | configuration of services that use sso | `[]` Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/incubator/buzzfeed-sso/templates/ingress-backendconfigs.yaml b/incubator/buzzfeed-sso/templates/ingress-backendconfigs.yaml new file mode 100644 index 0000000000..c417eccc04 --- /dev/null +++ b/incubator/buzzfeed-sso/templates/ingress-backendconfigs.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.ingress.enabled .Values.ingress.gcpBackendConfig }} +apiVersion: cloud.google.com/v1beta1 +kind: BackendConfig +metadata: + name: {{ template "buzzfeed-sso.fullname" . }} + labels: + app: {{ template "buzzfeed-sso.name" . }} + chart: {{ template "buzzfeed-sso.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: +{{- with .Values.ingress.gcpBackendConfig }} +{{ toYaml . | indent 2 }} +{{- end }} +{{- end }} diff --git a/incubator/buzzfeed-sso/templates/proxy-service.yaml b/incubator/buzzfeed-sso/templates/proxy-service.yaml index 2bf38711f0..54d3e09110 100644 --- a/incubator/buzzfeed-sso/templates/proxy-service.yaml +++ b/incubator/buzzfeed-sso/templates/proxy-service.yaml @@ -9,6 +9,10 @@ metadata: component: {{ $name }}-proxy release: {{ .Release.Name }} heritage: {{ .Release.Service }} +{{- if and .Values.ingress.enabled .Values.ingress.gcpBackendConfig }} + annotations: + beta.cloud.google.com/backend-config: '{"ports": {"http":"{{ template "buzzfeed-sso.fullname" . }}"}}' +{{- end }} spec: type: {{ .Values.proxy.service.type }} ports: diff --git a/incubator/buzzfeed-sso/values.yaml b/incubator/buzzfeed-sso/values.yaml index 5f4a9e82ed..d4a804297c 100644 --- a/incubator/buzzfeed-sso/values.yaml +++ b/incubator/buzzfeed-sso/values.yaml @@ -101,6 +101,12 @@ ingress: # - secretName: mybackend-mydomain-tls # hosts: # - mybackend.mydomain.foo + # GCP backend service configuration + # Possible values can be found here : https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig#backendconfigspec_v1beta1_cloudgooglecom + gcpBackendConfig: {} + # timeoutSec: 60 + # connectionDraining: + # drainingTimeoutSec: 60 upstreams: [] # See https://github.com/buzzfeed/sso/blob/f437f237ac977201f15868601c9bc0e9dff11f40/docs/sso_config.md#proxy-config