-
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.
feat(discovery) enable gateway discovery in db mode (#4828)
Support --kong-admin-svc in DB mode. Choose only a single endpoint from the Service at random and send updates to it. Track updates applied to one endpoint as applied to all endpoints in DB mode. --------- Co-authored-by: Patryk Małek <[email protected]> Co-authored-by: Grzegorz Burzyński <[email protected]>
- Loading branch information
1 parent
ffdb3db
commit c39e31e
Showing
20 changed files
with
3,111 additions
and
79 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
config/variants/multi-gw-postgres/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/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 |
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,22 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: kong | ||
|
||
resources: | ||
- ../postgres | ||
- gateway_admin_service.yaml | ||
- gateway_deployment.yaml | ||
|
||
components: | ||
- ../../image/oss | ||
|
||
patches: | ||
- path: manager_multi_gateway_patch.yaml | ||
- path: gateway_service_patch.yaml | ||
- 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/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 |
2 changes: 2 additions & 0 deletions
2
config/variants/multi-gw-postgres/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" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.