-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP enable gateway discovery in db mode
- Loading branch information
1 parent
532ff47
commit f142554
Showing
13 changed files
with
2,680 additions
and
13 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
config/variants/multi-gw-postgres/base/gateway_admin_service.yaml
This file contains 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 | ||
kind: Service | ||
metadata: | ||
name: kong-admin | ||
namespace: kong | ||
spec: | ||
clusterIP: "None" | ||
selector: | ||
app: proxy-kong | ||
ports: | ||
- name: admin | ||
port: 8444 | ||
targetPort: 8444 | ||
protocol: TCP |
113 changes: 113 additions & 0 deletions
113
config/variants/multi-gw-postgres/base/gateway_deployment.yaml
This file contains 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,113 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: proxy-kong | ||
name: proxy-kong | ||
namespace: kong | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: proxy-kong | ||
template: | ||
metadata: | ||
annotations: | ||
traffic.sidecar.istio.io/includeInboundPorts: "" | ||
kuma.io/gateway: enabled | ||
kuma.io/service-account-token-volume: kong-serviceaccount-token | ||
labels: | ||
app: proxy-kong | ||
spec: | ||
serviceAccountName: kong-serviceaccount | ||
automountServiceAccountToken: false | ||
volumes: | ||
- name: kong-serviceaccount-token | ||
projected: | ||
sources: | ||
- serviceAccountToken: | ||
expirationSeconds: 3607 | ||
path: token | ||
- configMap: | ||
name: kube-root-ca.crt | ||
items: | ||
- key: ca.crt | ||
path: ca.crt | ||
- downwardAPI: | ||
items: | ||
- fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
path: namespace | ||
containers: | ||
- name: proxy | ||
image: kong-placeholder:placeholder # This is replaced by the config/image.yaml component | ||
env: | ||
# servers | ||
- name: KONG_PROXY_LISTEN | ||
value: 0.0.0.0:8000 reuseport backlog=16384, 0.0.0.0:8443 http2 ssl reuseport backlog=16384 | ||
- name: KONG_PORT_MAPS | ||
value: "80:8000, 443:8443" | ||
- name: KONG_ADMIN_LISTEN | ||
value: 0.0.0.0:8444 http2 ssl reuseport backlog=16384 | ||
- name: KONG_STATUS_LISTEN | ||
value: 0.0.0.0:8100 | ||
# DB | ||
- name: KONG_DATABASE | ||
value: "postgres" | ||
- name: KONG_PG_HOST | ||
value: postgres | ||
- name: KONG_PG_PASSWORD | ||
value: kong | ||
# runtime tweaks | ||
- name: KONG_NGINX_WORKER_PROCESSES | ||
value: "2" | ||
- name: KONG_KIC | ||
value: "on" | ||
# logging | ||
- name: KONG_ADMIN_ACCESS_LOG | ||
value: /dev/stdout | ||
- name: KONG_ADMIN_ERROR_LOG | ||
value: /dev/stderr | ||
# - name: KONG_PROXY_ACCESS_LOG | ||
# - value: /dev/stdout | ||
- name: KONG_PROXY_ERROR_LOG | ||
value: /dev/stderr | ||
# router mode in 3.0.0. use `traditional` here for full compatibility. | ||
- name: KONG_ROUTER_FLAVOR | ||
value: traditional | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: [ "/bin/bash", "-c", "kong quit" ] | ||
ports: | ||
- name: proxy | ||
containerPort: 8000 | ||
protocol: TCP | ||
- name: proxy-ssl | ||
containerPort: 8443 | ||
protocol: TCP | ||
- name: metrics | ||
containerPort: 8100 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /status | ||
port: 8100 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 1 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
readinessProbe: | ||
httpGet: | ||
path: /status/ready | ||
port: 8100 | ||
scheme: HTTP | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 1 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
failureThreshold: 3 |
8 changes: 8 additions & 0 deletions
8
config/variants/multi-gw-postgres/base/gateway_service_patch.yaml
This file contains 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,8 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kong-proxy | ||
namespace: kong | ||
spec: | ||
selector: | ||
app: proxy-kong |
This file contains 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,26 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: kong | ||
|
||
resources: | ||
- ../../../base | ||
- gateway_deployment.yaml | ||
- gateway_admin_service.yaml | ||
- postgres.yaml | ||
- migration.yaml | ||
|
||
components: | ||
- ../../../image/oss | ||
|
||
patchesStrategicMerge: | ||
- manager_multi_gateway_patch.yaml | ||
- gateway_service_patch.yaml | ||
|
||
patchesJson6902: | ||
- target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: ingress-kong | ||
path: ./remove_proxy_container.yaml |
17 changes: 17 additions & 0 deletions
17
config/variants/multi-gw-postgres/base/manager_multi_gateway_patch.yaml
This file contains 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,17 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: ingress-kong | ||
name: ingress-kong | ||
namespace: kong | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: ingress-controller | ||
env: | ||
- name: CONTROLLER_KONG_ADMIN_SVC | ||
value: kong/kong-admin | ||
- name: CONTROLLER_KONG_ADMIN_URL | ||
$patch: delete |
This file contains 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,32 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: kong-migrations | ||
namespace: kong | ||
spec: | ||
template: | ||
metadata: | ||
name: kong-migrations | ||
spec: | ||
initContainers: | ||
- name: wait-for-postgres | ||
image: kong-placeholder:placeholder | ||
env: | ||
- name: KONG_PG_HOST | ||
value: postgres | ||
- name: KONG_PG_PORT | ||
value: "5432" | ||
command: [ "/bin/bash", "-c", "until timeout 1 bash 9<>/dev/tcp/${KONG_PG_HOST}/${KONG_PG_PORT}; do echo 'waiting for db'; sleep 1; done" ] | ||
containers: | ||
- name: kong-migrations | ||
image: kong-placeholder:placeholder | ||
env: | ||
- name: KONG_PG_PASSWORD | ||
value: kong | ||
- name: KONG_PG_HOST | ||
value: postgres | ||
- name: KONG_PG_PORT | ||
value: "5432" | ||
command: [ "/bin/bash", "-c", "kong migrations bootstrap && kong migrations up && kong migrations finish" ] | ||
restartPolicy: OnFailure |
This file contains 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,62 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: postgres | ||
namespace: kong | ||
spec: | ||
ports: | ||
- name: pgql | ||
port: 5432 | ||
targetPort: 5432 | ||
protocol: TCP | ||
selector: | ||
app: postgres | ||
|
||
--- | ||
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 | ||
kind: StatefulSet | ||
metadata: | ||
name: postgres | ||
namespace: kong | ||
spec: | ||
serviceName: "postgres" | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: postgres | ||
template: | ||
metadata: | ||
labels: | ||
app: postgres | ||
spec: | ||
containers: | ||
- name: postgres | ||
image: postgres:9.5 | ||
volumeMounts: | ||
- name: datadir | ||
mountPath: /var/lib/postgresql/data | ||
subPath: pgdata | ||
env: | ||
- name: POSTGRES_USER | ||
value: kong | ||
- name: POSTGRES_PASSWORD | ||
value: kong | ||
- name: POSTGRES_DB | ||
value: kong | ||
- name: PGDATA | ||
value: /var/lib/postgresql/data/pgdata | ||
ports: | ||
- containerPort: 5432 | ||
# No pre-stop hook is required, a SIGTERM plus some time is all that's | ||
# needed for graceful shutdown of a node. | ||
terminationGracePeriodSeconds: 60 | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: datadir | ||
spec: | ||
accessModes: | ||
- "ReadWriteOnce" | ||
resources: | ||
requests: | ||
storage: 1Gi |
2 changes: 2 additions & 0 deletions
2
config/variants/multi-gw-postgres/base/remove_proxy_container.yaml
This file contains 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,2 @@ | ||
- op: remove | ||
path: "/spec/template/spec/containers/1" |
Oops, something went wrong.