Last active
April 15, 2024 20:39
-
-
Save magickatt/e2778142d832e39f07ed18c13f4e46b5 to your computer and use it in GitHub Desktop.
Revisions
-
magickatt revised this gist
Apr 15, 2024 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ apiVersion: batch/v1 kind: CronJob metadata: name: "restart-{{ $application.name }}" namespace: "{{ $.Release.Namespace }}" spec: concurrencyPolicy: Forbid @@ -20,10 +20,10 @@ spec: command: - 'kubectl' - '--namespace' - '{{ $application.namespace }}' - 'rollout' - 'restart' - 'deployment/{{ $application.name }}' --- kind: ServiceAccount apiVersion: v1 @@ -44,7 +44,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: pod-restarter namespace: {{ $application.namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole -
magickatt created this gist
Apr 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ apiVersion: batch/v1 kind: CronJob metadata: name: "restart-{{ $service.name }}" namespace: "{{ $.Release.Namespace }}" spec: concurrencyPolicy: Forbid schedule: "* * * * *" # crontab.guru jobTemplate: spec: backoffLimit: 3 activeDeadlineSeconds: 600 template: spec: serviceAccountName: pod-restarter restartPolicy: Never containers: - name: kubectl image: bitnami/kubectl:1.28 # bitnami.com/stack/kubectl/containers command: - 'kubectl' - '--namespace' - '{{ $job.namespace }}' - 'rollout' - 'restart' - 'deployment/{{ $service.name }}' --- kind: ServiceAccount apiVersion: v1 metadata: name: pod-restarter namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: pod-restarter rules: - apiGroups: ["apps", "extensions"] resources: ["deployments"] verbs: ["get", "patch", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: pod-restarter namespace: {{ $service.namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: pod-restarter subjects: - kind: ServiceAccount name: pod-restarter namespace: {{ $.Release.Namespace }}