- Ensure you have access to a Kubernetes cluster via
kubectl
with cluster admin permissions. - Install Go version 1.20 or higher.
Run make build
to compile the operator binary.
The resulting binary will be saved to bin/operator
.
To build the container image for local use, run make container-push IMAGE_REPO=ko.local
.
This will do the following:
- Compile the application.
- Create a container image.
- Push the container image to your local Docker daemon, with the ref
ko.local/operator:<TAG>
.
The following make options can be set:
-
IMAGE_REPO
- defaults toghcr.io/shipwright-io/operator
. The following special repositories can be used for testing:ko.local
- this pushes the image to the local Docker daemon.kind.local
- pushes to a local KinD cluster.
-
VERSION
- defaults to the current version of Shipwright. This must be a valid semantic version, and will be used as the tag for the resulting image.
Refer to the ko documentation for more information.
To test the operator on a Kubernetes cluster, you first must have the following:
- Access to a Kubernetes cluster v1.20 or higher, with cluster admin permissions.
- Install Tekton operator v0.50 or higher on the cluster.
$ export KUBECONFIG=/path/to/kubeconfig
$ kubectl apply -f https://github.com/tektoncd/pipeline/releases/download/v0.21.0/release.notags.yaml
If pushing to an external image registry, you may need to provide credentials to ko:
$ make ko
$ ko login <IMAGE_REGISTRY> -u <USERNAME> -p <PASSWORD>
Next, use the make deploy
command with appropriate IMAGE_REPO
and VERSION
arguments to deploy the operator to the cluster.
$ make deploy IMAGE_REPO="<IMAGE_REGISTRY>/<USERNAME>" VERSION="<VERSION>"
Note:
Scripts in hack
folder may require sed
(GNU), therefore in platforms other than Linux you may have it with a different name. For instance, on macOS it's usually named gsed
, in this case provide the SED_BIN
make variable with the alternative name.
$ make build SED_BIN=gsed ...