do-operator
: The Kubernetes Operator for DigitalOceando-operator
is a Kubernetes operator for managing and consuming DigitalOcean resources from a Kubernetes cluster.
Currently it supports DigitalOcean Managed Databases.
This project is in BETA.
v1alpha1
and may change in the future.If you have already enabled do-operator
by clicking Add database operator
button from cloud control panel UI while creating your DOKS
cluster, please DO NOT
install it again.
To install the operator on a Kubernetes cluster, you can follow these steps:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml
releases/
directory. Find the do-operator-do-api-token
Secret and replace the access-token
value with your base64-encoded token:
apiVersion: v1
data:
access-token: <your base64-encoded token goes here>
kind: Secret
metadata:
name: do-operator-do-api-token
namespace: do-operator-system
type: Opaque
kubectl apply -f releases/do-operator-<version>.yaml
See the full documentation in the docs directory.
The do-operator
is built using kubebuilder.
The Kubebuilder Book is a useful reference for understanding how the pieces fit together.
To test your changes you will need a Kubernetes cluster to run against.
We suggest using DigitalOcean Kubernetes, but you may use KIND or any other cluster for testing.
The following will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
Note that you will be billed for any DigitalOcean resources you create via the operator while testing. Make sure you are aware of DigitalOcean's pricing and clean up resources when you're finished testing.
make install
Note M1 Macbook users: this project is made with Kubebuilder which uses Kustomize v3.8.7
which doesn't have an ARM release and so you need to manually install kustomize for this step to succeed
IMG
(in the Makefile):make docker-build docker-push IMG=<some-registry>/do-operator:tag
Deploy cert-manager, which is necessary to manage certificates for the webhooks.
Generate a DigitalOcean API token to use for testing.
Create a local environment file containing your API token. Note that this file is in the .gitignore
so it will remain local to your machine:
cat <<EOF > config/manager/do-api-token.env
access-token=<your api token here>
EOF
The contents of this file will be used to create a secret in the cluster, which is used by the operator deployment to manage resources in your DigitalOcean account.
IMG
:make deploy IMG=<some-registry>/do-operator:tag
To undeploy the controller from the cluster:
make undeploy
To delete the CRDs from the cluster:
make uninstall
v3.5.7
branch: git checkout kustomize/v3.8.7
kustomize
folder (so from the project root it would be kustomize/kustomize/
)go build .
kustomize
binary into the bin
directory in this project (create it if it doesn't exist mkdir bin
): mv kustomize <project path>/bin/kustomize
go get -u ./...
go mod tidy
go mod vendor
make test
IMG_TAG=vX.Y.Z make release-manifests
release
GitHub action workflow
At DigitalOcean we value and love our community! If you have any issues or would like to contribute, see CONTRIBUTING.md.
Copyright 2022 DigitalOcean.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.