An operator that installs Koor Storage Distro
This operator is equivalent to the following commands:
helm repo add koor-release https://charts.koor.tech/release
helm install --create-namespace --namespace <namespace> <namespace>-rook-ceph koor-release/rook-ceph -f utils/operatorValues.yaml
helm install --create-namespace --namespace <namespace> <namespace>-rook-ceph-cluster \
--set operatorNamespace=<namespace> koor-release/rook-ceph-cluster -f utils/clusterValues.yaml
You’ll need a Kubernetes cluster to run against. You can use minikube to get a local cluster for testing or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e., whatever cluster kubectl cluster-info
shows).
-
Make sure you start minikube with
--insecure-registry="localhost:5000"
. You might need to delete and restart minikube. -
Enable the minikube registry plugin:
minikube addons enable registry
- Redirect port 5000 on docker to port 5000 on the minikube
sudo docker run -d --network=host alpine/socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000
- Set the registry as
localhost:5000
export REGISTRY_HOST=localhost:5000
There are four ways to run the operator:
- As a Go program outside a cluster
- As a Deployment inside a Kubernetes cluster
- Managed by the Operator Lifecycle Manager (OLM) in bundle format
- Using helm
- Generate certificates for local testing:
make local-certs
- Install the CRDs into the cluster:
make install
- Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
make run
NOTE: You can also run this in one step by running: make local-certs install run
To delete the CRDs from the cluster:
make uninstall
- Build and push your image to the registry. If
IMG
is not specified, it defaults to$(REGISTRY_HOST)/koor-operator:v$(VERSION)
:
make docker-build docker-push
- Install
cert-manager
if not already installed:
make cert-manager
- Deploy the controller to the cluster with the image specified by
IMG
:
make deploy
To undeploy the controller from the cluster:
make undeploy
To undeploy cert-manager
from the cluster:
make undeploy-cert-manager
operator-sdk olm install
- Build and push your image to the registry. If
IMG
is not specified, it defaults to$(REGISTRY_HOST)/koor-operator:v$(VERSION)
:
make docker-build docker-push
- Bundle the operator, then build and push the bundle image:
make bundle bundle-build bundle-push
- Run the bundle:
operator-sdk run bundle <some registry>/koor-operator-bundle:v0.0.1
For example, using a local registry, the command becomes:
operator-sdk run bundle localhost:5000/koor-operator-bundle:v0.0.1 --use-http
- Build and push your image to the registry. If
IMG
is not specified, it defaults to$(REGISTRY_HOST)/koor-operator:v$(VERSION)
:
make docker-build docker-push
- Install the helm chart to the cluster. Create a
values.yaml
file if necessary.
helm install koor-operator --namespace koor-operator --create-namespace charts/koor-operator
To undeploy the controller from the cluster:
helm uninstall koor-operator --namespace koor-operator
When deploying the operator locally, as a deployment, or using the OLM, you need to create a KoorCluster custom resource. To do that, update the samples in config/samples/...
to fit your needs, then create the Custom Resource:
kubectl apply -f config/samples/storage_v1alpha1_koorcluster.yaml
// TODO(user): Add detailed information on how you would like others to contribute to this project
This project aims to follow the Kubernetes Operator pattern
It uses Controllers, which provide a reconcile function responsible for synchronizing resources until the cluster reaches the desired state.
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make --help
for more information on all potential make
targets
More information can be found via the Kubebuilder Documentation
Copyright 2023 Koor Technologies, Inc. All rights reserved.
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
https://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.