Skip to content

Commit

Permalink
[stable/kong] introduce support for dbless Ingress Controller (helm#1…
Browse files Browse the repository at this point in the history
…3475)

Signed-off-by: Harry Bagdi <harrybagdi@gmail.com>
  • Loading branch information
hbagdi authored and eyenx committed May 28, 2019
1 parent cb5af27 commit eaeafd9
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 63 deletions.
2 changes: 1 addition & 1 deletion stable/kong/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ maintainers:
name: kong
sources:
- https://github.com/Kong/kong
version: 0.10.3
version: 0.11.0
appVersion: 1.1
4 changes: 4 additions & 0 deletions stable/kong/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ To deploy the ingress controller together with
kong run the following command:

```bash
# without a database
helm install stable/kong --set ingressController.enabled=true \
--set postgresql.enabled=false --set env.database=off
# with a database
helm install stable/kong --set ingressController.enabled=true
```

Expand Down
7 changes: 7 additions & 0 deletions stable/kong/ci/dbless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CI test for testing dbless deployment
ingressController:
enabled: true
env:
database: "off"
postgresql:
enabled: false
6 changes: 3 additions & 3 deletions stable/kong/requirements.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 3.18.3
version: 3.9.5
- name: cassandra
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
version: 0.10.5
digest: sha256:85e875e2c4a36bcb42c3312fa70e034a86694ef8cc2466b84742b2845ce4afaf
generated: 2019-05-02T09:31:39.733059563-07:00
digest: sha256:797c1cf8eb6504c93015f1b8f16b263dd94dca9a73cb647bdf3c0af153fba62c
generated: 2019-05-09T13:44:59.216637988-07:00
2 changes: 1 addition & 1 deletion stable/kong/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: postgresql
version: ~3.18.3
version: ~3.9.1
repository: https://kubernetes-charts.storage.googleapis.com/
condition: postgresql.enabled
- name: cassandra
Expand Down
52 changes: 52 additions & 0 deletions stable/kong/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,55 @@ Create the ingress servicePort value string
{{- include "kong.env" . | nindent 2 }}
command: [ "/bin/sh", "-c", "until kong start; do echo 'waiting for db'; sleep 1; done; kong stop" ]
{{- end -}}

{{- define "kong.controller-container" -}}
- name: ingress-controller
args:
- /kong-ingress-controller
# 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:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: "{{ .Values.ingressController.image.repository }}:{{ .Values.ingressController.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
{{ toYaml .Values.ingressController.resources | indent 10 }}
{{- end -}}
54 changes: 2 additions & 52 deletions stable/kong/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.ingressController.enabled -}}
{{- if (and (.Values.ingressController.enabled) (not (eq .Values.env.database "off"))) }}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
Expand Down Expand Up @@ -74,55 +74,5 @@ spec:
{{ toYaml .Values.livenessProbe | indent 10 }}
resources:
{{ toYaml .Values.resources | indent 10 }}
- name: ingress-controller
args:
- /kong-ingress-controller
# 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:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: "{{ .Values.ingressController.image.repository }}:{{ .Values.ingressController.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
{{ toYaml .Values.ingressController.resources | indent 10 }}
{{- include "kong.controller-container" . | nindent 6 }}
{{- end -}}
8 changes: 8 additions & 0 deletions stable/kong/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@ spec:
release: {{ .Release.Name }}
component: app
spec:
{{- if (and (.Values.ingressController) (eq .Values.env.database "off")) }}
serviceAccountName: {{ template "kong.serviceAccountName" . }}
{{ end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- if not (eq .Values.env.database "off") }}
initContainers:
{{- include "kong.wait-for-db" . | nindent 6 }}
{{ end }}
containers:
{{- if (and (.Values.ingressController) (eq .Values.env.database "off")) }}
{{- include "kong.controller-container" . | nindent 6 }}
{{ end }}
- name: {{ template "kong.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand Down
2 changes: 1 addition & 1 deletion stable/kong/templates/migrations-post-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.runMigrations }}
{{- if (and (.Values.runMigrations) (not (eq .Values.env.database "off"))) }}
# Why is this Job duplicated and not using only helm hooks?
# See: https://github.com/helm/charts/pull/7362
apiVersion: batch/v1
Expand Down
2 changes: 1 addition & 1 deletion stable/kong/templates/migrations-pre-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.runMigrations }}
{{- if (and (.Values.runMigrations) (not (eq .Values.env.database "off"))) }}
# Why is this Job duplicated and not using only helm hooks?
# See: https://github.com/helm/charts/pull/7362
apiVersion: batch/v1
Expand Down
2 changes: 1 addition & 1 deletion stable/kong/templates/migrations.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.runMigrations }}
{{- if (and (.Values.runMigrations) (not (eq .Values.env.database "off"))) }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
2 changes: 0 additions & 2 deletions stable/kong/templates/service-kong-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ spec:
{{- end }}
protocol: TCP
{{- end }}


selector:
app: {{ template "kong.name" . }}
release: {{ .Release.Name }}
Expand Down
2 changes: 1 addition & 1 deletion stable/kong/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ingressController:
enabled: false
image:
repository: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller
tag: 0.3.0
tag: 0.4.0
replicaCount: 1
livenessProbe:
failureThreshold: 3
Expand Down

0 comments on commit eaeafd9

Please sign in to comment.