-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a cronjob to restart OLM pods (#2376)
- Loading branch information
1 parent
0f3db0b
commit e733ba7
Showing
7 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: olm-restart | ||
spec: | ||
schedule: "0 2 * * *" | ||
concurrencyPolicy: "Replace" | ||
startingDeadlineSeconds: 200 | ||
suspend: false | ||
successfulJobsHistoryLimit: 3 | ||
failedJobsHistoryLimit: 1 | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
provider: "codeready-toolchain" | ||
spec: | ||
serviceAccountName: sandbox-sre-olm-restart-sa | ||
containers: | ||
- name: olm-restart | ||
image: quay.io/codeready-toolchain/oc-client-base:latest | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- echo "Restarting OLM..." && | ||
oc delete pod --all -n openshift-operator-lifecycle-manager --ignore-not-found --wait && | ||
oc delete pod --all -n openshift-marketplace --ignore-not-found --wait && | ||
echo "Completed restart" | ||
restartPolicy: OnFailure |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- cronjob.yaml | ||
- sandbox-sre-olm-restart.yaml |
32 changes: 32 additions & 0 deletions
32
components/sandbox/base/olm-restart/sandbox-sre-olm-restart.yaml
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: sandbox-sre-olm-restart-sa | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: restart-pods | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- "pods" | ||
verbs: | ||
- "get" | ||
- "watch" | ||
- "list" | ||
- "delete" | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: olm-restart-global | ||
subjects: | ||
- kind: ServiceAccount | ||
name: sandbox-sre-olm-restart-sa | ||
roleRef: | ||
kind: ClusterRole | ||
name: restart-pods | ||
apiGroup: rbac.authorization.k8s.io |
6 changes: 6 additions & 0 deletions
6
components/sandbox/toolchain-host-operator/base/kustomization.yaml
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: toolchain-host-operator | ||
resources: | ||
- ../../base | ||
- ../../base/olm-restart |
2 changes: 1 addition & 1 deletion
2
components/sandbox/toolchain-host-operator/production/kustomization.yaml
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../base | ||
- ../base |
2 changes: 1 addition & 1 deletion
2
components/sandbox/toolchain-host-operator/staging/kustomization.yaml
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../base | ||
- ../base |
2 changes: 2 additions & 0 deletions
2
components/sandbox/toolchain-member-operator/base/kustomization.yaml
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: toolchain-member-operator | ||
resources: | ||
- ../../base | ||
- ../../base/olm-restart | ||
- ./rbac/inspect-pods.yaml |