Skip to content

microsoft/arc-sql-mi-db-operator

Repository files navigation

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 and Kubebuilder

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.

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.

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.

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.

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.

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:

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. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com 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. 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.

About

Control Arc SQL MI databases using kubectl

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •