MCPcopy Index your code
hub / github.com/bitpoke/mysql-operator

github.com/bitpoke/mysql-operator @v0.6.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.3 ↗ · + Follow
800 symbols 2,749 edges 146 files 447 documented · 56%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

MySQL Operator

MySQL Operator enables bulletproof MySQL on Kubernetes. It manages all the necessary resources for deploying and managing a highly available MySQL cluster. It provides effortless backups, while keeping the cluster highly available.

:beer: :pizza: :coffee: If the operator has helped you out with your projects, please consider sponsoring it to speed up the development. Issues are answered in this repo on a best-effort basis.

:wrench: :nut_and_bolt: :hammer: For paid commercial support, deployment, integration and prioritizing of features, please check the dedicated service provided by Bitpoke.

The operator has been developed by Bitpoke for internal use to run WordPress in a cloud-native app and has been open-sourced for the general public to benefit.

Goals and status

The main goals of this operator are:

  1. Easily deploy MySQL clusters in Kubernetes (cluster-per-service model)
  2. Friendly to devops (monitoring, availability, scalability and backup stories solved)
  3. Out-of-the-box backups (scheduled and on demand) and point-in-time recovery
  4. Support for cloning in cluster and across clusters.

Contributing

We welcome all contributions in the form of new issues for feature requests, bugs or even pull requests. We are open to discuss ideas on how to improve the operator and would also love to find out where and how it's used. The discussion related to this project should happen on the Kubernetes Community Slack. The current maintainers of this project can be reached via email, too.

Documentation

  • Getting started provides an overview over deploying and using the MySQL operator
  • Deploy a MySQL cluster describes in detail how a cluster can be installed and configured
  • Configure backups shows how to configure and take backups of a cluster
  • Recurrent backups describes how to setup recurrent backups for the cluster
  • Restore a cluster explains how to restore a cluster from a backup
  • How to integrate the operator with your deployment setup. This presents a simple way of using the MySQL operator and helm to deploy your application
  • Orchestrator shows you how to access the orchestrator for more details.

Controller deploy

To deploy this controller, use the provided helm chart by running:

helm repo add bitpoke https://helm-charts.bitpoke.io
helm install mysql-operator bitpoke/mysql-operator

For more information about chart values see chart README. This chart will deploy the controller together with an orchestrator cluster.

NOTE: MySQL operator 0.6.x requires at least Kubernetes 1.19.x to upgrade, check the 0.6.x upgrade notes as some additional steps may be required.

NOTE: MySQL operator 0.2.x requires at least Kubernetes 1.11.x (or 1.10.x with alpha features) while version 0.1.x is known to work with Kubernetes up 1.9.x. To upgrade, check the 0.2.x upgrade notes as some additional steps are required.

Controller upgrade

It is possible that upgrading the MySQL operator to a newer version requires additional steps. Those steps can be found in the operator's documentation at upgrades section.

Deploying a cluster

kubectl apply -f https://raw.githubusercontent.com/bitpoke/mysql-operator/master/examples/example-cluster-secret.yaml
kubectl apply -f https://raw.githubusercontent.com/bitpoke/mysql-operator/master/examples/example-cluster.yaml

Roadmap to v1.0

  • [ ] Integration with Google Cloud Marketplace, OperatorHub.io, AWS Marketplace
  • [ ] CRD Validation and webhooks
  • [ ] SSL support
  • [ ] Default integrated with MySQL 8.0
  • [ ] Proxy SQL integration
  • [ ] Backup policies
  • [x] Physical backups
  • [x] HA Orchestrator integration
  • [x] Prometheus metrics exporter
  • [x] Lag mitigation
  • [x] Query limits

Tech considerations

This project uses Percona Server for MySQL 5.7 / 8.0 because of backup improvements (eg. backup locks), monitoring improvements and some serviceability improvements (eg. utility user). Although we could have used MariaDB, our primary focus being WordPress, we wanted a drop-in rather than a fork. In the future we might support MariaDB if that can be implemented in a compatible way.

License

This project is licensed under Apache 2.0 license. Read the LICENSE file in the top distribution directory for the full license text.

Extension points exported contracts — how you extend this code

SQLInterface (Interface)
SQLInterface expose abstract operations that can be applied on a MySQL node [2 implementers]
pkg/controller/node/sql.go
SQLRunner (Interface)
SQLRunner interface is a subset of mysql.DB [2 implementers]
pkg/internal/mysql/mysql.go
MySQLClusterOption (FuncType)
MySQLClusterOption is the option type for for the invite factory
pkg/testutil/factories/mysql_cluster.go
Interface (Interface)
Interface is the orchestrator client interface
pkg/orchestrator/orchestrator.go
Interface (Interface)
Interface represents the upgrader interface
pkg/controller/mysqlcluster/internal/upgrades/upgrades.go
Rows (Interface)
Rows interface is a subset of mysql.Rows
pkg/internal/mysql/mysql.go
MysqlDBOption (FuncType)
MysqlDBOption to config the factory
pkg/testutil/factories/mysql_database.go
SQLRunnerFactory (FuncType)
SQLRunnerFactory a function that generates a new SQLRunner
pkg/internal/mysql/mysql.go

Core symbols most depended-on inside this repo

Unwrap
called by 160
pkg/internal/mysqluser/mysqluser.go
GetPodHostname
called by 79
pkg/internal/mysqlcluster/mysqlcluster.go
GetClusterAlias
called by 59
pkg/internal/mysqlcluster/mysqlcluster.go
Error
called by 43
pkg/orchestrator/errors.go
GetNameForResource
called by 38
pkg/internal/mysqlcluster/mysqlcluster.go
Error
called by 35
pkg/controller/mysqlcluster/internal/syncer/errors.go
Cluster
called by 27
pkg/orchestrator/orchestrator.go
Sync
called by 25
pkg/controller/orchestrator/orchestrator_reconcile.go

Shape

Method 367
Function 325
Struct 76
TypeAlias 18
FuncType 7
Interface 5
Class 2

Languages

Go98%
Python2%

Modules by API surface

pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go64 symbols
pkg/controller/orchestrator/orchestrator_reconcile.go33 symbols
pkg/controller/node/sql.go26 symbols
pkg/orchestrator/orchestrator.go25 symbols
pkg/orchestrator/fake/client.go22 symbols
pkg/internal/mysqlcluster/mysqlcluster.go21 symbols
pkg/controller/mysqlcluster/internal/syncer/statefullset.go21 symbols
pkg/sidecar/configs.go20 symbols
pkg/controller/node/node_controller.go20 symbols
test/e2e/framework/util.go19 symbols
pkg/internal/mysql/mysql.go17 symbols
pkg/internal/mysql/fake/mysql.go15 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add mysql-operator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact