54 lines
1 KiB
YAML
54 lines
1 KiB
YAML
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: shlink
|
|
spec:
|
|
schedule: "0 0 * * *"
|
|
jobTemplate:
|
|
spec:
|
|
template:
|
|
spec:
|
|
serviceAccountName: shlink-cron
|
|
containers:
|
|
- name: kubectl
|
|
image: bitnami/kubectl:latest
|
|
args:
|
|
- -n
|
|
- shlink
|
|
- exec
|
|
- shlink-0
|
|
- --
|
|
- bin/cli
|
|
- short-url:delete-expired
|
|
- -n
|
|
restartPolicy: OnFailure
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: shlink-cron
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: shlink-exec
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["get"]
|
|
|
|
- apiGroups: [""]
|
|
resources: ["pods/exec"]
|
|
verbs: ["create"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: shlink-exec
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: shlink-cron
|
|
roleRef:
|
|
kind: Role
|
|
name: shlink-exec
|
|
apiGroup: rbac.authorization.k8s.io
|