Porch DB Repo
A tutorial show how to use Porch DB repos
If you change the API resources, in api/porch/.../*.go
, update the generated code by running:
make generate
Porch comprises of several software components:
Repository
and PackageRevision
custom resources.main
functionRepository
CRD. No controller;
Porch apiserver watches these resources for changes as repositories are (un-)registered.See dedicated documentation on running Porch:
Build Docker images of Porch components:
# Build Images
make build-images
# Push Images to Docker Registry
make push-images
# Supported make variables:
# IMAGE_TAG - image tag, i.e. 'latest' (defaults to 'latest')
# GCP_PROJECT_ID - GCP project hosting gcr.io repository (will translate to gcr.io/${GCP_PROJECT_ID})
# IMAGE_REPO - overwrites the default image repository
# Example:
IMAGE_TAG=$(git rev-parse --short HEAD) make push-images
Follow the Running Porch Locally guide to run Porch locally.
To debug Porch, run Porch locally running-locally.md, exit porch server running in the shell, and launch Porch under the debugger. VSCode debug session is pre-configured in launch.json.
Update the launch arguments to your needs.
Some useful code pointers:
All tests can be run using make test
. Individual tests can be run using go test
.
End-to-End tests assume that Porch instance is running and KUBECONFIG
is configured
with the instance. The tests will automatically detect whether they are running against
Porch running on local machien or k8s cluster and will start Git server appropriately,
then run test suite against the Porch instance.
make generate
: generate code based on Porch API definitions (runs k8s code generators)make tidy
: tidies all Porch modulesmake fmt
: formats golang sourcesmake build-images
: builds Porch Docker imagesmake push-images
: builds and pushes Porch Docker imagesmake deployment-config
: customizes configuration which installs Porch
in k8s cluster with correct image names, annotations, service accounts.
The deployment-ready configuration is copied into ./.build/deploy
make deploy
: deploys Porch in the k8s cluster configured with current kubectl contextmake push-and-deploy
: builds, pushes Porch Docker images, creates deployment configuration, and deploys Porchmake
or make all
: builds and runs Porch
locallymake test
: runs testsVSCode works really well for editing and debugging. Just open VSCode from the root folder of the Porch repository and it will work fine. The folder contains the needed configuration to Launch different functions of Proch.
A tutorial show how to use Porch DB repos