cozystack/packages/system/lineage-controller-webhook/templates/mutatingwebhookconfiguration.yaml
Timofei Larkin 2a82273902 [lineage] Separate webhook from cozy controller
The lineage-controller-webhook makes a lot of outgoing API calls for
every event it handles, contributing to a high API server latency,
increasing the number of in-flight requests and generally degrading
performance. This patch remedies this by separating the lineage
component from the cozystack-controller and deploying it as a separate
component on all control-plane nodes. Additionally, a new internal label
is introduced to track if a resource has already been handled by the
webhook. This label is used to exclude such resources from
consideration. Addresses #1513.

```release-note
[lineage] Break webhook out into a separate daemonset. Reduce
unnecessary webhook calls by marking handled resources and excluding
them from consideration by the webhook's object selector.
```

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-10-14 10:50:28 +03:00

46 lines
1.4 KiB
YAML

apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: lineage
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/lineage-controller-webhook
labels:
app: cozystack-controller
webhooks:
- name: lineage.cozystack.io
admissionReviewVersions: ["v1"]
sideEffects: None
clientConfig:
service:
name: lineage-controller-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-lineage
rules:
- operations: ["CREATE", "UPDATE"]
apiGroups: [""]
apiVersions: ["v1"]
resources: ["pods","secrets", "services", "persistentvolumeclaims"]
- operations: ["CREATE", "UPDATE"]
apiGroups: ["networking.k8s.io"]
apiVersions: ["v1"]
resources: ["ingresses"]
- operations: ["CREATE", "UPDATE"]
apiGroups: ["cozystack.io"]
apiVersions: ["v1alpha1"]
resources: ["workloadmonitors"]
failurePolicy: Fail
namespaceSelector:
matchExpressions:
- key: cozystack.io/system
operator: NotIn
values:
- "true"
- key: kubernetes.io/metadata.name
operator: NotIn
values:
- kube-system
- default
objectSelector:
matchExpressions:
- key: internal.cozystack.io/managed-by-cozystack
operator: DoesNotExist