{"id":13742400,"url":"https://github.com/Orange-OpenSource/galera-operator","last_synced_at":"2025-05-08T23:33:47.457Z","repository":{"id":143061025,"uuid":"238245066","full_name":"Orange-OpenSource/galera-operator","owner":"Orange-OpenSource","description":"Galera Operator automates tasks for managing a Galera cluster in Kubernetes","archived":true,"fork":false,"pushed_at":"2020-10-20T14:51:54.000Z","size":1109,"stargazers_count":34,"open_issues_count":7,"forks_count":18,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-07T05:04:04.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Orange-OpenSource.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":"ROADMAP.md","authors":"AUTHORS","dei":null}},"created_at":"2020-02-04T15:56:22.000Z","updated_at":"2025-03-10T17:40:36.000Z","dependencies_parsed_at":"2023-06-25T22:43:09.360Z","dependency_job_id":null,"html_url":"https://github.com/Orange-OpenSource/galera-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fgalera-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fgalera-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fgalera-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fgalera-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Orange-OpenSource","download_url":"https://codeload.github.com/Orange-OpenSource/galera-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253165397,"owners_count":21864428,"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:31.386Z","updated_at":"2025-05-08T23:33:47.035Z","avatar_url":"https://github.com/Orange-OpenSource.png","language":"Go","funding_links":[],"categories":["Repository is obsolete"],"sub_categories":["Awesome Operators in the Wild"],"readme":"# Galera Operator\n\n## Project overview\n\nGalera Operator makes it easy to manage highly-available galera clusters deployed to [Kubernetes](https://kubernetes.io) and automates tasks related to operating a galera cluster.\n\nGalera is a popular, free, open-source, multi-master system for mySQL, MariaDB and Percona XtraDB databases. Galera Operator is tested and build for MariaDB.\n\nToday, Galera Operator can:\n\n* Create and Destroy\n* Resize cluster size (number of nodes in a galera cluster)\n* Resize Containers and Persistent Volumes (Vertical Scalability)\n* Failover\n* Rolling upgrade\n* Backup and Restore\n\nPlease read the full documentation in `./doc/user` to view all features.\n\n## 30 000 ft view\n\n![galera operation design overview](https://raw.githubusercontent.com/Orange-OpenSource/galera-operator/master/doc/images/overview.png)\n\n## Requirements\n* Kubernetes 1.12+\n* MariaDB 10.1.23 for Backup and Restore, only *mariabackup* is currently implemented\n* S3 storage for Backup and Restore, S3 is currently the only object storage implemented\n\nNote: Operator image provided for example purpose are build for Kubernetes 1.15+. If you want to use it on an older Kubernetes you need to rebuild the image\n\n## Features\n\n### Deploy Galera Operator\n\nFirst, we need to deploy new kind of resources used to describe galera cluster and galera backup, note upgrade-config and upgrade-rule is a forthcoming feature used to validate if a cluster can be upgraded:\n\n```bash\n$ kubectl apply -f ./example-manifests/galera-crd/galera-crd.yaml\n$ kubectl apply -f ./example-manifests/galera-crd/galerabackup-crd.yaml\n$ kubectl apply -f ./example-manifests/galera-crd/upgrade-config-crd.yaml\n$ kubectl apply -f ./example-manifests/galera-crd/upgrade-rule-crd.yaml\n```\n\nNow we can create a Kubernetes namespace in order to host Galera Operator.\n\n```bash\n$ kubectl apply -f ./example-manifests/galera-operator/00-namespace.yaml\n```\n\nGalera Operator needs to have some rights on the Kubernetes cluster if RBAC (recommended) is set:\n\n```bash\n$ kubectl apply -f  ./example-manifests/galera-operator/10-operator-sa.yaml\n$ kubectl apply -f  ./example-manifests/galera-operator/20-role.yaml\n$ kubectl apply -f  ./example-manifests/galera-operator/30-role-binding.yaml\n$ kubectl apply -f  ./example-manifests/galera-operator/40-cluster-role.yaml\n$ kubectl apply -f  ./example-manifests/galera-operator/60-cluster-role-binding.yaml\n```\n\nDeploy the operator using a deployment:\n \n```bash\n$ kubectl apply -f  ./example-manifests/galera-operator/70-operator-deployment.yaml\n```\n \nNOTE: do not deploy ./example-manifests/galera-operator/50-cluster-role-clusterwide.yaml, it is only used if you want to deploy the operator to manage galera objects clusterwide, see full documentation for that.\n \nGalera Operator also have some options configured by flags (have a look by starting Galerator Operator with help flag)\n\nFinally if [Prometheus Operator](https://github.com/coreos/prometheus-operator) is deployed, you can use it to collect Galera Operator metrics\n\n```bash\n$ kubectl apply -f  ./example-manifests/galera-monitoring/operator-monitor.yaml\n```\n\n### Managed Galera Cluster\n\nA galera cluster is made of several nodes, each galera node is mapped on a kubernetes pod (be carefull between galera nodes and kubernetes nodes, it is not the same thing). All galera nodes are not the same, labels are set to specify which pod is the galera node for read, write of be the backup.\n\n![managed galera cluster](https://raw.githubusercontent.com/Orange-OpenSource/galera-operator/master/doc/images/galera.png)\n\nWe can find on each pod an initcontainer called bootstrap and a container called galera. Metric container is optional and is used to have metrics collected by external system (as prometheus). On each pod we find a persistant volume claim mapping /var/lib/mysql.\n\nThe backup pod is not the same as other pods, because there is an extra container (backup) and an extra persistant volume claim. Backup container is designed to expose an API to manage restore and backup operation from the operator. This API is missing today as all operations are done through cli.\n\nSpecial pod is used for adding large amount of data on existing cluster (like adding tables). It is designed to be used for a limited time, adding or removing this pod does not change the controller revision used to follow change during the galera cluster lifecycle.\n\nFor a deeper undestanding of galera cluster object, please read `./doc/design/design_overview.md`\n\n### Create Galera Cluster\n\nOnce Galera Operator is deployed, Galera can be deployed. You need to deploy a ConfigMap to specify the my.cnf configuration. Operator will overwrite some parameters or add it if not present. A Secret is used to provide access to Galera Operator to interact with the managed galera cluster.\n\n```bash\n$ kubectl apply -f ./example-manifests/galera-cluster/10-priority-class.yaml\n$ kubectl apply -f ./example-manifests/galera-cluster/20-galera-config.yaml\n$ kubectl apply -f ./example-manifests/galera-cluster/30-galera-secret.yaml\n$ kubectl apply -f ./example-manifests/galera-cluster/40-galera.yaml\n```\n\nIf Prometheus Operator is deployed and if a metric image is provided, you can collect metrics:\n\n```bash\n$ kubectl apply -f  ./example-manifests/galera-monitoring/galera-monitor.yaml\n```\n\n### Resize Galera Cluster\n\nGalera cluster can be resized in different ways:\n\n    1 by changing the number of replicas\n    2 by specifing new resource requirements\n    3 by changing volume claim spec, using different storage classes or a new specifying storage request, for example by changing request resource size\n\nNote that each time a modification on the Galera object is made (except if it is the number of replicas), a controllerRevisions is created.\n\n### Rolling upgrade\n\nSimply specify a new container image, today the rolling upgrade is done if the new version is greater that the current on deployed. Image must follow the [semver](http://semver.org) format, for example \"10.4.5\"\n\nTODO : new CRDs provided to the operator will be used to implement plugins and check if upgrade can be done with the provided my.cnf.\n\n### Backup Galera Cluster    \n\nGalera clusters can be backuped:\n\n```bash\n$ kubectl apply -f ./example-manifests/galera-backup/10-backup-secret.yaml\n$ kubectl apply -f ./example-manifests/galera-backup/20-galera-backup.yaml\n```\n\nNOTE: change $YOURKEY, $YOURSECRET and $YOURENDPOINT to the credentials and url of your S3 solution.\n\n### Restore Galera Cluster        \n\nGalera clusters can be restored (you need to specify the name of the gzip file) :\n\n```bash\n$ kubectl -n galera get gl\nNAME            TIMESTARTED   TIMECOMPLETED   LOCATION                                  METHOD        PROVIDER\ngalera-backup                 14m             gal-galera-backup.20200128172501.sql.gz   mariabackup   S3\n$ kubectl apply -f ./example-manifests/galera-restore/restore-galera.yaml\n```\n\n### Collect Metrics    \n\nIf Prometheus Operator is deployed, collect the metrics by deploying the service monitor:\n\n```bash\n$ kubectl apply -f ./example-manifests/galera-monitoring/galera-monitor.yaml\n```\n\n\n## Building the operator\n\nKubernetes version: 1.13+\n\nThis project uses Go modules to manage its dependencies, so feel free to work from outside of your `GOPATH`. However, if you'd like to continue to work from within your `GOPATH`, please export `GO111MODULE=on`.\n\nk8s.io/kubernetes is not primarily intended to be consumed as a module. Only the published subcomponents are (and go get works properly with those). We need to add require directives for matching versions of all of the subcomponents, rather than using go get. Please read carefully [Installing client-go](https://github.com/kubernetes/client-go/blob/master/INSTALL.md#add-client-go-as-a-dependency%C2%A0for) and have a look to go.mod. To help you find the matchind dependency you can also use `./hack/dependencies.sh`\n\nThis operator use the kubernetes code-generator for:\n  * clientset: used to manipulate objects defined in the CRD (GaleraCluster)\n  * informers: cache for registering to events on objects defined in the CRD\n  * listers\n  * deep copy\n\nTo get code-generator, you need to explicitly git clone the branch matching the kubernetes version to `./vendor/k8s.io/code-generator`\n  \nThe clientset can be generated using the ./hack/update-codegen.sh script or using the makefile codegen.\n\nThe update-codegen script will automatically generate the following files and directories:\n\n    pkg/apis/apigalera/v1beta2/zz_generated.deepcopy.go\n    pkg/client/\n\nThe following code-generators are used:\n\n    deepcopy-gen - creates a method func (t* T) DeepCopy() *T for each type T\n    client-gen - creates typed clientsets for CustomResource APIGroups\n    informer-gen - creates informers for CustomResources which offer an event based interface to react on changes of CustomResources on the server\n    lister-gen - creates listers for CustomResources which offer a read-only caching layer for GET and LIST requests.\n\nChanges should not be made to these files manually, and when creating your own controller based off of this implementation you should not copy these files and instead run the update-codegen script to generate your own.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrange-OpenSource%2Fgalera-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOrange-OpenSource%2Fgalera-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrange-OpenSource%2Fgalera-operator/lists"}