Skip to content

Commit f3e188e

Browse files
author
Rodrigo Valin
committed
f95762f: update public repo contents
1 parent f95762f commit f3e188e

18 files changed

+333
-63
lines changed

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You can discuss this integration in our [Slack](https://community-slack.mongodb.
2929
The MongoDB Enterprise Operator is compatible with Kubernetes v1.11 and above. It has been tested against Openshift 3.11.
3030

3131
This Operator requires [Ops Manager](https://docs.opsmanager.mongodb.com/current/) or [Cloud Manager](https://cloud.mongodb.com/user#/cloud/login). In this document, when we refer to "Ops Manager", you may substitute "Cloud Manager". The functionality is the same.
32-
> If this is your first time trying the Operator, Cloud Manager is easier to get started
32+
> If this is your first time trying the Operator, Cloud Manager is easier to get started
3333
3434

3535
## Installation
@@ -39,20 +39,20 @@ This Operator requires [Ops Manager](https://docs.opsmanager.mongodb.com/current
3939
The Mongodb Enterprise Operator is installed, by default, into the `mongodb` Namespace, but this Namespace is not created automatically. To create this Namespace you should execute:
4040

4141
kubectl create namespace mongodb
42-
43-
If you plan on using any other Namespace, please make sure you update the yaml files' `metadata.namespace` attribute to
44-
point to your preferred Namespace. If using `helm` you need to override the `namespace` attribute with `--set namespace=<..>`
42+
43+
If you plan on using any other Namespace, please make sure you update the yaml files' `metadata.namespace` attribute to
44+
point to your preferred Namespace. If using `helm` you need to override the `namespace` attribute with `--set namespace=<..>`
4545
during helm installation
4646

4747
### Installation using yaml files
4848

4949
#### Create CustomResourceDefinitions
5050

51-
The `CustomResourceDefinition` (or `crd`) should be installed before installing the operator into your Kubernetes cluster. To do this, make sure you have logged into your Kubernetes cluster and that you can perform Cluster level operations:
51+
The `CustomResourceDefinition` (or `crds`) should be installed before installing the operator into your Kubernetes cluster. To do this, make sure you have logged into your Kubernetes cluster and that you can perform Cluster level operations:
5252

5353
kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/master/crds.yaml
5454

55-
This will create one new `crd` in your cluster, `MongoDB`. This new object will be the one used by the operator to perform the MongoDb operations needed to prepare each one of the three different types of MongoDB deployments. `Standalone`, `ReplicaSet` and `ShardedCluster`
55+
This will create a new `crd` in your cluster, `MongoDB`. This new object will be the one used by the operator to perform the MongoDb operations needed to prepare each one of the different MongoDb types of deployments.
5656

5757
#### Operator Installation
5858

@@ -68,13 +68,13 @@ Check the end of the page for instructions on how to remove the Operator.
6868

6969
### Installation using Helm Chart
7070

71-
If you have installed the Helm client locally then you can run (note that `helm install` is a less preferred way as makes upgrades more complicated.
71+
If you have installed the Helm client locally then you can run (note that `helm install` is a less preferred way as makes upgrades more complicated.
7272
`kubectl apply` is a much clearer way of installing/upgrading):
7373

74-
helm template helm_chart > operator.yaml
74+
helm template public/helm_chart > operator.yaml
7575
kubectl apply -f operator.yaml
7676

77-
You can customize installation by simple overriding of helm variables, for example use `--set operator.env="dev"` to run the Operator in development mode
77+
You can customize installation by simple overriding of helm variables, for example use `--set operator.env="dev"` to run the Operator in development mode
7878
(this will turn logging level to `Debug` and will make logging output as non-json)
7979

8080
Check the end of the page for instructions on how to remove the Operator.
@@ -110,9 +110,9 @@ data:
110110
orgId: 5b890e0feacf0b76ff3e7183 # this is an optional parameter
111111
baseUrl: https://my-ops-manager-or-cloud-manager-url
112112
```
113-
> Note, that if `orgId` is skipped then the new organization named `projectName` will be automatically created and new
113+
> Note, that if `orgId` is skipped then the new organization named `projectName` will be automatically created and new
114114
project will be added there.
115-
115+
116116
Apply this file to create the new `Project`:
117117

118118
kubectl apply -f my-project.yaml
@@ -127,16 +127,16 @@ $ kubectl -n mongodb create secret generic my-credentials --from-literal="user=s
127127

128128
### Creating a MongoDB Object ###
129129

130-
A MongoDB resource (short name `mdb`) in Kubernetes can have a type of Standalone, ReplicaSet or ShardedCluster. We are going to create a replica set to test that everything is working as expected. There is a MongoDBReplicaSet yaml file in `samples/minimal/replicaset.yaml`.
130+
A MongoDB object in Kubernetes is a MongoDB (short name `mdb`). We are going to create a replica set to test that everything is working as expected. There is a MongoDB replica set yaml file in `samples/minimal/replicaset.yaml`.
131131

132132
If you have a correctly created Project with the name `my-project` and Credentials stored in a secret called `my-credentials` then, after applying this file then everything should be running and a new Replica Set with 3 members should soon appear in Ops Manager UI.
133133

134134
kubectl apply -f samples/minimal/replicaset.yaml
135-
135+
136136
### Correct order of Operator/Namespace removal
137137

138138
It's important to keep correct order or removal operations. The simple rule is: **never remove Operator before mongodb resources**!
139-
The reason is that the Operator cleans state in Ops Manager on deletion of the MongoDB resource in Kubernetes.
139+
The reason is that the Operator cleans state in Ops Manager on deletion of the MongoDB resource in Kubernetes.
140140

141141
These are the correct steps to remove any MongoDB Operator resources:
142142

@@ -147,6 +147,5 @@ kubectl delete mdb --all -n <namespace>
147147
# any of the following commands must be called after removing all existing mongodb resources
148148
kubectl delete namespace <namespace>
149149
kubectl delete deployment mongodb-enterprise-operator -n <namespace>
150-
kubectl delete crd --all
150+
kubectl delete crd/mongodb.mongodb.com
151151
```
152-

crds.yaml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
# Source: mongodb-enterprise-operator/templates/crds.yaml
33

4-
54
---
65
apiVersion: apiextensions.k8s.io/v1beta1
76
kind: CustomResourceDefinition
@@ -17,6 +16,23 @@ spec:
1716
shortNames:
1817
- mdb
1918
singular: mongodb
19+
additionalPrinterColumns:
20+
- name: Type
21+
type: string
22+
description: "The type of MongoDB deployment. One of 'ReplicaSet', 'ShardedCluster' and 'Standalone'."
23+
JSONPath: .spec.type
24+
- name: State
25+
type: string
26+
description: The current state of the MongoDB deployment.
27+
JSONPath: .status.phase
28+
- name: Version
29+
type: string
30+
description: The version of MongoDB.
31+
JSONPath: .spec.version
32+
- name: Age
33+
type: date
34+
description: The time since the MongoDB resource was created.
35+
JSONPath: .metadata.creationTimestamp
2036
validation: # there are 3 possible schemas, ReplicaSet, ShardedCluster and Standalone
2137
openAPIV3Schema:
2238
oneOf:
@@ -36,6 +52,17 @@ spec:
3652
type:
3753
type: string
3854
pattern: "^Standalone$"
55+
additionalMongodConfig:
56+
properties:
57+
net:
58+
properties:
59+
ssl:
60+
properties:
61+
mode:
62+
type: string
63+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
64+
exposedExternally:
65+
type: boolean
3966
required:
4067
- credentials
4168
- project
@@ -61,6 +88,17 @@ spec:
6188
type:
6289
type: string
6390
pattern: "^ReplicaSet$"
91+
additionalMongodConfig:
92+
properties:
93+
net:
94+
properties:
95+
ssl:
96+
properties:
97+
mode:
98+
type: string
99+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
100+
exposedExternally:
101+
type: boolean
64102
required:
65103
- credentials
66104
- project
@@ -97,6 +135,17 @@ spec:
97135
type:
98136
type: string
99137
pattern: "^ShardedCluster$"
138+
additionalMongodConfig:
139+
properties:
140+
net:
141+
properties:
142+
ssl:
143+
properties:
144+
mode:
145+
type: string
146+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
147+
exposedExternally:
148+
type: boolean
100149
required:
101150
- credentials
102151
- project
@@ -105,4 +154,5 @@ spec:
105154
- shardCount
106155
- mongodsPerShardCount
107156
- mongosCount
108-
- configServerCount
157+
- configServerCount
158+

helm_chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mongodb-enterprise-operator
22
description: MongoDB Kubernetes Enterprise Operator
3-
version: '0.10'
3+
version: '0.11'
44
kubeVersion: '>=1.11'
55
keywords:
66
- mongodb

helm_chart/templates/crds.yaml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{{ if eq .Values.createCrds true}}
2-
---
3-
# Source: mongodb-enterprise-operator/templates/crds.yaml
4-
5-
62
---
73
apiVersion: apiextensions.k8s.io/v1beta1
84
kind: CustomResourceDefinition
@@ -18,6 +14,23 @@ spec:
1814
shortNames:
1915
- mdb
2016
singular: mongodb
17+
additionalPrinterColumns:
18+
- name: Type
19+
type: string
20+
description: "The type of MongoDB deployment. One of 'ReplicaSet', 'ShardedCluster' and 'Standalone'."
21+
JSONPath: .spec.type
22+
- name: State
23+
type: string
24+
description: The current state of the MongoDB deployment.
25+
JSONPath: .status.phase
26+
- name: Version
27+
type: string
28+
description: The version of MongoDB.
29+
JSONPath: .spec.version
30+
- name: Age
31+
type: date
32+
description: The time since the MongoDB resource was created.
33+
JSONPath: .metadata.creationTimestamp
2134
validation: # there are 3 possible schemas, ReplicaSet, ShardedCluster and Standalone
2235
openAPIV3Schema:
2336
oneOf:
@@ -37,6 +50,17 @@ spec:
3750
type:
3851
type: string
3952
pattern: "^Standalone$"
53+
additionalMongodConfig:
54+
properties:
55+
net:
56+
properties:
57+
ssl:
58+
properties:
59+
mode:
60+
type: string
61+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
62+
exposedExternally:
63+
type: boolean
4064
required:
4165
- credentials
4266
- project
@@ -62,6 +86,17 @@ spec:
6286
type:
6387
type: string
6488
pattern: "^ReplicaSet$"
89+
additionalMongodConfig:
90+
properties:
91+
net:
92+
properties:
93+
ssl:
94+
properties:
95+
mode:
96+
type: string
97+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
98+
exposedExternally:
99+
type: boolean
65100
required:
66101
- credentials
67102
- project
@@ -98,6 +133,17 @@ spec:
98133
type:
99134
type: string
100135
pattern: "^ShardedCluster$"
136+
additionalMongodConfig:
137+
properties:
138+
net:
139+
properties:
140+
ssl:
141+
properties:
142+
mode:
143+
type: string
144+
enum: ["disabled", "allowSSL", "preferSSL", "requireSSL", "allowTLS", "preferTLS", "requireTLS"]
145+
exposedExternally:
146+
type: boolean
101147
required:
102148
- credentials
103149
- project

helm_chart/templates/operator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
serviceAccountName: {{ .Values.operator.name }}
2020
containers:
2121
- name: {{ .Values.operator.name }}
22-
image: {{ .Values.registry.repository }}/mongodb-enterprise-operator:{{ .Values.operator.version }}
22+
image: {{ .Values.registry.repository }}/{{ .Values.operator.name }}:{{ .Values.operator.version }}
2323
imagePullPolicy: {{ .Values.registry.pullPolicy }}
2424
{{ if .Values.registry.imagePullSecrets}}
2525
imagePullSecrets:
@@ -41,7 +41,7 @@ spec:
4141
value: 'true'
4242
{{ end }}
4343
- name: MONGODB_ENTERPRISE_DATABASE_IMAGE
44-
value: {{ .Values.registry.repository }}/mongodb-enterprise-database:{{ .Values.operator.version }}
44+
value: {{ .Values.registry.repository }}/{{ .Values.database.name }}:{{ .Values.operator.version }}
4545
- name: IMAGE_PULL_POLICY
4646
value: {{ .Values.registry.pullPolicy }}
4747
{{ if .Values.registry.imagePullSecrets }}

helm_chart/templates/roles.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,24 @@ rules:
2424
- apps
2525
resources:
2626
- statefulsets
27-
verbs: ["*"]
27+
verbs:
28+
- create
29+
- get
30+
- list
31+
- watch
32+
- delete
33+
- update
2834
- apiGroups:
2935
- mongodb.com
3036
resources:
31-
- "*"
37+
- mongodb
38+
- mongodb/finalizers
3239
verbs:
33-
- "*"
40+
- get
41+
- list
42+
- watch
43+
- delete
44+
- update
3445

3546
---
3647
kind: {{ if .Values.operator.watchNamespace }} {{ if (eq .Values.operator.watchNamespace "*") }} ClusterRoleBinding {{ else }} RoleBinding {{ end }} {{ else }} RoleBinding {{ end }}
@@ -50,3 +61,38 @@ subjects:
5061
{{ if .Values.namespace }}
5162
namespace: {{ .Values.namespace }}
5263
{{ end }}
64+
65+
# This ClusterRole is needed if the user wants to use the Kubernetes CA
66+
# infrastructure to generate certificates.
67+
{{ if .Values.needsCAInfrastructure }}
68+
---
69+
kind: ClusterRole
70+
apiVersion: rbac.authorization.k8s.io/v1
71+
metadata:
72+
name: {{ .Values.operator.name }}-{{ .Values.namespace }}-certs
73+
rules:
74+
- apiGroups:
75+
- certificates.k8s.io
76+
resources:
77+
- certificatesigningrequests
78+
verbs:
79+
- get
80+
- create
81+
- list
82+
83+
---
84+
kind: ClusterRoleBinding
85+
apiVersion: rbac.authorization.k8s.io/v1
86+
metadata:
87+
name: {{ .Values.operator.name }}-{{ .Values.namespace }}-certs-binding
88+
namespace: {{ .Values.namespace }}
89+
roleRef:
90+
apiGroup: rbac.authorization.k8s.io
91+
kind: ClusterRole
92+
name: {{ .Values.operator.name }}-{{ .Values.namespace }}-certs
93+
subjects:
94+
- kind: ServiceAccount
95+
name: {{ .Values.operator.name }}
96+
namespace: {{ .Values.namespace }}
97+
98+
{{ end }}

helm_chart/values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ operator:
1616
name: mongodb-enterprise-operator
1717

1818
# Version of mongodb-enterprise-operator and mongodb-enterprise-database images
19-
version: '0.10'
19+
version: '0.11'
20+
21+
database:
22+
name: mongodb-enterprise-database
2023

2124
registry:
2225
# Specify if images are pulled from private repository
2326
imagePullSecrets:
2427
pullPolicy: Always
2528
repository: quay.io/mongodb
29+
30+
# Set this to true if the operator will require Kubernetes CA
31+
# infrastructure to generate TLS certificates.
32+
needsCAInfrastructure: true

0 commit comments

Comments
 (0)