{"id":13821041,"url":"https://github.com/geerlingguy/mariadb-operator","last_synced_at":"2025-03-17T16:32:12.908Z","repository":{"id":48327113,"uuid":"213716525","full_name":"geerlingguy/mariadb-operator","owner":"geerlingguy","description":"MariaDB operator for Kubernetes built with Ansible and the Operator SDK.","archived":false,"fork":false,"pushed_at":"2023-07-10T23:07:11.000Z","size":38,"stargazers_count":32,"open_issues_count":5,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-10T04:06:17.888Z","etag":null,"topics":["ansible","database","k8s","kubernetes","mariadb","operator","operator-sdk","rdbms"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"geerlingguy","patreon":"geerlingguy"}},"created_at":"2019-10-08T18:09:17.000Z","updated_at":"2024-08-29T21:22:55.000Z","dependencies_parsed_at":"2024-05-28T18:21:29.387Z","dependency_job_id":"87a3e338-88c7-4b9e-9af3-d20298d8692e","html_url":"https://github.com/geerlingguy/mariadb-operator","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.040000000000000036","last_synced_commit":"d481198152888e359668d5a9b04720db446cae33"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fmariadb-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fmariadb-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fmariadb-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fmariadb-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/mariadb-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221697032,"owners_count":16865531,"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":["ansible","database","k8s","kubernetes","mariadb","operator","operator-sdk","rdbms"],"created_at":"2024-08-04T08:01:14.229Z","updated_at":"2024-10-27T15:18:24.520Z","avatar_url":"https://github.com/geerlingguy.png","language":"Jinja","funding_links":["https://github.com/sponsors/geerlingguy","https://patreon.com/geerlingguy"],"categories":["kubernetes"],"sub_categories":[],"readme":"# MariaDB Operator for Kubernetes\n\n[![Build Status](https://travis-ci.com/geerlingguy/mariadb-operator.svg?branch=master)](https://travis-ci.com/geerlingguy/mariadb-operator)\n\nThis is a MariaDB Operator, which makes management of MariaDB instances (or clusters) running inside Kubernetes clusters easy. It was built with the [Operator SDK](https://github.com/operator-framework/operator-sdk) using [Ansible](https://www.ansible.com/blog/ansible-operator).\n\n## Usage\n\nThis Kubernetes Operator is meant to be deployed in your Kubernetes cluster(s) and can manage one or more MariaDB database instances or clusters in any namespace.\n\nFirst you need to deploy MariaDB Operator into your cluster:\n\n    kubectl apply -f https://raw.githubusercontent.com/geerlingguy/mariadb-operator/master/deploy/mariadb-operator.yaml\n\nThen you can create instances of MariaDB in any namespace, for example:\n\n  1. Create a file named `my-database.yml` with the following contents:\n\n     ```\n     ---\n     apiVersion: mariadb.mariadb.com/v1alpha1\n     kind: MariaDB\n     metadata:\n       name: example-mariadb\n       namespace: example-mariadb\n     spec:\n       masters: 1\n       replicas: 0\n       mariadb_password: CHANGEME\n       mariadb_image: mariadb:10.4\n       mariadb_pvc_storage_request: 1Gi\n     ```\n\n  2. Use `kubectl` to create the MariaDB instance in your cluster:\n\n     ```\n     kubectl apply -f my-database.yml\n     ```\n\n\u003e You can also deploy `MariaDB` instances into other namespaces by changing `metadata.namespace`, or deploy multiple `MariaDB` instances into the same namespace by changing `metadata.name`.\n\n### Connecting to the running database\n\nOnce the database instance has been deployed and initialized (this can take up to a few minutes), you can connect to it using the MySQL CLI from within the same namespace as your database instance, for example:\n\n    kubectl -n example-mariadb run -it --rm mysql-client --image=arey/mysql-client --restart=Never -- -h example-mariadb-0.example-mariadb.example-mariadb.svc.cluster.local -u db_user -pCHANGEME -D db\n\nOther applications can connect to the database instance from within the same namespace using the following connection parameters:\n\n  - Host: `example-mariadb-0.example-mariadb.example-mariadb.svc.cluster.local`\n  - Username: `db_user`\n  - Password: `CHANGEME`\n  - Database: `db`\n\n### Exposing an instance to the outside world\n\nYou can also expose a database instance to the outside world by adding a `Service` to connect to port `3360`:\n\n    ---\n    apiVersion: v1\n    kind: Service\n    metadata:\n      name: mariadb-master\n      namespace: example-mariadb\n    spec:\n      type: NodePort\n      selector:\n        statefulset.kubernetes.io/example-mariadb: example-mariadb-0\n      ports:\n      - protocol: TCP\n        port: 3360\n        targetPort: 3360\n\nOnce you create that service in the same namespace, you can connect to MariaDB via the NodePort assigned to the service.\n\n## Development\n\n### Release Process\n\nThere are a few moving parts to this project:\n\n  1. The Docker image which powers MariaDB Operator.\n  2. The `mariadb-operator.yaml` Kubernetes manifest file which initially deploys the Operator into a cluster.\n\nEach of these must be appropriately built in preparation for a new tag:\n\n#### Build a new release of the Operator for Docker Hub\n\nRun the following command inside this directory:\n\n    operator-sdk build geerlingguy/mariadb-operator:0.0.3\n\nThen push the generated image to Docker Hub:\n\n    docker push geerlingguy/mariadb-operator:0.0.3\n\n#### Build a new version of the `mariadb-operator.yaml` file\n\nVerify the `build/chain-operator-files.yml` playbook has the most recent version/tag of the Docker image, then run the playbook in the `build/` directory:\n\n    ansible-playbook chain-operator-files.yml\n\nAfter it is built, test it on a local cluster:\n\n    minikube start\n    minikube addons enable ingress\n    kubectl apply -f deploy/mariadb-operator.yaml\n    kubectl create namespace example-mariadb\n    kubectl apply -f deploy/crds/mariadb_v1alpha1_mariadb_cr.yaml\n    \u003ctest everything\u003e\n    minikube delete\n\nIf everything is deployed correctly, commit the updated version and push it up to GitHub, tagging a new repository release with the same tag as the Docker image.\n\n### Testing\n\n#### Local tests with Molecule and KIND\n\nEnsure you have the testing dependencies installed (in addition to Docker):\n\n    pip install docker molecule openshift jmespath\n\nRun the local molecule test scenario:\n\n    molecule test -s test-local\n\n#### Local tests with minikube\n\nTODO.\n\n## Authors\n\nThis operator is maintained by [Jeff Geerling](https://www.jeffgeerling.com), author of [Ansible for DevOps](https://www.ansiblefordevops.com) and [Ansible for Kubernetes](https://www.ansibleforkubernetes.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fmariadb-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Fmariadb-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fmariadb-operator/lists"}