Coder Social home page Coder Social logo

diptochakrabarty / mysqlinstancecontroller Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 21.54 MB

MySQLInstance Controller is a Kubernetes Operator designed to automate the deployment and management of MySQL instances in a Kubernetes cluster.

License: MIT License

Dockerfile 3.47% Makefile 36.23% Go 60.30%
controllers customresourcedefinition database developer devops kubernetes mysql operator

mysqlinstancecontroller's Introduction

MySQLInstanceController

Architecture Image

Project Description

The MySQLInstance Controller is a Kubernetes Operator designed to automate the deployment and management of MySQL instances in a Kubernetes cluster. It simplifies the process of setting up and maintaining MySQL databases with backups , providing a seamless experience for developers and administrators.

Flow of how controller works

show

- Custom Resource Definition (CRD):
The project defines a new custom resource named MySQLInstance. This custom resource allows users to specify the configuration details of their MySQL instances, such as version, storage requirements, and backup preferences.

- Reconciliation Logic:
The core of the Operator is the reconciliation loop, which continuously ensures that the actual state of the system matches the desired state defined in the MySQLInstance custom resource's spec. In each iteration, the Operator compares the current state of the resources with the desired state and takes corrective actions as needed.

- StatefulSet Creation:
When a new MySQLInstance custom resource is created, the Operator generates a StatefulSet manifest based on the specifications provided in the resource's spec. The StatefulSet defines the MySQL pods and their persistent storage.

- Service Creation:
The Operator creates a Service to expose the MySQL pods within the Kubernetes cluster. The Service allows other applications to interact with the MySQL database using the appropriate endpoint and port.

- Secrets Management:
For secure communication with MySQL pods, the Operator creates and manages Kubernetes Secrets containing credentials, such as the MySQL root password. These Secrets are used by the MySQL pods for authentication.

- Backup Scheduler:
The MySQLInstance custom resource allows users to specify whether backups are required for their MySQL instances. If backups are enabled, the Operator sets up a backup schedule using Kubernetes CronJobs.

- Backup Logic:
When the backup schedule is triggered, the Operator orchestrates the backup process for the MySQL instances. It interacts with the MySQL pods, using the credentials from the Secrets, and performs a backup using either mysqldump or a custom backup tool.

What was done on this project

show

- Custom Resource Definition:
A new CRD named MySQLInstance was defined to represent MySQL instances and their configuration, including backup preferences.

- Operator Implementation:
The Operator implementation includes the main reconciliation loop to manage the MySQLInstance resources and create the associated resources (StatefulSet, Service, Secrets, and CronJobs) based on the provided specifications.

- Backup and Secrets Management:
The Operator was designed to interact with MySQL instances and manage backup jobs using Kubernetes CronJobs. It also created and managed Kubernetes Secrets for credentials.

- RBAC and Permissions:
Appropriate RBAC permissions were added to the Operator to ensure it has the required access to manage the necessary resources.

Development of the project

Please view Contributing.md to know the steps required to make your changes

mysqlinstancecontroller's People

Contributors

diptochakrabarty avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

mysqlinstancecontroller's Issues

Creation of PVC and PV to isolate MySQL data

Currently the mysql data in stored within the pod

the mysql statefulset should have a persistent volume attached to it where the mysql data must be saved in case of pod deletion or failure

Deletion of Resources on Custom Resource deletion

currently if a mysqlinstancecontroller resource is deleted the underlying resources like the deployment , service , configmap etc are still present.

These must be removed on deletion of the resource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.