update
Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
parent
bfe8435665
commit
8d74a625bc
37 changed files with 224 additions and 103 deletions
10
platform/kyverno/policies/cleanup-rbac.yaml
Normal file
10
platform/kyverno/policies/cleanup-rbac.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: kyverno:cleanup-pods
|
||||
labels:
|
||||
rbac.kyverno.io/aggregate-to-cleanup-controller: "true"
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs: ["get", "list", "watch", "delete"]
|
||||
6
platform/kyverno/policies/kustomization.yaml
Normal file
6
platform/kyverno/policies/kustomization.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- purge-terminal-pods.yaml
|
||||
- cleanup-rbac.yaml
|
||||
21
platform/kyverno/policies/purge-terminal-pods.yaml
Normal file
21
platform/kyverno/policies/purge-terminal-pods.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: kyverno.io/v2beta1
|
||||
kind: ClusterCleanupPolicy
|
||||
metadata:
|
||||
name: purge-terminal-pods
|
||||
spec:
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- Pod
|
||||
schedule: "*/15 * * * *"
|
||||
conditions:
|
||||
all:
|
||||
- key: "{{ request.object.status.phase }}"
|
||||
operator: AnyIn
|
||||
value:
|
||||
- Succeeded
|
||||
- Failed
|
||||
- key: "{{ request.object.metadata.creationTimestamp }}"
|
||||
operator: DurationGreaterThan
|
||||
value: 30m
|
||||
Loading…
Add table
Add a link
Reference in a new issue