This repository was archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
[stable/kong] Add a chart for Kong #3150
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| apiVersion: v1 | ||
| description: Kong is open-source API Gateway and Microservices Management Layer, | ||
| delivering high performance and reliability. | ||
| engine: gotpl | ||
| home: https://getkong.org/ | ||
| icon: https://s3.amazonaws.com/downloads.kong/universe/assets/icon-kong-inc-large.png | ||
| maintainers: | ||
| - name: shashiranjan84 | ||
| email: shashi@konghq.com | ||
| name: kong | ||
| sources: | ||
| - https://github.com/Kong/kong | ||
| version: 0.1.0 | ||
| appVersion: 0.12.1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| ## Kong | ||
|
|
||
| [Kong](https://getkong.org/) is an open-source API Gateway and Microservices | ||
| Management Layer, delivering high performance and reliability. | ||
|
|
||
| ## TL;DR; | ||
|
|
||
| ```bash | ||
| $ helm install stable/kong | ||
| ``` | ||
|
|
||
| ## Introduction | ||
|
|
||
| This chart bootstraps all the components needed to run Kong on a [Kubernetes](http://kubernetes.io) | ||
| cluster using the [Helm](https://helm.sh) package manager. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Kubernetes 1.8+ with Beta APIs enabled. | ||
| - PV provisioner support in the underlying infrastructure if persistence | ||
| is needed for Kong datastore. | ||
|
|
||
| ## Installing the Chart | ||
|
|
||
| To install the chart with the release name `my-release`: | ||
|
|
||
| ```bash | ||
| $ helm install --name my-release stable/kong | ||
| ``` | ||
|
|
||
| > **Tip**: List all releases using `helm list` | ||
|
|
||
| ## Uninstalling the Chart | ||
|
|
||
| To uninstall/delete the `my-release` deployment: | ||
|
|
||
| ```bash | ||
| $ helm delete my-release | ||
| ``` | ||
|
|
||
| The command removes all the Kubernetes components associated with the | ||
| chart and deletes the release. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### General Configuration Parameters | ||
|
|
||
| The following tables lists the configurable parameters of the Kong chart | ||
| and their default values. | ||
|
|
||
| | Parameter | Description | Default | | ||
| | ------------------------------ | -------------------------------------------------------------------- | ------------------- | | ||
| | image.repository | Kong image | `kong` | | ||
| | image.tag | Kong image version | `0.11.2` | | ||
| | image.pullPolicy | Image pull policy | `IfNotPresent` | | ||
| | replicaCount | Kong instance count | `1` | | ||
| | admin.http.servicePort | TCP port on which the Kong admin service is exposed | `8001` | | ||
| | admin.https.servicePort | Secure TCP port on which the Kong admin service is exposed | `8444` | | ||
| | admin.http.containerPort | TCP port on which Kong app listens for admin traffic | `8001` | | ||
| | admin.https.containerPort | Secure TCP port on which Kong app listens for admin traffic | `8444` | | ||
| | admin.nodePort | Node port when service type is `NodePort` | `32444` | | ||
| | admin.type | k8s service type, Options: NodePort, ClusterIP, LoadBalancer | `NodePort` | | ||
| | admin.loadBalancerIP | Will reuse an existing ingress static IP for the admin service | `null` | | ||
| | proxy.http.servicePort | TCP port on which the Kong proxy service is exposed | `8000` | | ||
| | proxy.https.servicePort | Secure TCP port on which the Kong Proxy Service is exposed | `8443` | | ||
| | proxy.http.containerPort | TCP port on which the Kong app listens for Proxy traffic | `8000` | | ||
| | proxy.https.containerPort | Secure TCP port on which the Kong app listens for Proxy traffic | `8443` | | ||
| | proxy.nodePort | Node port when service type is `NodePort` | `32443` | | ||
| | proxy.type | k8s service type. Options: NodePort, ClusterIP, LoadBalancer | `NodePort` | | ||
| | proxy.loadBalancerIP | To reuse an existing ingress static IP for the admin service | | | ||
| | env | Additional [Kong configurations](https://getkong.org/docs/latest/configuration/) | | ||
| | runMigrations | Run Kong migrations job | `true` | | ||
| | readinessProbe | Kong readiness probe | | | ||
| | livenessProbe | Kong liveness probe | | | ||
| | affinity | Node/pod affinities | | | ||
| | nodeSelector | Node labels for pod assignment | `{}` | | ||
| | podAnnotations | Annotations to add to each pod | `{}` | | ||
| | resources | Pod resource requests & limits | `{}` | | ||
| | tolerations | List of node taints to tolerate | `[]` | | ||
|
|
||
| ### Kong-specific parameters | ||
|
|
||
| Kong has a choice of either Postgres or Cassandra as a backend datatstore. | ||
| This chart allows you to choose either of them with the `env.database` | ||
| parameter. Postgres is chosen by default. | ||
|
|
||
| Additionally, this chart allows you to use your own database or spin up a new | ||
| instance by using the `postgres.enabled` or `cassandra.enabled` parameters. | ||
| Enabling both will create both databases in your cluster, but only one | ||
| will be used by Kong based on the `env.database` parameter. | ||
| Postgres is enabled by default. | ||
|
|
||
| | Parameter | Description | Default | | ||
| | ------------------------------ | -------------------------------------------------------------------- | ------------------- | | ||
| | cassandra.enabled | Spin up a new cassandra cluster for Kong | `false` | | ||
| | postgres.enabled | Spin up a new postgres instance for Kong | `true ` | | ||
| | env.database | Choose either `postgres` or `cassandra` | `postgres` | | ||
| | env.pg_user | Postgres username | `kong` | | ||
| | env.pg_database | Postgres database name | `kong` | | ||
| | env.pg_password | Postgres database password (required if you are using your own database)| `kong` | | ||
| | env.pg_host | Postgres database host (required if you are using your own database) | `` | | ||
| | env.pg_port | Postgres database port | `5432` | | ||
| | env.cassandra_contact_points | Cassandra contact points (required if you are using your own database) | `` | | ||
| | env.cassandra_port | Cassandra query port | `9042` | | ||
| | env.cassandra_keyspace | Cassandra keyspace | `kong` | | ||
| | env.cassandra_repl_factor | Replication factor for the Kong keyspace | `2` | | ||
|
|
||
| For complete list of Kong configurations please check https://getkong.org/docs/0.11.x/configuration/. | ||
|
|
||
| Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, | ||
|
|
||
| ```console | ||
| $ helm install stable/kong --name my-release \ | ||
| --set=image.tag=0.11.2,database.type=caasandra,cassandra.enabled=true | ||
| ``` | ||
|
|
||
| Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, | ||
|
|
||
| ```console | ||
| $ helm install stable/kong --name my-release -f values.yaml | ||
| ``` | ||
|
|
||
| > **Tip**: You can use the default [values.yaml](values.yaml) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| dependencies: | ||
| - name: postgresql | ||
| repository: https://kubernetes-charts.storage.googleapis.com/ | ||
| version: 0.8.5 | ||
| - name: cassandra | ||
| repository: https://kubernetes-charts-incubator.storage.googleapis.com/ | ||
| version: 0.1.9 | ||
| digest: sha256:260f7cb6e0ada4190711d6bd8bff23a97bdcab3e1f0f2802270513644dd96172 | ||
| generated: 2017-12-25T22:52:53.50321-08:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| dependencies: | ||
| - name: postgresql | ||
| version: ~0.8.3 | ||
| repository: https://kubernetes-charts.storage.googleapis.com/ | ||
| condition: postgresql.enabled | ||
| - name: cassandra | ||
| version: ~0.1.6 | ||
| repository: https://kubernetes-charts-incubator.storage.googleapis.com/ | ||
| condition: cassandra.enabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| 1. Kong Admin can be accessed inside the cluster using: | ||
| DNS={{ template "kong.fullname" . }}-admin.{{ .Release.Namespace }}.svc.cluster.local | ||
| {{- if .Values.admin.https }} | ||
| PORT={{ .Values.admin.https.servicePort }} | ||
| {{- else if .Values.admin.http }} | ||
| PORT={{ .Values.admin.http.servicePort }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| To connect from outside the K8s cluster: | ||
| {{- if contains "LoadBalancer" .Values.admin.type }} | ||
| HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-admin -o jsonpath='{.status.loadBalancer.ingress.ip}') | ||
| PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-admin -o jsonpath='{.spec.ports[0].nodePort}') | ||
|
|
||
| {{- else if contains "NodePort" .Values.admin.type }} | ||
| HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') | ||
| PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-admin -o jsonpath='{.spec.ports[0].nodePort}') | ||
|
|
||
| {{- else if contains "ClusterIP" .Values.admin.type }} | ||
| HOST=127.0.0.1 | ||
|
|
||
| {{- if .Values.admin.https }} | ||
| # Execute the following commands to route the connection to Admin SSL port: | ||
| export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}, app={{ template "kong.name" . }}" -o jsonpath="{.items[0].metadata.name}") | ||
| kubectl port-forward $POD_NAME {{ .Values.admin.https.servicePort }}:{{ .Values.admin.https.servicePort }} | ||
| {{- else if .Values.admin.http }} | ||
| # Execute the following commands to route the connection to Admin port: | ||
| export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}, app={{ template "kong.name" . }}" -o jsonpath="{.items[0].metadata.name}") | ||
| kubectl port-forward $POD_NAME {{ .Values.admin.http.servicePort }}:{{ .Values.admin.http.servicePort }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| 2. Kong Proxy can be accessed inside the cluster using: | ||
| DNS={{ template "kong.fullname" . }}-proxy.{{ .Release.Namespace }}.svc.cluster.local | ||
| {{- if .Values.proxy.https }} | ||
| PORT={{ .Values.proxy.https.servicePort }} | ||
| {{- else if .Values.proxy.http }} | ||
| PORT={{ .Values.proxy.http.servicePort }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| To connect from outside the K8s cluster: | ||
| {{- if contains "LoadBalancer" .Values.proxy.type }} | ||
| HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.status.loadBalancer.ingress.ip}') | ||
| PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.spec.ports[0].nodePort}') | ||
|
|
||
| {{- else if contains "NodePort" .Values.proxy.type }} | ||
| HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') | ||
| PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.spec.ports[0].nodePort}') | ||
|
|
||
| {{- else if contains "ClusterIP" .Values.proxy.type }} | ||
| HOST=127.0.0.1 | ||
|
|
||
| {{- if .Values.proxy.https }} | ||
| # Execute the following commands to route the connection to proxy SSL port: | ||
| export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}, app={{ template "kong.name" . }}" -o jsonpath="{.items[0].metadata.name}") | ||
| kubectl port-forward $POD_NAME {{ .Values.proxy.https.servicePort }}:{{ .Values.proxy.https.servicePort }} | ||
| {{- else if .Values.proxy.http }} | ||
| # Execute the following commands to route the connection to proxy port: | ||
| export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}, app={{ template "kong.name" . }}" -o jsonpath="{.items[0].metadata.name}") | ||
| kubectl port-forward $POD_NAME {{ .Values.proxy.http.servicePort }}:{{ .Values.proxy.http.servicePort }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| {{/* vim: set filetype=mustache: */}} | ||
| {{/* | ||
| Create a default fully qualified app name. | ||
| We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
| */}} | ||
|
|
||
| {{- define "kong.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "kong.fullname" -}} | ||
| {{- $name := default .Chart.Name .Values.nameOverride -}} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "kong.postgresql.fullname" -}} | ||
| {{- $name := default "postgresql" .Values.postgresql.nameOverride -}} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "kong.cassandra.fullname" -}} | ||
| {{- $name := default "cassandra" .Values.cassandra.nameOverride -}} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
| {{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| apiVersion: apps/v1beta2 | ||
| kind: Deployment | ||
| metadata: | ||
| name: "{{ template "kong.fullname" . }}" | ||
| labels: | ||
| app: "{{ template "kong.name" . }}" | ||
| chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| spec: | ||
| replicas: {{ .Values.replicaCount }} | ||
| selector: | ||
| matchLabels: | ||
| app: {{ template "kong.name" . }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| release: {{ .Release.Name }} | ||
| template: | ||
| metadata: | ||
| {{- if .Values.podAnnotations }} | ||
| annotations: | ||
| {{ toYaml .Values.podAnnotations | indent 8 }} | ||
| {{- end }} | ||
| labels: | ||
|
||
| app: {{ template "kong.name" . }} | ||
| release: {{ .Release.Name }} | ||
| spec: | ||
| containers: | ||
| - name: {{ template "kong.name" . }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| env: | ||
| - name: KONG_ADMIN_LISTEN | ||
| value: 0.0.0.0:{{ default 8001 .Values.admin.http.containerPort }} | ||
| - name: KONG_ADMIN_LISTEN_SSL | ||
| value: 0.0.0.0:{{ default 8444 .Values.admin.https.containerPort }} | ||
| - name: KONG_PROXY_LISTEN | ||
| value: 0.0.0.0:{{ default 8000 .Values.proxy.http.containerPort }} | ||
| - name: KONG_PROXY_LISTEN_SSL | ||
| value: 0.0.0.0:{{ default 8443 .Values.proxy.https.containerPort }} | ||
| - name: KONG_NGINX_DAEMON | ||
| value: "off" | ||
| - name: KONG_PROXY_ACCESS_LOG | ||
| value: "/dev/stdout" | ||
| - name: KONG_ADMIN_ACCESS_LOG | ||
| value: "/dev/stdout" | ||
| - name: KONG_PROXY_ERROR_LOG | ||
| value: "/dev/stderr" | ||
| - name: KONG_ADMIN_ERROR_LOG | ||
| value: "/dev/stderr" | ||
| {{- 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_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 }} | ||
| ports: | ||
| {{- if .Values.admin.https }} | ||
| - name: admin-ssl | ||
| containerPort: {{ .Values.admin.https.containerPort }} | ||
| protocol: TCP | ||
| {{- else if .Values.admin.http }} | ||
| - name: admin | ||
| containerPort: {{ .Values.admin.http.containerPort }} | ||
| protocol: TCP | ||
| {{ end }} | ||
| {{- if .Values.proxy.https }} | ||
| - name: proxy-ssl | ||
| containerPort: {{ .Values.proxy.https.containerPort }} | ||
| protocol: TCP | ||
| {{- else if .Values.proxy.http }} | ||
| - name: proxy | ||
| containerPort: {{ .Values.proxy.http.containerPort }} | ||
| protocol: TCP | ||
| {{- end }} | ||
| readinessProbe: | ||
| {{ toYaml .Values.readinessProbe | indent 10 }} | ||
| livenessProbe: | ||
| {{ toYaml .Values.livenessProbe | indent 10 }} | ||
| resources: | ||
| {{ toYaml .Values.resources | indent 10 }} | ||
| {{- if .Values.affinity }} | ||
| affinity: | ||
| {{ toYaml .Values.affinity | indent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{ toYaml .Values.nodeSelector | indent 8 }} | ||
| {{- end }} | ||
| tolerations: | ||
| {{ toYaml .Values.tolerations | indent 8 }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
appVersionfield.