From 8355a6fa4488468f9ff5f9954aa06b54efa62c3a Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 7 Feb 2024 00:35:18 +0100 Subject: [PATCH] Rollout restart PVR namespace;Upgrade Argus --- services/Argus/deployment-argus.yml | 2 +- services/PVR/Plex/cronjob-RolloutRestart.yml | 57 ++++++++++++ .../RolloutRestart/cronjob-RolloutRestart.yml | 87 ------------------- 3 files changed, 58 insertions(+), 88 deletions(-) create mode 100644 services/PVR/Plex/cronjob-RolloutRestart.yml delete mode 100644 system/RolloutRestart/cronjob-RolloutRestart.yml diff --git a/services/Argus/deployment-argus.yml b/services/Argus/deployment-argus.yml index b7bc9b0..2681acf 100644 --- a/services/Argus/deployment-argus.yml +++ b/services/Argus/deployment-argus.yml @@ -18,7 +18,7 @@ spec: serviceAccountName: argus containers: - name: argus - image: releaseargus/argus:0.13.3 + image: releaseargus/argus:0.15.2 args: - -config.file=/app/config/config.yml ports: diff --git a/services/PVR/Plex/cronjob-RolloutRestart.yml b/services/PVR/Plex/cronjob-RolloutRestart.yml new file mode 100644 index 0000000..d21be52 --- /dev/null +++ b/services/PVR/Plex/cronjob-RolloutRestart.yml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kubectl-rolloutrestart + namespace: pvr +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kubectl-rolloutrestart + namespace: pvr +rules: + - apiGroups: ["apps", "extensions"] + resources: ["deployments", "statefulsets"] + verbs: ["get", "list", "patch"] +--- +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: pvr +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: kubectl-rolloutrestart + namespace: pvr +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 + image: bitnami/kubectl + command: + - '/bin/bash' + - '-c' + args: + - for workload in `kubectl get deployments -n pvr --no-headers | cut -d " " -f 1`; do kubectl rollout restart deployment -n pvr $workload; done; + for workload in `kubectl get statefulsets -n pvr | cut -d " " -f 1`; do kubectl rollout restart statefulsets -n pvr $workload; done; diff --git a/system/RolloutRestart/cronjob-RolloutRestart.yml b/system/RolloutRestart/cronjob-RolloutRestart.yml deleted file mode 100644 index 9f3684d..0000000 --- a/system/RolloutRestart/cronjob-RolloutRestart.yml +++ /dev/null @@ -1,87 +0,0 @@ -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: - name: kubectl-rolloutrestart-default - namespace: default -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-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 ---- -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 - image: bv11-cr01.bessems.eu/proxy/bitnami/kubectl - command: - - '/bin/bash' - - '-c' - 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;