Skip to content

Commit 1d00e0d

Browse files
author
Anton Lisovenko
committed
93563f6dcd8b43cc2ce9a94c0e28c1f8289c3109: update public repo contents
1 parent 60810a3 commit 1d00e0d

File tree

9 files changed

+139
-20
lines changed

9 files changed

+139
-20
lines changed

README.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ You can discuss this integration in our [Slack](https://community-slack.mongodb.
2020

2121
[Kubernetes Resource Specification](https://docs.opsmanager.mongodb.com/current/reference/k8s-operator-specification)
2222

23+
[Troubleshooting Kubernetes Operator](https://docs.opsmanager.mongodb.com/current/reference/troubleshooting/k8s/)
24+
2325
[Known Issues for Kubernetes Operator](https://docs.opsmanager.mongodb.com/current/reference/known-issues-k8s-beta)
2426

2527
## Requirements ##
2628

27-
The MongoDB Enterprise Operator is compatible with Kubernetes v1.9 and above. It has been tested against Openshift 3.9.
29+
The MongoDB Enterprise Operator is compatible with Kubernetes v1.11 and above. It has been tested against Openshift 3.11.
2830

2931
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.
3032
> If this is your first time trying the Operator, Cloud Manager is easier to get started
3133
3234

33-
3435
## Installation
3536

3637
### Create Kubernetes Namespace
@@ -63,14 +64,19 @@ or clone this repo, make any edits you need, and apply it from your machine.
6364

6465
kubectl apply -f mongodb-enterprise.yaml
6566

67+
Check the end of the page for instructions on how to remove the Operator.
6668

67-
### Helm Installation
69+
### Installation using Helm Chart
6870

69-
If you have an Helm installation in your Kubernetes cluster, you can run:
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.
72+
`kubectl apply` is a much clearer way of installing/upgrading):
7073

71-
helm install helm_chart/ --name mongodb-enterprise
74+
helm template public/helm_chart > operator.yaml
75+
kubectl apply -f operator.yaml
7276

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
7378

79+
Check the end of the page for instructions on how to remove the Operator.
7480

7581
## Adding Ops Manager Credentials ##
7682

@@ -142,8 +148,30 @@ users.
142148

143149
### Creating a MongoDB Object ###
144150

145-
A MongoDB object in Kubernetes can be a MongoDBStandalone, a MongoDBReplicaSet or a MongoDBShardedCluster. 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`.
151+
A MongoDB object in Kubernetes can be a MongoDBStandalone, a MongoDBReplicaSet or a MongoDBShardedCluster (short names are `mst`, `mrs`, `msc`). 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`.
146152

147153
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.
148154

149155
kubectl apply -f samples/minimal/replicaset.yaml
156+
157+
### Correct order of Operator/Namespace removal
158+
159+
It's important to keep correct order or removal operations. The simple rule is: **never remove Operator before mongodb resources**!
160+
The reason is that, starting from version `0.6`, the Operator adds a finalizer header to each mongodb resource, preventing
161+
them from removal until a controller removes this header. As the MongoDB Operator is the only controller that can do this,
162+
removing it before removing the mongodb resources is an error.
163+
164+
These are the correct steps to clean up any MongoDB Operator resources:
165+
166+
```bash
167+
# these three operations must be called first!
168+
kubectl delete mst --all -n <namespace>
169+
kubectl delete mrs --all -n <namespace>
170+
kubectl delete msc --all -n <namespace>
171+
172+
# any of the following commands must be called removing all existing mongodb resources
173+
kubectl delete namespace <namespace>
174+
kubectl delete deployment mongodb-enterprise-operator -n <namespace>
175+
kubectl delete crd --all
176+
```
177+

crds.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
##---
1+
---
22
# Source: mongodb-enterprise-operator/templates/crds.yaml
33

44

@@ -30,6 +30,14 @@ spec:
3030
type: string
3131
version:
3232
type: string
33+
logLevel:
34+
type: string
35+
enum:
36+
- DEBUG
37+
- INFO
38+
- WARN
39+
- ERROR
40+
- FATAL
3341
required:
3442
- credentials
3543
- project
@@ -67,6 +75,14 @@ spec:
6775
type: string
6876
version:
6977
type: string
78+
logLevel:
79+
type: string
80+
enum:
81+
- DEBUG
82+
- INFO
83+
- WARN
84+
- ERROR
85+
- FATAL
7086
required:
7187
- credentials
7288
- project
@@ -115,6 +131,14 @@ spec:
115131
type: string
116132
version:
117133
type: string
134+
logLevel:
135+
type: string
136+
enum:
137+
- DEBUG
138+
- INFO
139+
- WARN
140+
- ERROR
141+
- FATAL
118142
required:
119143
- credentials
120144
- project

helm_chart/templates/crds.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ spec:
2828
type: string
2929
version:
3030
type: string
31+
logLevel:
32+
type: string
33+
enum:
34+
- DEBUG
35+
- INFO
36+
- WARN
37+
- ERROR
38+
- FATAL
3139
required:
3240
- credentials
3341
- project
@@ -65,6 +73,14 @@ spec:
6573
type: string
6674
version:
6775
type: string
76+
logLevel:
77+
type: string
78+
enum:
79+
- DEBUG
80+
- INFO
81+
- WARN
82+
- ERROR
83+
- FATAL
6884
required:
6985
- credentials
7086
- project
@@ -113,6 +129,14 @@ spec:
113129
type: string
114130
version:
115131
type: string
132+
logLevel:
133+
type: string
134+
enum:
135+
- DEBUG
136+
- INFO
137+
- WARN
138+
- ERROR
139+
- FATAL
116140
required:
117141
- credentials
118142
- project

helm_chart/templates/operator.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ apiVersion: apps/v1
33
kind: Deployment
44
metadata:
55
name: {{ .Values.operator.name }}
6+
{{ if .Values.namespace }}
67
namespace: {{ .Values.namespace }}
8+
{{ end }}
79
spec:
810
replicas: 1
911
selector:
@@ -19,22 +21,38 @@ spec:
1921
- name: {{ .Values.operator.name }}
2022
image: {{ .Values.registry.repository }}/mongodb-enterprise-operator:{{ .Values.operator.version }}
2123
imagePullPolicy: {{ .Values.registry.pullPolicy }}
24+
{{ if .Values.registry.imagePullSecrets}}
25+
imagePullSecrets:
26+
- name: {{ .Values.registry.imagePullSecrets }}
27+
{{ end }}
2228
env:
2329
- name: OPERATOR_ENV
2430
value: {{ .Values.operator.env }}
2531
- name: WATCH_NAMESPACE
32+
{{ if .Values.operator.watchNamespace}}
33+
value: "{{ .Values.operator.watchNamespace }}"
34+
{{ else }}
2635
valueFrom:
2736
fieldRef:
2837
fieldPath: metadata.namespace
38+
{{ end }}
2939
{{ if eq .Values.managedSecurityContext true}}
3040
- name: MANAGED_SECURITY_CONTEXT
3141
value: 'true'
32-
{{end}}
42+
{{ end }}
3343
- name: MONGODB_ENTERPRISE_DATABASE_IMAGE
3444
value: {{ .Values.registry.repository }}/mongodb-enterprise-database:{{ .Values.operator.version }}
3545
- name: IMAGE_PULL_POLICY
3646
value: {{ .Values.registry.pullPolicy }}
47+
{{ if .Values.registry.imagePullSecrets }}
3748
- name: IMAGE_PULL_SECRETS
3849
value: {{ .Values.registry.imagePullSecrets }}
39-
imagePullSecrets:
40-
- name: {{ .Values.registry.imagePullSecrets }}
50+
{{ end }}
51+
{{ if .Values.operator.podWaitSeconds }}
52+
- name: POD_WAIT_SEC
53+
value: {{ quote .Values.operator.podWaitSeconds }}
54+
{{ end }}
55+
{{ if .Values.operator.podSetWaitRetries }}
56+
- name: POD_WAIT_RETRIES
57+
value: {{ quote .Values.operator.podSetWaitRetries }}
58+
{{ end }}

helm_chart/templates/roles.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ kind: Role
33
apiVersion: rbac.authorization.k8s.io/v1
44
metadata:
55
name: {{ .Values.operator.name }}
6+
{{ if .Values.namespace }}
67
namespace: {{ .Values.namespace }}
8+
{{ end }}
79
rules:
810
- apiGroups:
911
- ""
@@ -17,6 +19,7 @@ rules:
1719
- create
1820
- update
1921
- delete
22+
- watch
2023
- apiGroups:
2124
- apps
2225
resources:
@@ -34,12 +37,16 @@ kind: RoleBinding
3437
apiVersion: rbac.authorization.k8s.io/v1
3538
metadata:
3639
name: {{ .Values.operator.name }}
40+
{{ if .Values.namespace }}
3741
namespace: {{ .Values.namespace }}
42+
{{ end }}
3843
roleRef:
3944
apiGroup: rbac.authorization.k8s.io
4045
kind: Role
4146
name: {{ .Values.operator.name }}
4247
subjects:
4348
- kind: ServiceAccount
4449
name: {{ .Values.operator.name }}
50+
{{ if .Values.namespace }}
4551
namespace: {{ .Values.namespace }}
52+
{{ end }}

helm_chart/templates/serviceaccount.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
55
name: {{ .Values.operator.name }}
6+
{{ if .Values.namespace }}
67
namespace: {{ .Values.namespace }}
8+
{{ end }}

helm_chart/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ operator:
1616
name: mongodb-enterprise-operator
1717

1818
# Version of mongodb-enterprise-operator and mongodb-enterprise-database images
19-
version: 0.5
19+
version: 0.6
2020

2121
registry:
2222
# Specify if images are pulled from private repository

mongodb-enterprise.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
##---
1+
---
22
# Source: mongodb-enterprise-operator/templates/roles.yaml
33
---
44
kind: Role
55
apiVersion: rbac.authorization.k8s.io/v1
66
metadata:
77
name: mongodb-enterprise-operator
8+
89
namespace: mongodb
10+
911
rules:
1012
- apiGroups:
1113
- ""
@@ -19,6 +21,7 @@ rules:
1921
- create
2022
- update
2123
- delete
24+
- watch
2225
- apiGroups:
2326
- apps
2427
resources:
@@ -36,31 +39,39 @@ kind: RoleBinding
3639
apiVersion: rbac.authorization.k8s.io/v1
3740
metadata:
3841
name: mongodb-enterprise-operator
42+
3943
namespace: mongodb
44+
4045
roleRef:
4146
apiGroup: rbac.authorization.k8s.io
4247
kind: Role
4348
name: mongodb-enterprise-operator
4449
subjects:
4550
- kind: ServiceAccount
4651
name: mongodb-enterprise-operator
52+
4753
namespace: mongodb
48-
##---
54+
55+
---
4956
# Source: mongodb-enterprise-operator/templates/serviceaccount.yaml
5057
---
5158
apiVersion: v1
5259
kind: ServiceAccount
5360
metadata:
5461
name: mongodb-enterprise-operator
62+
5563
namespace: mongodb
56-
##---
64+
65+
---
5766
# Source: mongodb-enterprise-operator/templates/operator.yaml
5867
---
5968
apiVersion: apps/v1
6069
kind: Deployment
6170
metadata:
6271
name: mongodb-enterprise-operator
72+
6373
namespace: mongodb
74+
6475
spec:
6576
replicas: 1
6677
selector:
@@ -74,21 +85,23 @@ spec:
7485
serviceAccountName: mongodb-enterprise-operator
7586
containers:
7687
- name: mongodb-enterprise-operator
77-
image: quay.io/mongodb/mongodb-enterprise-operator:0.5
88+
image: quay.io/mongodb/mongodb-enterprise-operator:0.6
7889
imagePullPolicy: Always
90+
7991
env:
8092
- name: OPERATOR_ENV
8193
value: prod
8294
- name: WATCH_NAMESPACE
95+
8396
valueFrom:
8497
fieldRef:
8598
fieldPath: metadata.namespace
8699

100+
87101
- name: MONGODB_ENTERPRISE_DATABASE_IMAGE
88-
value: quay.io/mongodb/mongodb-enterprise-database:0.5
102+
value: quay.io/mongodb/mongodb-enterprise-database:0.6
89103
- name: IMAGE_PULL_POLICY
90104
value: Always
91-
- name: IMAGE_PULL_SECRETS
92-
value:
93-
imagePullSecrets:
94-
- name:
105+
106+
107+

samples/extended/replica-set.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ spec:
1717
project: my-project
1818
credentials: my-credentials
1919

20+
# log level affects the level of logging for the agent. Use DEBUG cautiously as log file size may grow very quickly
21+
logLevel: WARN
22+
2023
persistent: true
2124
podSpec:
2225
cpu: '0.25'

0 commit comments

Comments
 (0)