Restart authelia on acl config update

This commit is contained in:
Dreaded_X 2025-03-01 06:29:41 +01:00
parent 4ae76d668e
commit 00a9f25d5c
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
4 changed files with 52 additions and 1 deletions

View File

@ -18,7 +18,8 @@ spec:
- resources:
kinds:
- Secret
name: authelia-acl
names:
- authelia-acl
namespaces:
- authelia
context:

View File

@ -3,3 +3,4 @@ kind: Kustomization
resources:
- ./kube-vip-network-adapter.yaml
- ./generate-authelia-acl.yaml
- ./restart-on-secret-change.yaml

View File

@ -0,0 +1,43 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: restart-deployment-on-secret-change
annotations:
policies.kyverno.io/title: Restart Deployment On Secret Change
policies.kyverno.io/category: Other
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Deployment
kyverno.io/kyverno-version: 1.7.0
policies.kyverno.io/minversion: 1.7.0
kyverno.io/kubernetes-version: "1.23"
spec:
mutateExistingOnPolicyUpdate: false
rules:
- name: update-secret
skipBackgroundRequests: false
match:
any:
- resources:
kinds:
- Secret
names:
- authelia-acl
namespaces:
- authelia
preconditions:
all:
- key: "{{request.operation || 'BACKGROUND'}}"
operator: Equals
value: UPDATE
mutate:
targets:
- apiVersion: apps/v1
kind: Deployment
name: authelia
namespace: authelia
patchStrategicMerge:
spec:
template:
metadata:
annotations:
config.huizinga.dev/triggerRestart: "{{request.object.metadata.resourceVersion}}"

View File

@ -28,6 +28,12 @@ backgroundController:
verbs:
- get
- update
- apiGroups:
- "apps"
resources:
- "deployments"
verbs:
- update
cleanupController:
replicas: 2
reportsController: