title |
---|
Installation & development |
Follow these steps to install Helm Broker locally.
NOTE: For non-local installation, use Kubernetes v1.15.
To run Helm Broker, you need a Kubernetes cluster with Service Catalog. Run the ./hack/run-dev-kind.sh
script, or follow these steps to set up Helm Broker on Kind with all necessary dependencies:
- Create a local cluster on Kind:
kind create cluster
- Install Service Catalog as a Helm chart:
helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog
helm install catalog svc-cat/catalog --namespace catalog --set asyncBindingOperationsEnabled=true --wait --create-namespace
- Clone the Helm Broker repository:
git clone git@github.com:kyma-project/helm-broker.git
- Install the Helm Broker chart from the cloned repository:
helm install helm-broker charts/helm-broker --namespace helm-broker --create-namespace
Follow these steps to run Helm Broker without building a binary file:
- Start Minikube:
minikube start
- Create necessary CRDs:
kubectl apply -f config/crds/
- Start etcd in the Docker container:
docker run \
-p 2379:2379 \
-p 2380:2380 \
-d \
quay.io/coreos/etcd:v3.3 \
/usr/local/bin/etcd \
--data-dir /etcd-data \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380
- Start the Broker component:
APP_KUBECONFIG_PATH=/Users/$User/.kube/config \
APP_CONFIG_FILE_NAME=hack/examples/local-etcd-config.yaml \
go run cmd/broker/main.go
Now you can test the Broker using the /v2/catalog endpoint:
curl -H "X-Broker-API-Version: 2.13" localhost:8080/cluster/v2/catalog
- Start the Controller component:
APP_KUBECONFIG_PATH=/Users/$User/.kube/config \
APP_DOCUMENTATION_ENABLED=false \
APP_TMP_DIR=/tmp APP_NAMESPACE=default \
APP_SERVICE_NAME=helm-broker \
APP_CONFIG_FILE_NAME=hack/examples/local-etcd-config.yaml \
APP_CLUSTER_SERVICE_BROKER_NAME=helm-broker \
APP_DEVELOP_MODE=true \
go run cmd/controller/main.go -metrics-addr ":8081"
NOTE: Not all features are available when you run Helm Broker locally. All features that perform actions with Tiller do not work. Moreover, the Controller performs operations on ClusterServiceBroker/ServiceBroker resources, which needs Service Catalog to work properly.
You can run the Controller and the Broker configured with the in-memory storage, but then the Broker cannot read data stored by the Controller. To run the Broker and the Controller without etcd, run these commands:
APP_KUBECONFIG_PATH=/Users/$User/.kube/config \
APP_CONFIG_FILE_NAME=hack/examples/minimal-config.yaml \
APP_NAMESPACE=kyma-system go run cmd/broker/main.go
APP_KUBECONFIG_PATH=/Users/$User/.kube/config \
APP_DOCUMENTATION_ENABLED=false \
APP_TMP_DIR=/tmp APP_NAMESPACE=default \
APP_SERVICE_NAME=helm-broker \
APP_CONFIG_FILE_NAME=hack/examples/minimal-config.yaml \
APP_CLUSTER_SERVICE_BROKER_NAME=helm-broker \
APP_DEVELOP_MODE=true \
go run cmd/controller/main.go -metrics-addr ":8081"
Follow these steps to develop the project.
NOTE: The versions of Go and Dep are compliant with the
buildpack
used by Prow.
Before each commit, use the before-commit.sh
script. The script runs unit tests that check your changes and build binaries.
You can also run integration tests that check if all parts of Helm Broker work together.
These are the prerequisites for integration tests:
- Kubebuilder 1.0.8
- Etcd 3.4
- Minio RELEASE.2019-10-12T01-39-57Z
Run integration tests using this command:
make integration-test
To change the chart's tags version, run this command:
make VERSION=v0.0.1 DIR=/pr tag-chart-images
This command overrides the images tag in the charts/helm-broker/values.yaml
file to:
eu.gcr.io/kyma-project/helm-broker/pr:v0.0.1
If you want to build Docker images with your changes and push them to a registry, follow these steps:
- Run tests and build binaries:
make build
- Build Docker images:
make build-image
- Configure environment variables pointing to your registry, for example:
export DOCKER_PUSH_REPOSITORY=eu.gcr.io/
export DOCKER_PUSH_DIRECTORY=your-project
export DOCKER_TAG=latest
- Push the image to the registry:
make push-image
- Install Helm Broker with your custom image using the following command:
helm install charts/helm-broker \
--name helm-broker \
--namespace helm-broker \
--set global.helm_broker.image="${DOCKER_PUSH_REPOSITORY}${DOCKER_PUSH_DIRECTORY}/helm-broker" \
--set global.helm_broker.version=${DOCKER_TAG} \
--set global.helm_controller.image="${DOCKER_PUSH_REPOSITORY}${DOCKER_PUSH_DIRECTORY}/helm-controller" \
--set global.helm_controller.version=${DOCKER_TAG}
If you already have Helm Broker installed, you can upgrade it to use new images:
helm upgrade helm-broker charts/helm-broker \
--set global.helm_broker.image="${DOCKER_PUSH_REPOSITORY}${DOCKER_PUSH_DIRECTORY}/helm-broker" \
--set global.helm_broker.version=${DOCKER_TAG} \
--set global.helm_controller.image="${DOCKER_PUSH_REPOSITORY}${DOCKER_PUSH_DIRECTORY}/helm-controller" \
--set global.helm_controller.version=${DOCKER_TAG}