Skip to content

Instantly share code, notes, and snippets.

@ArnaudRinquin
Created December 29, 2016 11:27
Show Gist options
  • Save ArnaudRinquin/c3656375a0c1504203eb8f9398d9b4c1 to your computer and use it in GitHub Desktop.
Save ArnaudRinquin/c3656375a0c1504203eb8f9398d9b4c1 to your computer and use it in GitHub Desktop.
MongoDB chart
apiVersion: v1
kind: Service
metadata:
name: {{ template "mongo-arbiter-name" . }}
labels:
name: {{ template "mongo-arbiter-name" . }}
spec:
ports:
- port: 27017
selector:
name: {{ template "mongo-arbiter-name" . }}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ template "mongo-arbiter-name" . }}
labels:
name: {{ template "mongo-arbiter-name" . }}
spec:
containers:
- name: {{ template "mongo-arbiter-name" . }}
image: bitnami/mongodb:3.4.1-r1
env:
-
name: MONGODB_REPLICA_SET_MODE
value: arbiter
-
name: MONGODB_REPLICA_SET_NAME
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetName
-
name: MONGODB_REPLICA_SET_KEY
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetKey
-
name: MONGODB_PRIMARY_HOST
value: {{ template "mongo-primary-name" . }}
-
name: MONGODB_PRIMARY_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.rootPassword
-
name: MONGODB_DATABASE
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.database
-
name: MONGODB_USERNAME
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.user
-
name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.password
ports:
- containerPort: 27017
volumeMounts:
- mountPath: /bitnami/mongodb
name: mongodb-data-volume
volumes:
- name: mongodb-data-volume
persistentVolumeClaim:
claimName: {{ template "mongo-arbiter-name" . }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "mongo-arbiter-name" . }}
annotations:
volume.alpha.kubernetes.io/storage-class: {{ .Values.mongodb.persistence.storageClass | quote }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{.Values.mongodb.persistence.size}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "mongo-primary-name" . }}
labels:
name: {{ template "mongo-primary-name" . }}
spec:
ports:
- port: 27017
selector:
name: {{ template "mongo-primary-name" . }}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ template "mongo-primary-name" . }}
labels:
name: {{ template "mongo-primary-name" . }}
spec:
containers:
- name: {{ template "mongo-primary-name" . }}
image: bitnami/mongodb:3.4.1-r1
env:
-
name: MONGODB_REPLICA_SET_MODE
value: primary
-
name: MONGODB_DATABASE
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.database
-
name: MONGODB_REPLICA_SET_NAME
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetName
-
name: MONGODB_REPLICA_SET_KEY
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetKey
-
name: MONGODB_USERNAME
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.user
-
name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.password
-
name: MONGODB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.rootPassword
ports:
- containerPort: 27017
volumeMounts:
- mountPath: /bitnami/mongodb
name: mongodb-data-volume
volumes:
- name: mongodb-data-volume
persistentVolumeClaim:
claimName: {{ template "mongo-primary-name" . }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "mongo-primary-name" . }}
annotations:
volume.alpha.kubernetes.io/storage-class: {{ .Values.mongodb.persistence.storageClass | quote }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{.Values.mongodb.persistence.size}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "mongo-secondary-name" . }}
labels:
name: {{ template "mongo-secondary-name" . }}
spec:
ports:
- port: 27017
selector:
name: {{ template "mongo-secondary-name" . }}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ template "mongo-secondary-name" . }}
labels:
name: {{ template "mongo-secondary-name" . }}
spec:
containers:
- name: {{ template "mongo-secondary-name" . }}
image: bitnami/mongodb:3.4.1-r1
env:
-
name: MONGODB_REPLICA_SET_MODE
value: secondary
-
name: MONGODB_REPLICA_SET_NAME
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetName
-
name: MONGODB_REPLICA_SET_KEY
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.replicasetKey
-
name: MONGODB_PRIMARY_HOST
value: {{ template "mongo-primary-name" . }}
-
name: MONGODB_PRIMARY_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.rootPassword
-
name: MONGODB_DATABASE
valueFrom:
configMapKeyRef:
name: collab-config
key: app.mongo.database
-
name: MONGODB_USERNAME
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.user
-
name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: collab-secret
key: app.mongo.password
ports:
- containerPort: 27017
volumeMounts:
- mountPath: /bitnami/mongodb
name: mongodb-data-volume
volumes:
- name: mongodb-data-volume
persistentVolumeClaim:
claimName: {{ template "mongo-secondary-name" . }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "mongo-secondary-name" . }}
annotations:
volume.alpha.kubernetes.io/storage-class: {{ .Values.mongodb.persistence.storageClass | quote }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{.Values.mongodb.persistence.size}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment