Cluster information:
Kubernetes version:
k3d version v5.3.0
k3s version v1.22.6-k3s1 (default)
Kubernetes version 1.22.6
Cloud being used: (put bare-metal if not on a public cloud) - No (Local Installation)
Host OS: Linux
I am trying to use mutating webhook for custom resources like Istio’s VirtualService.
But my webhook is not getting triggered. i ended up putting * everywhere in webhook yaml to debug but it does not seems to work, So, i am wondering if webhooks are supported for custom resources. ???
Webhook -
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: "mutatingwebhook.mutatingwebhook.svc"
annotations:
cert-manager.io/inject-ca-from: mutatingwebhook/selfsigned-crt
webhooks:
- name: "mutatingwebhook.mutatingwebhook.svc"
namespaceSelector:
matchLabels:
webhook: enabled
rules:
- apiGroups: ["*"]
apiVersions: ["*"]
operations: ["*"]
resources: ["services", "virtualservices"]
clientConfig:
service:
namespace: "mutatingwebhook"
name: "mutatingwebhook"
path: "/api/test-webhook"
admissionReviewVersions: ["v1", "v1beta1"]
Virtual Service -
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: bookinfo-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bookinfo
annotations:
test.controller/group: test2
spec:
hosts:
- "*"
gateways:
- bookinfo-gateway
http:
- match:
- uri:
exact: /productpage
- uri:
prefix: /static
- uri:
exact: /login
- uri:
exact: /logout
- uri:
prefix: /api/v1/products
route:
- destination:
host: productpage
port:
number: 9080