Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit

Permalink
BC-7240 - statefull set for Mongo
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Jun 26, 2024
1 parent 38632b4 commit 0833f37
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions ansible/playbock-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
roles:
- sys
- pre_deployment
- mongo-repset
- doido-mongo
- post_deployment
5 changes: 5 additions & 0 deletions ansible/roles/mongo-repset/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Add or Update statefulSet
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: statefulset.yml.j2
67 changes: 67 additions & 0 deletions ansible/roles/mongo-repset/templates/statefulset.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb
spec:
selector:
matchLabels:
app: mongo
replicas: 3
template:
metadata:
labels:
app: mongo
app.kubernetes.io/part-of: schulcloud-verbund
app.kubernetes.io/version: "{{ POSTGRES_IMAGE_TAG }}"
app.kubernetes.io/name: mongo
app.kubernetes.io/component: operator
app.kubernetes.io/managed-by: ansible
git.repo: {{ DOIDO_MONGO_REPO_NAME }}
spec:
containers:
- name: mongo
image: {{ MONGO_IMAGE_NAME }}:{{ MONGO_IMAGE_TAG }}
imagePullPolicy: IfNotPresent
args: ["--replSet", "rs0", "--oplogSize", "10"]
ports:
- containerPort: 27017
name: mongo
protocol: TCP
volumeMounts:
- name: mongo
mountPath: /data/db
resources:
limits:
cpu: {{ MONGO_CPU_LIMITS|default("2000m", true) }}
memory: {{ MONGO_MEMORY_LIMITS|default("2Gi", true) }}
requests:
cpu: {{ MONGO_CPU_REQUESTS|default("100m", true) }}
memory: {{ MONGO_MEMORY_REQUESTS|default("512Mi", true) }}
- name: mongo-exporter
image: {{ MONGO_EXPORTER_IMAGE_NAME }}:{{ MONGO_EXPORTER_IMAGE_TAG }}
imagePullPolicy: IfNotPresent
args: ["--compatible-mode", "--collect-all" ]
envFrom:
- secretRef:
name: mongo-secret
ports:
- containerPort: 9216
name: mongo-exporter
protocol: TCP
resources:
limits:
cpu: {{ MONGO_EXPORTER_CPU_LIMITS|default("2000m", true) }}
memory: {{ MONGO_EXPORTER_MEMORY_LIMITS|default("1Gi", true) }}
requests:
cpu: {{ MONGO_EXPORTER_CPU_REQUESTS|default("100m", true) }}
memory: {{ MONGO_EXPORTER_MEMORY_REQUESTS|default("64Mi", true) }}
volumeClaimTemplates:
- metadata:
name: mongo
labels:
app: mongo
spec:
storageClassName: {{ SC_DEFAULT_STORAGE_CLASS_NAME }}
resources:
requests:
storage: 10Gi

0 comments on commit 0833f37

Please sign in to comment.