Skip to content

Commit

Permalink
WIP enable gateway discovery in db mode
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Oct 13, 2023
1 parent f711b2a commit 06417b3
Show file tree
Hide file tree
Showing 11 changed files with 2,605 additions and 13 deletions.
14 changes: 14 additions & 0 deletions config/variants/multi-gw-postgres/gateway_admin_service.yaml
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 config/variants/multi-gw-postgres/gateway_deployment.yaml
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 config/variants/multi-gw-postgres/gateway_service_patch.yaml
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
24 changes: 24 additions & 0 deletions config/variants/multi-gw-postgres/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: kong

resources:
- ../postgres
- gateway_admin_service.yaml
- gateway_deployment.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 config/variants/multi-gw-postgres/manager_multi_gateway_patch.yaml
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
2 changes: 2 additions & 0 deletions config/variants/multi-gw-postgres/remove_proxy_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- op: remove
path: "/spec/template/spec/containers/1"
Loading

0 comments on commit 06417b3

Please sign in to comment.