{"id":13742475,"url":"https://github.com/Ultimaker/k8s-mongo-operator","last_synced_at":"2025-05-08T23:33:51.892Z","repository":{"id":150850536,"uuid":"135129190","full_name":"Ultimaker/k8s-mongo-operator","owner":"Ultimaker","description":"DEPRECATED - Kubernetes Operator for MongoDB Replica Sets and Backups.","archived":true,"fork":false,"pushed_at":"2019-07-09T16:38:45.000Z","size":433,"stargazers_count":28,"open_issues_count":4,"forks_count":10,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-04T20:14:00.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ultimaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-28T08:02:16.000Z","updated_at":"2024-11-11T02:52:59.000Z","dependencies_parsed_at":"2023-04-16T06:00:40.615Z","dependency_job_id":null,"html_url":"https://github.com/Ultimaker/k8s-mongo-operator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultimaker%2Fk8s-mongo-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultimaker%2Fk8s-mongo-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultimaker%2Fk8s-mongo-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultimaker%2Fk8s-mongo-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ultimaker","download_url":"https://codeload.github.com/Ultimaker/k8s-mongo-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253165470,"owners_count":21864439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T05:00:32.668Z","updated_at":"2025-05-08T23:33:51.553Z","avatar_url":"https://github.com/Ultimaker.png","language":"Python","funding_links":[],"categories":["Repository is obsolete"],"sub_categories":["Awesome Operators in the Wild"],"readme":"# k8s-mongo-operator\nMongoDB Operator for Kubernetes.\n\n**This repository is no longer actively maintained. Please fork it and make the needed changes yourself.**\n\n## Features\nThe following feature are currently available in this operator:\n\n* Create, update or delete MongoDB replica sets.\n* Automatically initialize the replica set configuration in the master node.\n* Schedule backups to Google Cloud Storage using a Google service account and `mongodump`.\n\n## Limitations\nThe current version has the limitations that shall be addressed in a later version:\n\n- The watch API from Kubernetes is currently not being used, as we want to remain responsive for creating backups in case no events are received. This means:\n  - We use list secret privilege to remove any admin operator secrets that are not used anymore. This is not part of the [best practices](https://kubernetes.io/docs/concepts/configuration/secret/#best-practices).\n  - The solution is probably to listen to events with [`asyncio`](https://engineering.bitnami.com/articles/kubernetes-async-watches.html).\n- Mongo instances are not using SSL certificates yet.\n\n## Cluster interaction\nPlease refer to our [simplified diagram](./docs/architecture.png) to get an overview of the operator interactions with your Kubernetes cluster.\n\n## Deployment\nTo deploy this operator in your own cluster, you'll need to create some configuration files.\nAn example of these configuration files can be found in [kubernetes/operators/mongo-operator](./kubernetes/operators/mongo-operator)\n\nAs you can see there is a service account (mongo-operator-service-account) which has some specific permissions in the cluster.\nThese permissions are registered in the cluster role and cluster role binding.\n\nLastly there is a deployment configuration to deploy the actual operator.\nUsually you'd use an image value like `ultimaker/k8s-mongo-operator:master`, or a specific version.\nAll available tags can be found on [Docker Hub](https://hub.docker.com/r/ultimaker/k8s-mongo-operator/).\n\n## Creating a Mongo object\nTo deploy a new replica set in your cluster using the operator, create a Kubernetes configuration file similar to this:\n\n```yaml\napiVersion: \"operators.ultimaker.com/v1\"\nkind: Mongo\nmetadata:\n  name: mongo-cluster\nspec:\n  mongodb:\n    replicas: 3\n  backups:\n    cron: \"0 * * * *\" # hourly\n    gcs:\n      bucket: \"ultimaker-mongo-backups\"\n      serviceAccount:\n        secretKeyRef:\n          name: \"storage-service-account\"\n          key: json\n```\n\nThen deploy it to the cluster like any other object:\n\n```bash\nkubectl apply -f mongo.yaml\n```\n\n### Configuration options\nThe following options are available to use in the `spec` section of the `yaml` configuration file. Keys with a `*` in front are required.\n\n| Config key | Default | Description |\n| --- | --- | --- |\n| * `mongodb.mongo_name` | - | The name of the Mongo deployment. |\n| `mongodb.storage_name` | mongo-storage | The name of the persistent volumes that Kubernetes will create and mount. |\n| `mongodb.storage_size` | 30Gi | The size of the persistent volumes. |\n| `mongodb.storage_data_path` | /data/db | The path on which the persistent volumes are mounted in the Mongo containers. |\n| `mongodb.storage_class_name` | - | The name of the storage class to use to create the persistent values. If not passed it will use the Kubernetes cluster default storage class name. |\n| `mongodb.cpu_limit` | 1 | The CPU limit of each container. |\n| `mongodb.cpu_request` | 0.5 | The CPU request of each container. |\n| `mongodb.memory_limit` | 2Gi | The memory limit of each container. |\n| `mongodb.memory_request` | 1Gi | The memory request of each container. |\n| `mongodb.wired_tiger_cache_size` | 0.25 | The wired tiger cache size. |\n| `mongodb.replicas` | - | The amount of MongoDB replicas that should be available in the replica set. Must be an uneven positive integer and minimum 3. |\n| * `backups.cron` | - | The cron on which to create a backup to cloud storage.\n| * `backups.gcs.bucket` | - | The GCS bucket to upload the backup to. |\n| `backups.gcs.restore_bucket` | - | The GCS bucket that contains the backup we wish to restore. If not specified, the value of backups.gcs.bucket is used. |\n| `backups.gcs.restore_from` | - | Filename of the backup in the bucket we wish to restore. If not specified, or set to 'latest', the last backup created is used. |\n| `backups.gcs.prefix` | backups/ | The file name prefix for the backup file. |\n\n\u003e Please read https://docs.mongodb.com/manual/administration/production-notes/#allocate-sufficient-ram-and-cpu for details about why setting the WiredTiger cache size is important when you change the container memory limit from the default value.\n\n## Testing locally\nTo run the tests in a local Kubernetes (MiniKube) cluster, we have created a simple test script.\n\nEnsure you have the following tools installed on your system:\n- [Docker](https://store.docker.com/search?type=edition\u0026offering=community)\n- [MiniKube v0.25.2](https://github.com/kubernetes/minikube/releases/tag/v0.25.2) (please use this version specifically)\n\nThen start a new MiniKube cluster using the following commands:\n\n```bash\nminikube start\n```\n\nThen you can run our test script to deploy the operator and execute some end-to-end tests.\n\nNote that this script assumes there is a file `google-credentials.json` in this directory that will be uploaded to Kubernetes as the secret for the backups.\nYou will need to download this file from Google in order to run the script.\n\n```bash\n./build-and-deploy-local.sh\n```\n\nYou will also see the operator logs streamed to your console.\n\n## Contributing\nPlease make a GitHub issue or pull request to help us build this operator.\n\n## Maintainance\nThe repo is currently maintained by Ultimaker. Contact us via the GitHub issues for questions or suggestions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUltimaker%2Fk8s-mongo-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUltimaker%2Fk8s-mongo-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUltimaker%2Fk8s-mongo-operator/lists"}