Merge commit 'fe564d72279f4ab061b961dd528623f0ed272667' as 'cluster-config'
This commit is contained in:
25
cluster-config/components/defrag-etcd/base/cronjob.yaml
Normal file
25
cluster-config/components/defrag-etcd/base/cronjob.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: defrag-etcd
|
||||
spec:
|
||||
schedule: "0 11 * * *"
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: defrag-etcd
|
||||
image: registry.redhat.io/openshift4/ose-cli:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
oc get pods -l app=etcd -n openshift-etcd --no-headers -o custom-columns=":metadata.name" | while read -r pod ; do
|
||||
oc exec -n openshift-etcd $pod --container etcdctl -- sh -c "unset ETCDCTL_ENDPOINTS && etcdctl --command-timeout=30s --endpoints=https://localhost:2379 defrag"
|
||||
done
|
||||
serviceAccountName: defrag-etcd
|
||||
restartPolicy: OnFailure
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace: openshift-etcd
|
||||
|
||||
resources:
|
||||
- sa-rbac.yaml
|
||||
- cronjob.yaml
|
||||
36
cluster-config/components/defrag-etcd/base/sa-rbac.yaml
Normal file
36
cluster-config/components/defrag-etcd/base/sa-rbac.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: defrag-etcd
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: defrag-etcd
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- exec
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/exec
|
||||
verbs:
|
||||
- create
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: defrag-etcd
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: defrag-etcd
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: defrag-etcd
|
||||
Reference in New Issue
Block a user