This repository has been archived on 2025-01-11. You can view files and clone it, but cannot push or open issues or pull requests.
theshire/.archive/kyverno/kyverno/policies/volsync-movers.yaml
2024-11-22 21:45:40 -06:00

76 lines
2.4 KiB
YAML

---
# yaml-language-server: $schema=https://ks.hsn.dev/kyverno.io/clusterpolicy_v1.json
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: volsync-movers
annotations:
policies.kyverno.io/title: Set custom config on the Volsync mover Jobs
policies.kyverno.io/description: |
This policy sets custom configuration on the Volsync mover Jobs.
policies.kyverno.io/subject: Pod
spec:
rules:
- name: mutate-volsync-src-movers
match:
any:
- resources:
kinds: ["batch/v1/Job"]
names: ["volsync-src-*"]
namespaces: ["*"]
selector:
matchLabels:
app.kubernetes.io/created-by: volsync
mutate:
patchStrategicMerge:
spec:
podReplacementPolicy: Failed
podFailurePolicy:
rules:
- action: FailJob
onExitCodes:
containerName: restic
operator: In
values: [11]
template:
spec:
initContainers:
- name: jitter
image: docker.io/library/busybox:latest
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'sleep $(shuf -i 0-60 -n 1)']
containers:
- name: restic
volumeMounts:
- name: repository
mountPath: /repository
volumes:
- name: repository
nfs:
server: shadowfax.jahanson.tech
path: /nahar/volsync
- name: mutate-volsync-dst-movers
match:
any:
- resources:
kinds: ["batch/v1/Job"]
names: ["volsync-dst-*"]
namespaces: ["*"]
selector:
matchLabels:
app.kubernetes.io/created-by: volsync
mutate:
patchStrategicMerge:
spec:
template:
spec:
containers:
- name: restic
volumeMounts:
- name: repository
mountPath: /repository
volumes:
- name: repository
nfs:
server: shadowfax.jahanson.tech
path: /nahar/volsync