Added bot restart
This commit is contained in:
@@ -7,3 +7,4 @@ resources:
|
||||
- get-id-bot.yaml
|
||||
- external-secrets.yaml
|
||||
- desubot.yaml
|
||||
- restart-job.yaml
|
||||
|
||||
56
k8s/apps/tg-bots/restart-job.yaml
Normal file
56
k8s/apps/tg-bots/restart-job.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: tg-bots-restart-sa
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: tg-bots-restart-role
|
||||
rules:
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["get", "patch"]
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: tg-bots-restart-rb
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: tg-bots-restart-sa
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: tg-bots-restart-role
|
||||
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: tg-bots-daily-restart
|
||||
spec:
|
||||
schedule: "0 4 * * *" # every day at 04:00
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: tg-bots-restart-sa
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: kubectl
|
||||
image: bitnami/kubectl:latest
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
kubectl -n "$POD_NAMESPACE" rollout restart deployment/desubot
|
||||
kubectl -n "$POD_NAMESPACE" rollout restart deployment/get-id-bot
|
||||
Reference in New Issue
Block a user