Coder Social home page Coder Social logo

arc-sql-mi-db-operator's Introduction

# Azure MS SQl Operator

This is a K8S operator to interact with MS SQL Managed Instance

## TL;DR

This project was genereated using [Red Hat's Operator SDK](https://sdk.operatorframework.io/) and [Kubebuilder](https://book.kubebuilder.io/introduction.html)

You can use the `make` file to handle most use cases including `building, deploying and building docker image`

Check out the `config` directory for the manifests generated and the `config/samples` directory for a sample of the `CRD`.

## Building

### Building the Operator

To build the `arc-sql-mi-db-operator` you can use the `make docker-build` command.  This command uses the `make` variable `IMG` to tag the image.  I recommend explicitly setting this variable when building the image.

```bash
make docker-build IMG=azure-sql-mi:v0.1.0
```

### Building the Sync Image

To build the `sync` image you can use the `make docker-sync-build` command.  This command makes use of a few `make` variables.  Like building the operator, you can explicitly set the `SYNC_IMG`.  However, `SYNC_IMG` is a concatenation of several variables in the following form:

`SYNC_IMG ?= $(REPO)/sync:v$(SYNC_VERSION)`

Each variable can be set or a combination of using the default and explicitly setting the variable.

```bash
make docker-sync-build REPO=mcr.microsoft.io
```

## Publishing

### Publishing the Operator

To publish the `arc-sql-mi-db-operator` you can use the `make docker-push` command.  This command uses the `make` variable `IMG` to push the image.  I recommend explicitly setting this variable as it needs to match what was used to build the image.

```bash
make docker-push IMG=azure-sql-mi:v0.1.0
```

### Publishing the Sync Image

To publish the `sync` you can use the `make docker-sync-push` command.  This command uses the `make` variable `SYNC_IMG` to push the image.  I recommend explicitly setting this variable as it needs to match what was used to build the image.

```bash
make docker-sync-push SYNC_IMG=mcr.microsoft.io/sycn:v0.1.0
```

## Deploying Operator

To deploy the operator into your `K8S` environment you can use the `make deploy`.  This command uses the `make` variable `IMG`.  I recommend explicitly setting this variable as it needs to match what was used to publish the image.

```bash
make deploy IMG=azure-sql-mi:v0.1.0
```

This command also deploys all the necessary `K8S` manifest files located in the `config` directory.  It includes the `RBAC` related manifests, and the `CRD` of database controller.

Keep in mind that you need to have `KUBECONFIG` set or at a minimum an active configuration for this process to complete successfully.

## Create the Database

This is accomplished by applying the `Database` manifest using `kubectl`.  Here is an example manifest:

```yaml
apiVersion: sqlmi.arc-sql-mi.microsoft.io/v1alpha1
kind: Database
metadata:
  name: database-sample
spec:
  name: MyDatabase1
  sqlManagedInstance: jumpstart-sql
  collation: SQL_Latin1_General_CP1_CS_AS # optional
  parameterization: forced # optional, options:[simple, forced]
  allowSnapshotIsolation: true # optional
  allowReadCommittedSnapshot: false # optional
  compatibilityLevel: 160 # optional
  schedule: "*/1 * * * *" # optional
```

## Contributing

This project welcomes contributions and suggestions.  Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 
trademarks or logos is subject to and must follow 
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.

arc-sql-mi-db-operator's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

arc-sql-mi-db-operator's Issues

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.