We use kubebuilder to scaffold the kubernetes controllers. The Kubebuilder Book is a good introduction to the topic and we recommend reading it before proceeding.
Please install kubebuilder 3.15.1
before upgrading or adding new Custom Resources:
asdf plugin-add kubebuilder https://github.com/virtualstaticvoid/asdf-kubebuilder.git
asdf install kubebuilder 3.15.1
Note that we currently need to use kubebuilder version 3 or below, as work is required to support later versions.
Install Go by following the instructions on the website.
We use asdf to set up the development environment. Install it it following the Getting Started Guide. Install all tool versions as follows:
asdf install
Many commands in this guide will run against your current kubernetes context; make sure that it is set accordingly. Minikube provides a local Kubernetes cluster ideal for development.
make test
Note: on first execution, the test environment will get downloaded and the command will therefore take longer to complete.
Build the operator's container images as follows:
make docker-build docker-build-argo
Push to the container registry:
CONTAINER_REPOSITORIES=<YOUR_CONTAINER_REPOSITORY> make docker-push docker-push-argo
For example, to push to Google Artifact Registry:
CONTAINER_REPOSITORIES=europe-docker.pkg.dev/<PROJECT_NAME>/images make docker-push docker-push-argo
Build the Helm chart as follows:
make helm-package
Push the Helm chart using one of the following options:
- OCI Image
HELM_REPOSITORIES=oci://<YOUR_CHART_REPOSITORY> make helm-publish
For example, to push to Google Artifact Registry::
HELM_REPOSITORIES=oci://europe-docker.pkg.dev/<PROJECT_NAME>/charts make helm-publish
.tar.gz
archive
HELM_REPOSITORIES=https://<YOUR_CHART_REPOSITORY> NETRC_FILE=<YOUR_NETRC_FILE> make helm-publish
Provide an optional .netrc file for credentials:
Configure the controller to your environment in controller_manager_config.yaml replacing the placeholders (see docs).
Next install Custom Resource Definitions and run the controller:
make install
make run
CRDs will be installed into an existing Kubernetes cluster. A running instance of Kubeflow is required on that cluster. The controller will run locally, interacting with the remote Kubernetes API.
Please refer to the quickstart tutorial for instructions on creating a sample pipeline resource.
To run integration tests, we currently require a one-off setup of the Kubernetes cluster:
make integration-test-up
You can now run the integration tests as follows (this can take several minutes to complete):
make integration-test
Finally, bring down the environment after your tests:
make integration-test-down
Running make minikube-up NAME=provider
(set provider
to the name of your chosen provider e.g. NAME=vai
) will spin up a local K8s cluster with the operator deployed along with your chosen provider.
You can optionally perform additional provider setup and teardown steps by including a provider-setup.sh
and provider-teardown.sh
script.
We use the zap implementation of logr via the zapr module.
Verbosity levels are set according to the following rules:
Zap Level | Description | Example |
---|---|---|
0, error , info |
Will always be logged. Appropriate for all major actions. | state transitions, errors |
1, debug |
Appropriate for high-level technical information. | resource creation/update/deletion |
2 | Appropriate for low-level technical information. | resource retrieval, finalizers, profiling, expected errors |
3 | Appropriate for verbose debug statements. | printing resources |