From 432f65a95f3bf1ccb0231e512b462ff877c8f393 Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 9 Jan 2019 13:41:40 -0800 Subject: [PATCH] [stable/kong] add support for Kong 1.0 (#10511) * [stable/kong] add support for Kong 1.0 Signed-off-by: Harry Bagdi * fix --kong-url for HTTPS Signed-off-by: Harry Bagdi * fix comment and add todo Signed-off-by: Harry Bagdi --- stable/kong/Chart.yaml | 10 +-- stable/kong/README.md | 6 +- stable/kong/ci/ingressController-values.yaml | 11 --- .../kong/templates/controller-deployment.yaml | 9 ++- .../templates/migrations-post-upgrade.yaml | 76 +++++++++++++++++++ ...grade.yaml => migrations-pre-upgrade.yaml} | 8 +- stable/kong/templates/migrations.yaml | 10 +-- stable/kong/values.yaml | 6 +- 8 files changed, 100 insertions(+), 36 deletions(-) create mode 100644 stable/kong/templates/migrations-post-upgrade.yaml rename stable/kong/templates/{migrations-on-upgrade.yaml => migrations-pre-upgrade.yaml} (92%) diff --git a/stable/kong/Chart.yaml b/stable/kong/Chart.yaml index abd4cd1b52..8ee27369e2 100644 --- a/stable/kong/Chart.yaml +++ b/stable/kong/Chart.yaml @@ -1,8 +1,6 @@ apiVersion: v1 -description: Kong is open-source API Gateway - and Microservices Management Layer, - delivering high performance and reliability that can be used as - Kubernetes Ingress. +description: The Cloud-Native Ingress and + Service Mesh for APIs and Microservices engine: gotpl home: https://KongHQ.com/ icon: https://s3.amazonaws.com/downloads.kong/universe/assets/icon-kong-inc-large.png @@ -12,5 +10,5 @@ maintainers: name: kong sources: - https://github.com/Kong/kong -version: 0.7.3 -appVersion: 0.14.1 +version: 0.8.0 +appVersion: 1.0.0 diff --git a/stable/kong/README.md b/stable/kong/README.md index 65e353879e..7734220feb 100644 --- a/stable/kong/README.md +++ b/stable/kong/README.md @@ -150,11 +150,7 @@ To deploy the ingress controller together with kong run the following command: ```bash -helm install stable/kong \ - --set ingressController.enabled=true \ - --set admin.useTLS=false \ - --set readinessProbe.httpGet.scheme=HTTP \ - --set livenessProbe.httpGet.scheme=HTTP +helm install stable/kong --set ingressController.enabled=true ``` **Note**: Kong Ingress controller doesn't support custom SSL certificates diff --git a/stable/kong/ci/ingressController-values.yaml b/stable/kong/ci/ingressController-values.yaml index 7939a32c4f..e36fed4aa2 100644 --- a/stable/kong/ci/ingressController-values.yaml +++ b/stable/kong/ci/ingressController-values.yaml @@ -1,14 +1,3 @@ # CI test for Ingress controller basic installation - -admin: - useTLS: false - -readinessProbe: - httpGet: - scheme: HTTP -livenessProbe: - httpGet: - scheme: HTTP - ingressController: enabled: true diff --git a/stable/kong/templates/controller-deployment.yaml b/stable/kong/templates/controller-deployment.yaml index ced97ea963..08e445de9e 100644 --- a/stable/kong/templates/controller-deployment.yaml +++ b/stable/kong/templates/controller-deployment.yaml @@ -114,8 +114,6 @@ spec: - name: ingress-controller args: - /kong-ingress-controller - # the kong URL points to the kong admin api server - - --kong-url=http://localhost:{{ .Values.admin.containerPort }} # the default service is the kong proxy service - --default-backend-service={{ .Release.Namespace }}/{{ template "kong.fullname" . }}-proxy # Service from were we extract the IP address/es to use in Ingress status @@ -123,6 +121,13 @@ spec: # Set the ingress class - --ingress-class={{ .Values.ingressController.ingressClass }} - --election-id=kong-ingress-controller-leader-{{ .Values.ingressController.ingressClass }} + # the kong URL points to the kong admin api server + {{- if .Values.admin.useTLS }} + - --kong-url=https://localhost:{{ .Values.admin.containerPort }} + - --admin-tls-skip-verify # TODO make this configurable + {{- else }} + - --kong-url=http://localhost:{{ .Values.admin.containerPort }} + {{- end }} env: - name: POD_NAME valueFrom: diff --git a/stable/kong/templates/migrations-post-upgrade.yaml b/stable/kong/templates/migrations-post-upgrade.yaml new file mode 100644 index 0000000000..0afec9c6d9 --- /dev/null +++ b/stable/kong/templates/migrations-post-upgrade.yaml @@ -0,0 +1,76 @@ +{{- if .Values.runMigrations }} +# Why is this Job duplicated and not using only helm hooks? +# See: https://github.com/helm/charts/pull/7362 +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template "kong.fullname" . }}-post-upgrade-migrations + labels: + app: {{ template "kong.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + component: post-upgrade-migrations + annotations: + helm.sh/hook: "post-upgrade" + helm.sh/hook-delete-policy: "before-hook-creation" +spec: + template: + metadata: + name: {{ template "kong.name" . }}-post-upgrade-migrations + labels: + app: {{ template "kong.name" . }} + release: "{{ .Release.Name }}" + component: post-upgrade-migrations + spec: + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.postgresql.enabled }} + initContainers: + - name: wait-for-postgres + image: busybox + env: + - name: KONG_PG_HOST + value: {{ template "kong.postgresql.fullname" . }} + - name: KONG_PG_PORT + value: "{{ .Values.postgresql.service.port }}" + - name: KONG_PG_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "kong.postgresql.fullname" . }} + key: postgres-password + command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ] + {{- end }} + containers: + - name: {{ template "kong.name" . }}-post-upgrade-migrations + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: KONG_NGINX_DAEMON + value: "off" + {{- range $key, $val := .Values.env }} + - name: KONG_{{ $key | upper}} + value: {{ $val | quote }} + {{- end}} + {{- if .Values.postgresql.enabled }} + - name: KONG_PG_HOST + value: {{ template "kong.postgresql.fullname" . }} + - name: KONG_PG_PORT + value: "{{ .Values.postgresql.service.port }}" + - name: KONG_PG_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "kong.postgresql.fullname" . }} + key: postgres-password + {{- end }} + {{- if .Values.cassandra.enabled }} + - name: KONG_CASSANDRA_CONTACT_POINTS + value: {{ template "kong.cassandra.fullname" . }} + {{- end }} + command: [ "/bin/sh", "-c", "kong migrations finish" ] + restartPolicy: OnFailure +{{- end }} diff --git a/stable/kong/templates/migrations-on-upgrade.yaml b/stable/kong/templates/migrations-pre-upgrade.yaml similarity index 92% rename from stable/kong/templates/migrations-on-upgrade.yaml rename to stable/kong/templates/migrations-pre-upgrade.yaml index 170a7aef57..9328aeb385 100644 --- a/stable/kong/templates/migrations-on-upgrade.yaml +++ b/stable/kong/templates/migrations-pre-upgrade.yaml @@ -4,24 +4,24 @@ apiVersion: batch/v1 kind: Job metadata: - name: {{ template "kong.fullname" . }}-upgrade-migrations + name: {{ template "kong.fullname" . }}-pre-upgrade-migrations labels: app: {{ template "kong.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" - component: migrations + component: pre-upgrade-migrations annotations: helm.sh/hook: "pre-upgrade" helm.sh/hook-delete-policy: "before-hook-creation" spec: template: metadata: - name: {{ template "kong.name" . }}-upgrade-migrations + name: {{ template "kong.name" . }}-pre-upgrade-migrations labels: app: {{ template "kong.name" . }} release: "{{ .Release.Name }}" - component: migrations + component: pre-upgrade-migrations spec: {{- if .Values.image.pullSecrets }} imagePullSecrets: diff --git a/stable/kong/templates/migrations.yaml b/stable/kong/templates/migrations.yaml index c77caa7ff4..ed3d3c3907 100644 --- a/stable/kong/templates/migrations.yaml +++ b/stable/kong/templates/migrations.yaml @@ -2,21 +2,21 @@ apiVersion: batch/v1 kind: Job metadata: - name: {{ template "kong.fullname" . }}-migrations + name: {{ template "kong.fullname" . }}-init-migrations labels: app: {{ template "kong.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" - component: migrations + component: init-migrations spec: template: metadata: - name: {{ template "kong.name" . }}-migrations + name: {{ template "kong.name" . }}-init-migrations labels: app: {{ template "kong.name" . }} release: "{{ .Release.Name }}" - component: migrations + component: init-migrations spec: {{- if .Values.image.pullSecrets }} imagePullSecrets: @@ -66,6 +66,6 @@ spec: - name: KONG_CASSANDRA_CONTACT_POINTS value: {{ template "kong.cassandra.fullname" . }} {{- end }} - command: [ "/bin/sh", "-c", "kong migrations up" ] + command: [ "/bin/sh", "-c", "kong migrations bootstrap" ] restartPolicy: OnFailure {{- end }} diff --git a/stable/kong/values.yaml b/stable/kong/values.yaml index 78c88cf65d..f65794930c 100644 --- a/stable/kong/values.yaml +++ b/stable/kong/values.yaml @@ -3,7 +3,7 @@ image: repository: kong - tag: 0.14.1 + tag: 1.0.0 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. @@ -170,7 +170,7 @@ ingressController: enabled: false image: repository: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller - tag: 0.2.2 + tag: 0.3.0 replicaCount: 1 livenessProbe: failureThreshold: 3 @@ -206,4 +206,4 @@ ingressController: # If not set and create is true, a name is generated using the fullname template name: - ingressClass: nginx + ingressClass: kong