Skip to content

Commit

Permalink
refactor(deploy) consolidate kustomize sources (#1682)
Browse files Browse the repository at this point in the history
* feat(codegen) remove Role from RBAC template

Remove Role generation from the RBAC template. This was intended to
generate a template role for use with --watch-namespace. However, the
Role doesn't differ from the ClusterRole at all beyond the API kind, and
isn't that useful. We either:

- Handle the conversion from ClusterRole to Role in Helm chart
  templates.
- Instruct users to edit the resource kind and add namespaces as needed
  when creating the Role.

The Role template always required some manual editing anyway (to set the
namespace) and requires that we pre-process the generated role.yaml to
remove it when we don't want to include it (in the single manifests), so
removing it simplifies our generator code without much impact to end
deliverables.

* chore(deploy) move base and variant manifests

Move the various manifests under deploy/manifests/base,
deploy/manifests/enterprise-k8s/ deploy/manifests/enterprise, and
deploy/manifests/postgres to config/base and config/variants.

* chore(deploy) remove unused configuration

Remove the v1 CRDs, RBAC, and kustomizations under deploy/manifests.

* refactor(deploy) remove RBAC preprocessing

Remove steps to pre-process RBAC resources and point kustomization
directly to original RBAC resources.

* chore(deploy) remove 2.x-specific patch

Add all content in the 2.x patch directly to
config/base/kong-ingress-dbless.yaml. Remove the 2.x patch and
associated kustomize patch configuration.

Regenerate manifests. Some content moved due to kustomize's patch
handling versus base handling, but there are no meaningful changes.

* refactor(deploy) simplify single manifest script

Remove staging directory for building single manifests.

Rework kustomizations to allow building single manifests directly from
the sources under config.

Disable auth proxy in RBAC kustomization.yaml. We aren't using it yet;
previously we had to copy only RBAC configuration we use into the
staging directory.
  • Loading branch information
Travis Raines authored Aug 11, 2021
1 parent 1b705d2 commit 218be9b
Show file tree
Hide file tree
Showing 37 changed files with 498 additions and 1,378 deletions.
18 changes: 0 additions & 18 deletions config/base/kong-ingress-2x.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/base/kong-ingress-dbless.yaml

This file was deleted.

131 changes: 131 additions & 0 deletions config/base/kong-ingress-dbless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: ingress-kong
name: ingress-kong
namespace: kong
spec:
replicas: 1
selector:
matchLabels:
app: ingress-kong
template:
metadata:
annotations:
traffic.sidecar.istio.io/includeInboundPorts: ""
kuma.io/gateway: enabled
labels:
app: ingress-kong
spec:
serviceAccountName: kong-serviceaccount
containers:
- name: proxy
image: kong:2.4
env:
# servers
- name: KONG_PROXY_LISTEN
value: 0.0.0.0:8000, 0.0.0.0:8443 ssl http2
- name: KONG_PORT_MAPS
value: "80:8000, 443:8443"
- name: KONG_ADMIN_LISTEN
value: 127.0.0.1:8444 ssl
- name: KONG_STATUS_LISTEN
value: 0.0.0.0:8100
# DB
- name: KONG_DATABASE
value: "off"
# runtime tweaks
- name: KONG_NGINX_WORKER_PROCESSES
value: "2"
# 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
lifecycle:
preStop:
exec:
command: [ "/bin/sh", "-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
port: 8100
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
- name: ingress-controller
env:
- name: CONTROLLER_KONG_ADMIN_URL
value: "https://127.0.0.1:8444"
- name: CONTROLLER_KONG_ADMIN_TLS_SKIP_VERIFY
value: "true"
- name: CONTROLLER_PUBLISH_SERVICE
value: "kong/kong-proxy"
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: kong/kubernetes-ingress-controller:2.0.0-beta.1
imagePullPolicy: IfNotPresent
ports:
- name: webhook
containerPort: 8080
protocol: TCP
- name: cmetrics
containerPort: 10255
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /readyz
port: 10254
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
9 changes: 2 additions & 7 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
resources:
- namespace.yaml
- crd
- manager-role.yaml
- manager-rolebinding.yaml
- leader-election-role.yaml
- leader-election-rolebinding.yaml
- ../crd
- ../rbac
- service.yaml
- serviceaccount.yaml
- validation-service.yaml
- kong-ingress-dbless.yaml
patchesStrategicMerge:
- kong-ingress-2x.yaml
namespace: kong
1 change: 0 additions & 1 deletion config/base/namespace.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions config/base/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: kong

1 change: 0 additions & 1 deletion config/base/service.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions config/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
apiVersion: v1
kind: Service
metadata:
name: kong-proxy
namespace: kong
annotations:
# Cloud-provider specific annotations
# GKE
# GKE creates a L4 LB for any service of type LoadBalancer
# TODO figure out how to enable Proxy Protocol on an L4 LB for GKE
# AWS
# Use NLB over ELB
service.beta.kubernetes.io/aws-load-balancer-type: nlb
# Use L4 LB so that Kong can do TLS termination
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
# Enable Proxy Protocol when Kong is listening for proxy-protocol
#service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
spec:
type: LoadBalancer
ports:
- name: proxy
port: 80
targetPort: 8000
protocol: TCP
- name: proxy-ssl
port: 443
targetPort: 8443
protocol: TCP
selector:
app: ingress-kong

1 change: 0 additions & 1 deletion config/base/validation-service.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions config/base/validation-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Service
metadata:
name: kong-validation-webhook
namespace: kong
spec:
ports:
- name: webhook
port: 443
protocol: TCP
targetPort: 8080
selector:
app: ingress-kong
8 changes: 4 additions & 4 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resources:
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
# - auth_proxy_service.yaml
# - auth_proxy_role.yaml
# - auth_proxy_role_binding.yaml
# - auth_proxy_client_clusterrole.yaml
Loading

0 comments on commit 218be9b

Please sign in to comment.