Skip to content

Commit

Permalink
Add cronjob to restart deployment in paddock
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Hild <[email protected]>
  • Loading branch information
durandom committed Apr 13, 2024
1 parent b2ab912 commit d7f9877
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
53 changes: 53 additions & 0 deletions manifests/base/paddock/cronjobs/cronjob_restart_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: restart-deployment
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: restart-deployment
rules:
- apiGroups: ["apps", "extensions"]
resources: ["deployments"]
resourceNames: ["paddock"]
verbs: ["get", "patch", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: restart-deployment
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: restart-deployment
subjects:
- kind: ServiceAccount
name: restart-deployment
namespace: b4mad-racing
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: restart-paddock-deployment
spec:
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 2
concurrencyPolicy: Forbid
schedule: '0 2 * * *'
jobTemplate:
spec:
backoffLimit: 2
activeDeadlineSeconds: 600
template:
spec:
serviceAccountName: restart-deployment
restartPolicy: Never
containers:
- name: kubectl
image: bitnami/kubectl
command:
- 'kubectl'
- 'rollout'
- 'restart'
- 'deployment/paddock'
1 change: 1 addition & 0 deletions manifests/base/paddock/cronjobs/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cronjob_analyze.yaml
- cronjob_restart_deployment.yaml
2 changes: 1 addition & 1 deletion manifests/env/phobos/influxdb/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ patches:
- patch: |-
- op: replace
path: /spec/resources/requests/storage
value: "128Gi"
value: "512Gi"
target:
kind: PersistentVolumeClaim
name: influxdb2
Expand Down

0 comments on commit d7f9877

Please sign in to comment.