Skip to content

Commit

Permalink
feat: Add app Kyverno (#108)
Browse files Browse the repository at this point in the history
With Kyverno, we can apply policies to our cluster. With this change, we
introduce a policy that changes all deployments to show 3 replicas.
  • Loading branch information
nomaster authored Jun 20, 2024
1 parent 0bb9e7b commit 145f6f2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/kyverno/enforce-replica.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: "kyverno.io/v1"
kind: "ClusterPolicy"
metadata:
name: "enforce-replicas"
spec:
background: true
rules:
- name: "set-replicas"
match:
resources:
kinds:
- "Deployment"
mutate:
patchStrategicMerge:
spec:
replicas: 3

4 changes: 4 additions & 0 deletions apps/kyverno/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- enforce-replica.yaml
1 change: 1 addition & 0 deletions infra/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ resources:
- descheduler
- external-dns
- kured
- kyverno
- metallb
- rook-ceph
- secret-generator
20 changes: 20 additions & 0 deletions infra/kyverno/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: kyverno
spec:
interval: 1h
chart:
spec:
chart: kyverno
sourceRef:
kind: HelmRepository
name: kyverno
interval: 1h
values:
admissionController:
replicas: 3
backgroundController:
replicas: 3
reportsController:
replicas: 3
7 changes: 7 additions & 0 deletions infra/kyverno/helm-repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: kyverno
spec:
url: https://kyverno.github.io/kyverno/
interval: 1h
7 changes: 7 additions & 0 deletions infra/kyverno/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kyverno
resources:
- helm-release.yaml
- helm-repository.yaml
- namespace.yaml
4 changes: 4 additions & 0 deletions infra/kyverno/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kyverno

0 comments on commit 145f6f2

Please sign in to comment.