Skip to content

Commit

Permalink
Merge pull request #51 from octoposprime/feature/sey/48/mongodb-insta…
Browse files Browse the repository at this point in the history
…lled-and-configured

MongoDB installation and configurations are completed
  • Loading branch information
SeyyidhanTaskin authored May 8, 2024
2 parents f983a1f + 83266d9 commit 8bd05f4
Show file tree
Hide file tree
Showing 10 changed files with 823 additions and 0 deletions.
47 changes: 47 additions & 0 deletions dev/mongodb/cr/mongodb.com_v1_mongodbcommunity_cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: mongodb
spec:
members: 1
type: ReplicaSet
version: "6.0.5"
security:
authentication:
modes: ["SCRAM"]
users:
- name: my-user
db: admin
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
name: my-user-password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
scramCredentialsSecretName: my-scram
additionalMongodConfig:
storage.wiredTiger.engineConfig.journalCompressor: zlib

# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
name: my-user-password
type: Opaque
stringData:
password: "password-here"
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-lb
spec:
type: LoadBalancer
ports:
- port: 27017
targetPort: 27017
selector:
app: mongodb-svc
600 changes: 600 additions & 0 deletions dev/mongodb/crd/crd.yaml

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions dev/mongodb/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
email: [email protected]
labels:
owner: mongodb
name: mongodb-kubernetes-operator
spec:
replicas: 1
selector:
matchLabels:
name: mongodb-kubernetes-operator
strategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
name: mongodb-kubernetes-operator
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: name
operator: In
values:
- mongodb-kubernetes-operator
topologyKey: kubernetes.io/hostname
containers:
- command:
- /usr/local/bin/entrypoint
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: mongodb-kubernetes-operator
- name: AGENT_IMAGE
value: quay.io/mongodb/mongodb-agent:107.0.0.8465-1
- name: VERSION_UPGRADE_HOOK_IMAGE
value: quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.8
- name: READINESS_PROBE_IMAGE
value: quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.17
- name: MONGODB_IMAGE
value: mongodb-community-server
- name: MONGODB_REPO_URL
value: quay.io/mongodb
image: quay.io/mongodb/mongodb-kubernetes-operator:0.9.0
imagePullPolicy: Always
name: mongodb-kubernetes-operator
resources:
limits:
cpu: 1100m
memory: 1Gi
requests:
cpu: 500m
memory: 200Mi
securityContext:
readOnlyRootFilesystem: true
runAsUser: 2000
allowPrivilegeEscalation: false
securityContext:
seccompProfile:
type: RuntimeDefault
serviceAccountName: mongodb-kubernetes-operator
7 changes: 7 additions & 0 deletions dev/mongodb/rbac/customization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
- role.yaml
- role_binding.yaml
- service_account.yaml
- service_account_database.yaml
- role_binding_database.yaml
- role_database.yaml
46 changes: 46 additions & 0 deletions dev/mongodb/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: mongodb-kubernetes-operator
rules:
- apiGroups:
- ""
resources:
- pods
- services
- configmaps
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- mongodbcommunity.mongodb.com
resources:
- mongodbcommunity
- mongodbcommunity/status
- mongodbcommunity/spec
- mongodbcommunity/finalizers
verbs:
- get
- patch
- list
- update
- watch
11 changes: 11 additions & 0 deletions dev/mongodb/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mongodb-kubernetes-operator
subjects:
- kind: ServiceAccount
name: mongodb-kubernetes-operator
roleRef:
kind: Role
name: mongodb-kubernetes-operator
apiGroup: rbac.authorization.k8s.io
11 changes: 11 additions & 0 deletions dev/mongodb/rbac/role_binding_database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mongodb-database
subjects:
- kind: ServiceAccount
name: mongodb-database
roleRef:
kind: Role
name: mongodb-database
apiGroup: rbac.authorization.k8s.io
19 changes: 19 additions & 0 deletions dev/mongodb/rbac/role_database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mongodb-database
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- apiGroups:
- ""
resources:
- pods
verbs:
- patch
- delete
- get
4 changes: 4 additions & 0 deletions dev/mongodb/rbac/service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: mongodb-kubernetes-operator
4 changes: 4 additions & 0 deletions dev/mongodb/rbac/service_account_database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: mongodb-database

0 comments on commit 8bd05f4

Please sign in to comment.