diff --git a/repository/mongodb/docs/README.md b/repository/mongodb/docs/README.md new file mode 100644 index 0000000..54316ce --- /dev/null +++ b/repository/mongodb/docs/README.md @@ -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. diff --git a/repository/mongodb/operator/operator.yaml b/repository/mongodb/operator/operator.yaml new file mode 100644 index 0000000..c355cbb --- /dev/null +++ b/repository/mongodb/operator/operator.yaml @@ -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: xiaow10@chinaunicom.cn +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 diff --git a/repository/mongodb/operator/params.yaml b/repository/mongodb/operator/params.yaml new file mode 100644 index 0000000..1ac69e8 --- /dev/null +++ b/repository/mongodb/operator/params.yaml @@ -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" diff --git a/repository/mongodb/operator/templates/service.yaml b/repository/mongodb/operator/templates/service.yaml new file mode 100644 index 0000000..63f39f6 --- /dev/null +++ b/repository/mongodb/operator/templates/service.yaml @@ -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 diff --git a/repository/mongodb/operator/templates/statefulset.yaml b/repository/mongodb/operator/templates/statefulset.yaml new file mode 100644 index 0000000..bb640c7 --- /dev/null +++ b/repository/mongodb/operator/templates/statefulset.yaml @@ -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