Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 3.12 KB

assetsvc.md

File metadata and controls

88 lines (58 loc) · 3.12 KB

Kubeapps assetsvc Developer Guide

The assetsvc component is a micro-service that creates an API endpoint for accessing the metadata for charts in Helm chart repositories that's populated in a MongoDB server.

Prerequisites

Environment

export GOPATH=~/gopath
export PATH=$GOPATH/bin:$PATH
export KUBEAPPS_DIR=$GOPATH/src/github.com/kubeapps/kubeapps

Download the Kubeapps source code

git clone https://github.com/kubeapps/kubeapps $KUBEAPPS_DIR

The assetsvc sources are located under the cmd/assetsvc/ directory.

Install Kubeapps in your cluster

Kubeapps is a Kubernetes-native application. To develop and test Kubeapps components we need a Kubernetes cluster with Kubeapps already installed. Follow the Kubeapps installation guide to install Kubeapps in your cluster.

Building the assetsvc image

cd $KUBEAPPS_DIR
make kubeapps/assetsvc

This builds the assetsvc Docker image.

Running in development

Option 1: Using Telepresence (recommended)

When using MongoDB:

telepresence --swap-deployment kubeapps-internal-assetsvc --namespace kubeapps --expose 8080:8080 --docker-run --rm -ti kubeapps/assetsvc /assetsvc --database-user=root --database-url=kubeapps-mongodb --database-type=mongodb --database-name=charts

When using PostgreSQL:

telepresence --swap-deployment kubeapps-internal-assetsvc --namespace kubeapps --expose 8080:8080 --docker-run --rm -ti kubeapps/assetsvc /assetsvc --database-user=postgres --database-url=kubeapps-postgresql:5432 --database-type=postgresql --database-name=assets

Note that the assetsvc should be rebuilt for new changes to take effect.

Option 2: Replacing the image in the assetsvc Deployment

Note: By default, Kubeapps will try to fetch the latest version of the image so in order to make this workflow work in Minikube you will need to update the imagePullPolicy first:

kubectl patch deployment kubeapps-internal-assetsvc -n kubeapps --type=json -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "IfNotPresent"}]'
kubectl set image -n kubeapps deployment kubeapps-internal-assetsvc assetsvc=kubeapps/assetsvc:latest

For further redeploys you can change the version to deploy a different tag or rebuild the same image and restart the pod executing:

kubectl delete pod -n kubeapps -l app=kubeapps-internal-assetsvc

Note: If you using a cloud provider to develop the service you will need to retag the image and push it to a public registry.

Running tests

You can run the assetsvc tests along with the tests for the Kubeapps project:

go test -v ./...