2020-09-01 15:44:43 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
rules:
|
|
|
|
- apiGroups: ["apps", "extensions"]
|
|
|
|
resources: ["deployments"]
|
|
|
|
# verbs: ["get", "patch", "list", "watch"]
|
|
|
|
verbs: ["get", "list", "patch"]
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
2020-12-08 07:54:12 +00:00
|
|
|
name: kubectl-rolloutrestart-default
|
2020-09-01 15:44:43 +00:00
|
|
|
namespace: default
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
---
|
2020-12-08 07:54:12 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: kubectl-rolloutrestart-unifi
|
|
|
|
namespace: unifi
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: kubectl-rolloutrestart-pvr
|
|
|
|
namespace: pvr
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
---
|
2020-09-01 15:44:43 +00:00
|
|
|
apiVersion: batch/v1beta1
|
|
|
|
kind: CronJob
|
|
|
|
metadata:
|
|
|
|
name: kubectl-rolloutrestart
|
|
|
|
namespace: default
|
|
|
|
spec:
|
|
|
|
concurrencyPolicy: Forbid
|
|
|
|
failedJobsHistoryLimit: 1
|
|
|
|
successfulJobsHistoryLimit: 1
|
|
|
|
schedule: '30 2 * * *'
|
|
|
|
jobTemplate:
|
|
|
|
spec:
|
|
|
|
backoffLimit: 2
|
|
|
|
activeDeadlineSeconds: 600
|
|
|
|
template:
|
|
|
|
spec:
|
|
|
|
serviceAccountName: kubectl-rolloutrestart
|
|
|
|
restartPolicy: Never
|
|
|
|
containers:
|
|
|
|
- name: kubectl
|
2020-12-04 08:41:15 +00:00
|
|
|
image: bv11-cr01.bessems.eu/proxy/bitnami/kubectl
|
2020-09-01 15:44:43 +00:00
|
|
|
command:
|
2020-12-08 07:54:12 +00:00
|
|
|
- '/bin/bash'
|
2020-09-01 15:44:43 +00:00
|
|
|
- '-c'
|
2020-12-08 07:54:12 +00:00
|
|
|
args:
|
|
|
|
- for deploy in `kubectl get deployments -n default | cut -d " " -f 1`; do kubectl rollout restart deployment -n default $deploy; done;
|
|
|
|
for deploy in `kubectl get deployments -n unifi | cut -d " " -f 1`; do kubectl rollout restart deployment -n unifi $deploy; done;
|
|
|
|
for deploy in `kubectl get deployments -n pvr | cut -d " " -f 1`; do kubectl rollout restart deployment -n pvr $deploy; done;
|