Skip to content

Commit

Permalink
[stable/kong] add support for Kong 1.0 (helm#10511)
Browse files Browse the repository at this point in the history
* [stable/kong] add support for Kong 1.0

Signed-off-by: Harry Bagdi <[email protected]>

* fix --kong-url for HTTPS

Signed-off-by: Harry Bagdi <[email protected]>

* fix comment and add todo

Signed-off-by: Harry Bagdi <[email protected]>
  • Loading branch information
hbagdi authored and k8s-ci-robot committed Jan 9, 2019
1 parent d79d868 commit 432f65a
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 36 deletions.
10 changes: 4 additions & 6 deletions stable/kong/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
6 changes: 1 addition & 5 deletions stable/kong/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions stable/kong/ci/ingressController-values.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions stable/kong/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,20 @@ 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
- --publish-service={{ .Release.Namespace }}/{{ template "kong.fullname" . }}-proxy
# 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:
Expand Down
76 changes: 76 additions & 0 deletions stable/kong/templates/migrations-post-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions stable/kong/templates/migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
6 changes: 3 additions & 3 deletions stable/kong/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 432f65a

Please sign in to comment.