Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Latest commit

 

History

History
198 lines (156 loc) · 6.08 KB

01-installation.md

File metadata and controls

198 lines (156 loc) · 6.08 KB
title
Installation & development

Follow these steps to install Helm Broker locally.

Prerequisites

NOTE: For non-local installation, use Kubernetes v1.15.

Install Helm Broker with Service Catalog

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:

  1. Create a local cluster on Kind:
kind create cluster
  1. 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
  1. Clone the Helm Broker repository:
git clone [email protected]:kyma-project/helm-broker.git
  1. Install the Helm Broker chart from the cloned repository:
helm install helm-broker charts/helm-broker --namespace helm-broker --create-namespace

Install Helm Broker as a standalone component

Follow these steps to run Helm Broker without building a binary file:

  1. Start Minikube:
minikube start
  1. Create necessary CRDs:
kubectl apply -f config/crds/
  1. 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
  1. 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
  1. 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"

Development

Follow these steps to develop the project.

Prerequisites

NOTE: The versions of Go and Dep are compliant with the buildpack used by Prow.

Run tests

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:

Run integration tests using this command:

make integration-test

Update chart's images tag

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

Build Docker images

If you want to build Docker images with your changes and push them to a registry, follow these steps:

  1. Run tests and build binaries:
make build
  1. Build Docker images:
make build-image
  1. 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
  1. Push the image to the registry:
make push-image
  1. 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}