Skip to content

Commit

Permalink
chore: add webhook configuration to dev kustomizations (Kong#5168)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Nov 15, 2023
1 parent 472acc4 commit e8b1b31
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 2 deletions.
12 changes: 12 additions & 0 deletions config/components/manager_dev_webhook/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is a kustomize Component which deploys KIC's admission webhook configuration
# with a static certificate and key for ease of use.
# This is not meant to be used in production!
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- ./validating_webhook_configuration.yaml
- ./manager_webhook_secret.yaml

patches:
- path: manager_webhook_listen_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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_ADMISSION_WEBHOOK_LISTEN
value: :8080
volumeMounts:
- mountPath: /admission-webhook
name: validation-webhook
volumes:
- name: validation-webhook
secret:
secretName: kong-validation-webhook
10 changes: 10 additions & 0 deletions config/components/manager_dev_webhook/manager_webhook_secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file contains static certificate and key for KIC's admission webhook.
# This is provided for ease of use and is not meant to be used in production.
apiVersion: v1
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURWRENDQWp5Z0F3SUJBZ0lVTUw1UEVFakNkdkg1VjdrQjRueXIySVNISVFRd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0t6RXBNQ2NHQTFVRUF3d2dhMjl1WnkxMllXeHBaR0YwYVc5dUxYZGxZbWh2YjJzdWEyOXVaeTV6ZG1NdwpIaGNOTWpNeE1URTFNVEl5TXpNeldoY05NalF4TVRFME1USXlNek16V2pBck1Ta3dKd1lEVlFRRERDQnJiMjVuCkxYWmhiR2xrWVhScGIyNH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9lUlI1YW5UCmhZS1htM3dxRTlKdVQ4K2lteTUybjhnYUlkY1VwbWVjOXpLdkx0WDZsbnBoUThTU1NNMTNrTnBGOEJhcXR2SkcKSS92WWhOZ2RYOU5zN0RYamFOT0xMREoraStDN1YvTjNoL0tCcjFMN0FvR0FEbzBMVC9XRWhZTnRuWnQrdkFlNwo3SEw0Y3ZrTXlBR3pPdEtSQmNna2kxQTNYWHpBUndUWkNxR2lXeDNTMXRqdURURmxHUzRONDJjdDN1VVRmRVpSCjZCZ2MzU1RqVGMvalNFbzFuZis0SnhlanJFWHFHV1dyOWJEY3pmUFcxS1lwdDF3UktHcXh3MUdUazBqL0FxZTUKMjltbFMzYlJ6T0c1NlBPZThCSWYrMjA9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
kind: Secret
metadata:
name: kong-validation-webhook
type: kubernetes.io/tls
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: kong-controller-validations
webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
service:
name: kong-controller-validation-webhook
namespace: kong
port: 443
failurePolicy: Ignore
matchPolicy: Equivalent
name: validations.kong.konghq.com
rules:
- apiGroups:
- configuration.konghq.com
apiVersions:
- '*'
operations:
- CREATE
- UPDATE
resources:
- kongconsumers
- kongplugins
- kongclusterplugins
- kongingresses
scope: '*'
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- secrets
- services
scope: '*'
- apiGroups:
- networking.k8s.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- ingresses
scope: '*'
- apiGroups:
- gateway.networking.k8s.io
apiVersions:
- v1alpha2
- v1beta1
- v1
operations:
- CREATE
- UPDATE
resources:
- gateways
- httproutes
scope: '*'
sideEffects: None
timeoutSeconds: 10
3 changes: 3 additions & 0 deletions config/variants/multi-gw-postgres/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ namespace: kong
resources:
- ../base/

components:
- ../../../components/manager_dev_webhook

patches:
- patch: |-
apiVersion: apps/v1
Expand Down
7 changes: 5 additions & 2 deletions config/variants/multi-gw/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ namespace: kong
resources:
- ../base/

patchesStrategicMerge:
- manager.yaml
components:
- ../../../components/manager_dev_webhook

patches:
- path: manager.yaml

0 comments on commit e8b1b31

Please sign in to comment.