Helm

This guide explains how to run the deps.cloud infrastructure within a Kubernetes cluster using the Helm package manager.

Prerequisites

  1. A working Kubernetes cluster. To follow along with this guide, you should set up Minikube on your machine. Minikube provides a great way to test and experiment around with Kubernetes locally.
  2. The kubectl binary should be installed and in your path on your workstation.
  3. The helm binary should be installed and in your path on your workstation.

1 - Adding the Helm Repository

In order to leverage the deps.cloud Helm charts, you first need to add the deps.cloud stable repository.

$ helm repo add depscloud https://depscloud.github.io/deploy/charts
"depscloud" has been added to your repositories

$ helm repo update

2 - Deploy the deps.cloud Infrastructure

Once the deps.cloud chart repository has been added, you can install the charts as follows.

$ kubectl create ns depscloud
namespace/depscloud created

$ helm upgrade -n depscloud -i depscloud depscloud/depscloud
Release "depscloud" does not exist. Installing it now.
NAME: depscloud
LAST DEPLOYED: Sat Jun 20 16:50:57 2020
NAMESPACE: depscloud
STATUS: deployed
REVISION: 1
TEST SUITE: None

This same command can be used to upgrade the system in the future.

3 - Querying the deps.cloud Infrastructure

Once all processes have completed and are healthy, you should be able to interact with the API pretty easily. Note that there will be no data in the API until the indexer process has run. To quickly test this, you can port forward the depscloud-gateway service.

$ kubectl port-forward -n depscloud svc/depscloud-gateway 8080:80
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080

Once the port is forwarded, the following endpoints should be able to be reached.

4 - Configuring using values.yaml

A values.yaml file can be used to maintain deployment specific configuration. The content below provides an example of how to configure the indexer to crawl the depscloud account.

# contents of values.yaml
indexer:
  config:
    accounts:
      - github:
          clone:
            strategy: HTTP
          organizations:
            - depscloud

tracker:
  storage:
    driver: sqlite|mysql|postgres
    address: ""
    readOnlyAddress: ""

Then during install, you can pass in the values.yaml file.

$ helm upgrade -n depscloud -i depscloud depscloud/depscloud -f values.yaml

5 - Optional Installments

The following are optional considerations. You do not need to install them to run the system, but can make managing it easier.

Ingress

By using an ingress address and controller, you can easily expose the REST API.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  namespace: depscloud
  name: depscloud
spec:
  rules:
  - host: depscloud.internal.company.net
    http:
      paths:
      - path: /
        backend:
          serviceName: depscloud-gateway
          servicePort: 80

Using helm-operator

The helm-operator provided by fluxcd is an extremely powerful resource. If provides a way to manage Helm releases within a cluster through custom resource definitions.

apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  namespace: depscloud
  name: depscloud
spec:
  releaseName: depscloud
  chart:
    repository: https://depscloud.github.io/deploy/charts
    name: depscloud
  values:
    indexer:
      schedule: "@daily"
      config:
        accounts:
          - github:
              clone:
                strategy: HTTP
              organizations:
                - depscloud

Last modified October 26, 2020: darken up lines (141fe72)