Files
Homelabv4/infrastructure/kyverno/policies/require-resource-limits.yaml
T
Scooby HuskyandClaude Opus 4.6 131cbca4a6 Fix ArgoCD ServerSideDiff permanent OutOfSync diffs
Add explicit CRD/API defaults to manifests that were causing ArgoCD's
SSA dry-run to produce results different from live state:

- HTTPRoutes: add group, kind, weight defaults to parentRefs/backendRefs
- Kyverno ClusterPolicies: add skipBackgroundRequests, allowExistingViolations
- Tetragon TracingPolicies: add return, maxData, resolve, returnCopy defaults
- Gateway certificateRefs: add group="" default
- Guacamole Gateway: add group="" to certificateRefs

Add ignoreDifferences for resources that legitimately differ:
- Cilium cert Secrets (auto-generated, data always differs)
- Istio ValidatingWebhookConfiguration failurePolicy (istiod mutates)
- Crowdsec LAPI Secrets (randomly generated)
- ServiceMonitor/PodMonitor relabeling action defaults
- StatefulSet volumeClaimTemplates apiVersion/kind defaults

Persist argocd-cm ignoreDifferences config in ArgoCD Helm values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:32:59 -05:00

66 lines
1.7 KiB
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-resource-limits
annotations:
policies.kyverno.io/title: Require Resource Limits
policies.kyverno.io/category: Zero Trust
policies.kyverno.io/severity: medium
spec:
validationFailureAction: Audit
background: true
rules:
- name: require-limits
skipBackgroundRequests: true
match:
any:
- resources:
kinds:
- Pod
exclude:
any:
- resources:
namespaces:
- kube-system
- kube-node-lease
- kyverno
- argocd
- authentik
- cert-manager
- cnpg-system
- envoy-gateway-system
- external-secrets
- istio-system
- kiali-operator
- mariadb-system
- prometheus
- redis-operator
- reloader
- rook-ceph
- scylla-operator
- vault
- gitlab
- netbird
- grafana
- crowdsec
- external-dns
- nextcloud
- mqtt
- home-assistant
- guacamole
- teslamate
- unpoller
- frigate
- checkov
- scylla-manager
validate:
allowExistingViolations: true
message: "All containers must have CPU and memory limits defined."
pattern:
spec:
containers:
- resources:
limits:
cpu: "?*"
memory: "?*"