Skip to content

Use MongoDB Kubernetes Operator#55

Merged
monrax merged 4 commits intomainfrom
refactor/mongo-operator
Dec 18, 2025
Merged

Use MongoDB Kubernetes Operator#55
monrax merged 4 commits intomainfrom
refactor/mongo-operator

Conversation

@monrax
Copy link
Copy Markdown
Collaborator

@monrax monrax commented Dec 5, 2025

Replace bitnami dependency chart with official MCK operator

This closes #48

Changes

  • Removed bitnami/mongodb helm dependency chart.
  • Added a (mongodbcommunity.mongodb.com/v1) MongoDBCommunity custom resource. This introduces the mongodb.communityResource.enabled as a replacement for the mongodb.subchart.enabled value, as well as a manual dependency on the MongoDB Controllers for Kubernetes (MCK) operator.
  • Modified the installation section in the README.md to include the MCK operator installation as an additional required step.
  • Removed unused Secret: graylog-mongo-secret.
  • Removed post-install hook Job to update GRAYLOG_MONGODB_URI in favor of retrieving the required value from a corresponding secret created by the MCK operator, and falling back to a default URI value when not available. Support for both global.existingSecretName and graylog.config.mongodb.customUri and their usage remains unchanged.
  • Removed unused Role and made it optional through values.yaml, together with its corresponding RoleBinding.
  • Added mongo-specific ServiceAccount with required Role and RoleBinding (also customizable from values.yaml). See related issue: service account missing when deploying database to different namespace than operator mongodb/mongodb-kubernetes-operator#850

How to review this PR?

  • Follow installation instructions in the README.md for this branch.
  • Make sure that everything works as expected.
  • In addition, check that:
    • No bitnami charts are listed for helm list -A
    • A custom MongoDBCommunity resource is returned for kubectl get mongodbcommunity -n graylog
    • No graylog-mongo-secret is listed for kubectl get secret -n graylog
    • No helm-managed jobs are returned for kubectl get jobs -n graylog
    • One helm-managed role is returned for kubectl get role -n graylog: graylog-mongo-sa-role

Notes for Reviewers

  • The commit history must be preserved - please use the rebase-merge or standard merge option instead of squash-merge
  • Sync up with the author before merging

@monrax monrax marked this pull request as ready for review December 8, 2025 10:50
@monrax monrax changed the title Refactor: use MongoDB Kubernets Operator Refactor: use MongoDB Kubernetes Operator Dec 8, 2025
@monrax monrax changed the title Refactor: use MongoDB Kubernetes Operator Use MongoDB Kubernetes Operator Dec 15, 2025
- remove dependency subchart
- delete extra secret
- add mongo init container check to datanode
@monrax monrax force-pushed the refactor/mongo-operator branch from 4259235 to 710b90e Compare December 16, 2025 14:38
@williamtrelawny
Copy link
Copy Markdown
Collaborator

@monrax Everything is up and running healthy, awesome job with this huge task! A few questions though before I approve:

  1. kubectl get role -n graylog shows only 1 role and it's named graylog-mongo-sa-role. Is this a "helm-managed role" as per your check?
  2. There are no additional mongo-auth-check containers in any of the Data Node pods, only the graylog-datanode container.
  3. Minor, non-blocking issue, but when installing the mongodb-kubernetes chart, i get the following warning message:
unable to find exact version; falling back to closest available version" chart=mongodb-kubernetes requested="" selected=1.3.0

This does not break the install, but perhaps we should be explicit with which version of the Chart we're using? Also strange though, because it defaults to v1.3.0 when the Chart's latest version is 1.6.1. But maybe I'm misinterpreting something.

@monrax
Copy link
Copy Markdown
Collaborator Author

monrax commented Dec 17, 2025

Hey, @williamtrelawny ! Thank you for taking a look.

Apologies, I pushed an update to this PR that added a mongo-specific ServiceAccount to the chart, which also includes a Role, and removed the additional mongodb preflight check init container, but forgot to update check list. I have just updated it, and what you are seeing is the expected behavior for both 1. and 2.

As for 3.

  1. Minor, non-blocking issue, but when installing the mongodb-kubernetes chart, i get the following warning message:
unable to find exact version; falling back to closest available version" chart=mongodb-kubernetes requested="" selected=1.3.0

Can you tell me which command you're using to install the MCK Operator? I haven't seen that warning on my end.

@monrax
Copy link
Copy Markdown
Collaborator Author

monrax commented Dec 17, 2025

Just pushed two minor changes to README.md

  • Modified MCK Operator installation command to specify both repo and version:

graylog-helm/README.md

Lines 96 to 120 in eb69529

# Installation
## Clone this repo
```sh
# clone repo
git clone git@github.com:Graylog2/graylog-helm.git
# cd into the newly created graylog-helm directory
cd graylog-helm
```
## Install the official MongoDB Kubernetes Operator using Helm
```sh
helm upgrade --install mongodb-kubernetes-operator mongodb-kubernetes \
--repo https://mongodb.github.io/helm-charts --version "1.6.1" \
--set operator.watchNamespace="*" --reuse-values \
--namespace operators --create-namespace
```
## Install the official Graylog Helm chart
```sh
helm install graylog ./graylog --namespace graylog --create-namespace
```
🏁 That's it!

  • Added MCK Operator to requirement list:

graylog-helm/README.md

Lines 35 to 39 in eb69529

# Requirements
- Kubernetes >= v1.32
- Helm >= v3.0
- MongoDB Controllers for Kubernetes (MCK) Operator v1.6.1 (required unless a [user-provided MongoDB](#bring-your-own-mongodb) is used)

Copy link
Copy Markdown
Collaborator

@williamtrelawny williamtrelawny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@monrax monrax merged commit 4b09d53 into main Dec 18, 2025
1 check passed
@williamtrelawny williamtrelawny deleted the refactor/mongo-operator branch December 18, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace bitnami/mongodb dependency

2 participants