- Ramp up on kubernetes and CRDs
- Create a GitHub account
- Setup GitHub access via SSH
- Create and checkout a repo fork
- Install requirements
- Set up a Kubernetes cluster
- Set up your shell environment
- Configure kubectl to use your cluster
- Install Shipwright Build in your cluster
Welcome to the project!! You may find these resources helpful to ramp up on some
of the technology this project is built on. This project extends Kubernetes (aka
k8s
) with Custom Resource Definitions (CRDs). To find out more:
- The Kubernetes docs on Custom Resources - These will orient you on what words like "Resource" and "Controller" concretely mean
- Understanding Kubernetes objects - This will further solidify k8s nomenclature
- API conventions - Types(kinds) - Another useful set of words describing words. "Objects" and "Lists" in k8s land
- Extend the Kubernetes API with CustomResourceDefinitions- A tutorial demonstrating how a Custom Resource Definition can be added to Kubernetes without anything actually "happening" beyond being able to list Objects of that kind
At this point, you may find it useful to return to these Shipwright Build
docs:
- Shipwright Build - Some of the terms here may make more sense!
- Install via getting started for development
- Shipwright Build overview and tutorial -
Define
BuildStrategies
,Builds
, andBuildRuns
, see what happens when they are run
The Go tools require that you clone the repository to the
src/github.com/shipwright-io/build
directory in your
GOPATH
.
To check out this repository:
- Create your own fork of this repo
- Clone it to your machine:
mkdir -p ${GOPATH}/src/github.com/shipwright-io
cd ${GOPATH}/src/github.com/shipwright-io
git clone [email protected]:${YOUR_GITHUB_USERNAME}/build.git
cd build
git remote add upstream [email protected]:shipwright-io/build.git
git remote set-url --push upstream no_push
Adding the upstream
remote sets you up nicely for regularly
syncing your fork.
You must install these tools:
go
: The language Shipwright Build is built ingit
: For source control 1ko
: To build and deploy changes.kubectl
: For interacting with your kube cluster
- Follow the instructions in the Kubernetes doc to Set up a kubernetes cluster
- Set up a container image repository for pushing images. Any container image registry that is accessible to your cluster can be used for your repository. This can be a public registry like Docker Hub, quay.io, or a container registry runs by your cloud provider
Note: We support Kubernetes version 1.27 to 1.29. 1 cluster worker node for basic usage, 2+ cluster worker nodes for HA
To run your controller, you'll need to set these environment variables (we recommend adding them to your .bashrc
):
GOPATH
: If you don't have one, simply pick a directory and addexport GOPATH=...
$GOPATH/bin
onPATH
: This is so that tooling installed viago get
will work properly.
.bashrc
example:
export GOPATH="$HOME/go"
export PATH="${PATH}:${GOPATH}/bin"
Make sure to configure authentication if required. To be able to push images to the container registry, you need to run this once:
ko login [OPTIONS] [SERVER]
Note: This is roughly equivalent to docker login
.
The following set of steps highlight how to deploy a Build controller pod into an existing Kubernetes cluster.
-
Target your Kubernetes cluster and install the Shipwright Build. Run this from the root of the source repo:
./hack/install-tekton.sh
-
Set your
KO_DOCKER_REPO
environment variable. This will be the container image registry you push to, orkind.local
if you're using KinD. -
Build and deploy the controller from source, from within the root of the repo:
ko apply -P -R -f deploy/
The above steps give you a running Build controller that executes the code from your current branch.
As you make changes to the code, you can redeploy your controller with:
ko apply -P -R -f deploy/
You may use the following command to re-generate CRDs of build and buildrun if you change their spec:
make generate
You can clean up everything with:
kubectl delete -R -f deploy/
To look at the controller logs, run:
kubectl -n shipwright-build logs $(kubectl -n shipwright-build get pods -l name=shipwright-build-controller -o name)