Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mongodb Operator #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions repository/mongodb/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# MongoDB

MongoDB is a free and open-source cross-platform document-oriented database program.

This Operator deploy a MongoDB Community Edition, see [MongoDB](https://hub.docker.com/_/mongo/), with standalone mode.

## Prerequisites

You need a Kubernetes cluster up and running and Persistent Storage available with a default `Storage Class` defined.

## Getting Started

Deploy the `Operator` using the following command:

`kubectl kudo install mongodb`

It deploys a MongoDB StatefulSet composed of 1 instances.
26 changes: 26 additions & 0 deletions repository/mongodb/operator/operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: kudo.dev/v1beta1
name: mongodb
version: 0.0.2
kubernetesVersion: 1.13.0
appVersion: 3.6.15
url: https://www.mongodb.com
maintainers:
- name: xiao wei
email: [email protected]
tasks:
- name: deploy
kind: Apply
spec:
resources:
- service.yaml
- statefulset.yaml
plans:
deploy:
strategy: serial
phases:
- name: deploy
strategy: serial
steps:
- name: deploy
tasks:
- deploy
10 changes: 10 additions & 0 deletions repository/mongodb/operator/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kudo.dev/v1beta1
parameters:
- name: InitRootUser
description: "Super User name of init user which created in the admin authentication database, which is a 'superuser' role"
default: "root"
displayName: "Mongo Init Root Username"
- name: InitRootPasswrd
description: "password"
default: "secret"
displayName: "Mongo Init Root Password"
12 changes: 12 additions & 0 deletions repository/mongodb/operator/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Name }}-svc
spec:
type: ClusterIP
clusterIp: None
ports:
- port: 27017
name: mongodb
selector:
app: mongo
42 changes: 42 additions & 0 deletions repository/mongodb/operator/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Name }}
namespace: {{ .Namespace }}
labels:
app: mongo
mongo: {{ .OperatorName }}
spec:
serviceName: {{ .Name }}-svc
selector:
matchLabels:
app: mongo
mongo: {{ .OperatorName }}
template:
metadata:
labels:
app: mongo
mongo: {{ .OperatorName }}
spec:
containers:
- name: mongo
image: mongo:{{ .AppVersion }}
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: {{ .Params.InitRootUser }}
- name: MONGO_INITDB_ROOT_PASSWORD
value: {{ .Params.InitRootPasswrd }}
ports:
- containerPort: 80
name: mongo
volumeMounts:
- name: dbdata
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: dbdata
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi