-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KFLUXINFRA-1269: Adding Configuration to etcd defrag periodically
This Pull Request will create following resources - - Namespace - ClusterRole - ClusterRoleBinding - ServiceAccount - CronJob that will run every 5 minutes Signed-off-by: Manish Kumar <30774250+manish-jangra@users.noreply.github.com>
- Loading branch information
1 parent
c502da0
commit c0d839e
Showing
14 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
argo-cd-apps/base/member/infra-deployments/etcd-defrag/etcd-defrag.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,40 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ApplicationSet | ||
metadata: | ||
name: etcd-defrag | ||
spec: | ||
generators: | ||
- merge: | ||
mergeKeys: | ||
- nameNormalized | ||
generators: | ||
- clusters: | ||
values: | ||
sourceRoot: configs/etcd-defrag | ||
environment: staging | ||
- list: | ||
elements: [] | ||
template: | ||
metadata: | ||
name: etcd-defrag-{{nameNormalized}} | ||
spec: | ||
project: default | ||
source: | ||
path: '{{values.sourceRoot}}/{{values.environment}}' | ||
repoURL: https://github.com/redhat-appstudio/infra-deployments.git | ||
targetRevision: main | ||
destination: | ||
namespace: default | ||
server: '{{server}}' | ||
syncPolicy: | ||
automated: | ||
prune: true | ||
selfHeal: true | ||
syncOptions: | ||
- CreateNamespace=true | ||
retry: | ||
limit: -1 | ||
backoff: | ||
duration: 10s | ||
factor: 2 | ||
maxDuration: 3m |
6 changes: 6 additions & 0 deletions
6
argo-cd-apps/base/member/infra-deployments/etcd-defrag/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 | ||
resources: | ||
- etcd-defrag.yaml | ||
components: | ||
- ../../../../k-components/deploy-to-member-cluster-merge-generator |
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
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
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
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
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,28 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: etcd-maintenance-role | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
verbs: | ||
- list | ||
- get | ||
- create | ||
- delete | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods/attach | ||
verbs: | ||
- create | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods/log | ||
verbs: | ||
- get |
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,24 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: etcd-maintenance | ||
namespace: etcd-maintenance | ||
spec: | ||
schedule: "*/15 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: etcd-maintenance | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: etcd-maintenance | ||
image: registry.redhat.io/openshift4/ose-cli | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
etcd_pod=$(oc get pod -l app=etcd -oname -n openshift-etcd | awk -F"/" 'NR==1{ print $2 }') | ||
oc -n openshift-etcd debug pod/${etcd_pod} --image=quay.io/konflux-ci/etcd-defrag:dc8f64b3e0268d3d85132be0c66495d718362157 --one-container=true -- /bin/sh -c "chmod +x /opt/defrag.sh && /opt/defrag.sh" |
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,9 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: etcd-maintenance | ||
resources: | ||
- namespace.yaml | ||
- cluster-role.yaml | ||
- role-binding.yaml | ||
- serviceaccount.yaml | ||
- cronjob.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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: etcd-maintenance |
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,14 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: etcd-maintenance-binding | ||
namespace: etcd-maintenance | ||
subjects: | ||
- kind: ServiceAccount | ||
name: etcd-maintenance | ||
namespace: etcd-maintenance | ||
roleRef: | ||
kind: ClusterRole | ||
name: etcd-maintenance-role | ||
apiGroup: rbac.authorization.k8s.io |
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: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: etcd-maintenance | ||
namespace: etcd-maintenance |
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,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../base |
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,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../base |