Skip to content

Commit

Permalink
Restart (matching stage/production) fleetshard-operator every 30 min
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <medgar@redhat.com>
  • Loading branch information
MikeEdgar committed Aug 19, 2021
1 parent f7080ca commit cbc6af7
Showing 1 changed file with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: kas-fleetshard-operator
app.kubernetes.io/name: kas-fleetshard-operator
name: fleetshard-operator-restarter
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: kas-fleetshard-operator
app.kubernetes.io/name: kas-fleetshard-operator
name: fleetshard-operator-restarter
rules:
- apiGroups:
- apps
- extensions
resources:
- deployments
verbs:
- get
- apiGroups:
- apps
- extensions
resources:
- deployments/scale
verbs:
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: kas-fleetshard-operator
app.kubernetes.io/name: kas-fleetshard-operator
name: fleetshard-operator-restarter
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: fleetshard-operator-restarter
subjects:
- kind: ServiceAccount
name: fleetshard-operator-restarter
---
kind: ConfigMap
apiVersion: v1
metadata:
name: fleetshard-operator-restarter
labels:
app: kas-fleetshard-operator
app.kubernetes.io/name: kas-fleetshard-operator
data:
restart.sh: |
echo "Scaling down deployments"
oc scale deployment kas-fleetshard-operator --replicas=0
echo "Scaling up deployments"
oc scale deployment kas-fleetshard-operator --replicas=1
---
kind: CronJob
apiVersion: batch/v1beta1
metadata:
name: fleetshard-operator-restarter
labels:
app: kas-fleetshard-operator
app.kubernetes.io/name: kas-fleetshard-operator
spec:
schedule: '*/30 * * * *'
concurrencyPolicy: Forbid
suspend: false
jobTemplate:
metadata:
creationTimestamp: null
spec:
activeDeadlineSeconds: 600
backoffLimit: 2
template:
metadata:
creationTimestamp: null
spec:
restartPolicy: Never
serviceAccountName: fleetshard-operator-restarter
serviceAccount: fleetshard-operator-restarter
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
securityContext: {}
containers:
- resources: {}
terminationMessagePath: /dev/termination-log
name: oc
command:
- /bin/sh
imagePullPolicy: Always
volumeMounts:
- name: fleetshard-operator-restarter
mountPath: /fleetshard-operator-restarter
terminationMessagePolicy: File
image: quay.io/openshift/origin-cli
args:
- '-c'
- /fleetshard-operator-restarter/restart.sh
volumes:
- name: fleetshard-operator-restarter
configMap:
name: fleetshard-operator-restarter
defaultMode: 511
dnsPolicy: ClusterFirst
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1

0 comments on commit cbc6af7

Please sign in to comment.