Skip to content

Commit 9c8224e

Browse files
authored
Add Sourcebot Helm Chart (#370)
* feat: add helm chart Signed-off-by: Andre Nogueira <[email protected]> * feat: add sts support to use internal DB and improve values docs Signed-off-by: Andre Nogueira <[email protected]> * fix: include postgresql extra dependency Signed-off-by: Andre Nogueira <[email protected]> * fix: remove autoscaler Signed-off-by: Andre Nogueira <[email protected]> * fix: remove sts Signed-off-by: Andre Nogueira <[email protected]> * fix: add more suggestive env var example Signed-off-by: Andre Nogueira <[email protected]> * fix: add chart dependency lock Signed-off-by: Andre Nogueira <[email protected]> * fix: add host infer to the chart docs Signed-off-by: Andre Nogueira <[email protected]> --------- Signed-off-by: Andre Nogueira <[email protected]>
1 parent c10010e commit 9c8224e

File tree

14 files changed

+1205
-0
lines changed

14 files changed

+1205
-0
lines changed

kubernetes/chart/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

kubernetes/chart/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 16.7.27
5+
digest: sha256:ab3541612e8857c2d08d46f83cab79fa87b6ae6148e2d64d7d2b06729a520ce1
6+
generated: "2025-09-25T12:57:56.528976+01:00"

kubernetes/chart/Chart.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v2
2+
type: application
3+
name: sourcebot
4+
version: 0.1.0
5+
appVersion: v4.5.1
6+
description: The open source Sourcegraph alternative. Sourcebot gives you a powerful interface to search though all your repos and branches across multiple code hosts.
7+
icon: https://raw.githubusercontent.com/sourcebot-dev/sourcebot/ebf6721836b8f878d42bb8c1e844bdc7867a74fe/packages/web/public/logo_512.png
8+
keywords:
9+
- code-search
10+
- code-intelligence
11+
- sourcebot
12+
home: https://sourcebot.dev/
13+
sources:
14+
- https://github.com/sourcebot-dev/sourcebot
15+
- https://github.com/sourcebot-dev/sourcebot/kubernetes/chart
16+
dependencies:
17+
- name: postgresql
18+
version: 16.7.27
19+
repository: https://charts.bitnami.com/bitnami
20+
condition: postgresql.enabled

kubernetes/chart/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# sourcebot
2+
3+
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.5.1](https://img.shields.io/badge/AppVersion-v4.5.1-informational?style=flat-square)
4+
5+
The open source Sourcegraph alternative. Sourcebot gives you a powerful interface to search though all your repos and branches across multiple code hosts.
6+
7+
**Homepage:** <https://sourcebot.dev/>
8+
9+
## Source Code
10+
11+
* <https://github.com/sourcebot-dev/sourcebot>
12+
* <https://github.com/sourcebot-dev/sourcebot/kubernetes/chart>
13+
14+
## Requirements
15+
16+
| Repository | Name | Version |
17+
|------------|------|---------|
18+
| https://charts.bitnami.com/bitnami | postgresql | 16.7.27 |
19+
20+
## Values
21+
22+
| Key | Type | Default | Description |
23+
|-----|------|---------|-------------|
24+
| additionalLabels | object | `{}` | Add extra labels to all resources. |
25+
| affinity | object | `{}` | Set affinity rules for pod scheduling. Defaults to soft anti-affinity if not set. See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/ |
26+
| args | list | `[]` | Override the default arguments of the container. |
27+
| command | list | `[]` | Override the default command of the container. |
28+
| config | object | `{"$schema":"https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json","connections":{},"settings":{}}` | Configure Sourcebot-specific application settings. |
29+
| containerSecurityContext | object | `{}` | Set the container-level security context. |
30+
| database | object | `{}` | Configure the database secret by providing database.secretName and database.secretKey to use a Kubernetes secret. |
31+
| envSecrets | list | `[]` | Set environment variables from Kubernetes secrets. |
32+
| envs | list | `[]` | Set additional environment variables. |
33+
| fullnameOverride | string | `""` | Override the full name of the chart. |
34+
| image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/sourcebot-dev/sourcebot"}` | Configure the container image. |
35+
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
36+
| image.repository | string | `"ghcr.io/sourcebot-dev/sourcebot"` | Container image repository. |
37+
| imagePullSecrets | list | `[]` | Configure image pull secrets for private registries. |
38+
| ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[],"tls":[]}` | Configure ingress for Sourcebot. |
39+
| ingress.annotations | object | `{}` | Ingress annotations. |
40+
| ingress.className | string | `""` | Ingress class name. |
41+
| ingress.enabled | bool | `false` | Enable or disable ingress. |
42+
| ingress.hosts | list | `[]` | List of hostnames and paths for ingress rules. The first host will be used as the default host. |
43+
| ingress.tls | list | `[]` | TLS settings for ingress. |
44+
| initContainers | list | `[]` | Configure init containers to run before the main container. |
45+
| license | object | `{}` | Configure the enterprise license key secret by providing license.secretName and license.secretKey to use a Kubernetes secret. |
46+
| livenessProbe | object | `{"failureThreshold":5,"httpGet":{"path":"/","port":"http"},"initialDelaySeconds":10,"periodSeconds":10}` | Liveness probe to check if the container is alive. |
47+
| livenessProbe.failureThreshold | int | `5` | Number of consecutive failures before marking the container as unhealthy. |
48+
| livenessProbe.httpGet | object | `{"path":"/","port":"http"}` | Http GET request to check if the container is alive. |
49+
| livenessProbe.httpGet.path | string | `"/"` | Path to check. |
50+
| livenessProbe.httpGet.port | string | `"http"` | Port to check. |
51+
| livenessProbe.initialDelaySeconds | int | `10` | Initial delay before the first probe. |
52+
| livenessProbe.periodSeconds | int | `10` | Frequency of the probe. |
53+
| nameOverride | string | `""` | Override the name of the chart. |
54+
| nodeSelector | object | `{}` | Set node selector constraints. See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector |
55+
| podAnnotations | object | `{}` | Add annotations to the pod metadata. |
56+
| podDisruptionBudget | object | `{"enabled":true,"maxUnavailable":1,"minAvailable":1}` | Configure Pod Disruption Budget. |
57+
| podDisruptionBudget.enabled | bool | `true` | Enable Pod Disruption Budget. |
58+
| podDisruptionBudget.maxUnavailable | int | `1` | Maximum number of pods that can be unavailable. |
59+
| podDisruptionBudget.minAvailable | int | `1` | Minimum number of pods that must be available. |
60+
| podSecurityContext | object | `{}` | Set the pod-level security context. |
61+
| postgresql | object | `{"enabled":false}` | Configure the Bitnami PostgreSQL sub-chart. See: https://artifacthub.io/packages/helm/bitnami/postgresql |
62+
| priorityClassName | string | `""` | Set the priority class name for pods. See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ |
63+
| readinessProbe | object | `{"failureThreshold":5,"httpGet":{"path":"/","port":"http"},"initialDelaySeconds":10,"periodSeconds":10}` | Readiness probe to check if the container is ready to serve traffic. |
64+
| readinessProbe.failureThreshold | int | `5` | Number of consecutive failures before marking the container as not ready. |
65+
| readinessProbe.httpGet | object | `{"path":"/","port":"http"}` | Http GET request to check if the container is ready. |
66+
| readinessProbe.httpGet.path | string | `"/"` | Path to check. |
67+
| readinessProbe.httpGet.port | string | `"http"` | Port to check. |
68+
| readinessProbe.initialDelaySeconds | int | `10` | Initial delay before the first probe. |
69+
| readinessProbe.periodSeconds | int | `10` | Frequency of the probe. |
70+
| redis | object | `{}` | Configure the Redis secret by providing redis.secretName and redis.secretKey to use a Kubernetes secret. |
71+
| replicaCount | int | `1` | Set the number of replicas for the deployment. |
72+
| resources | object | `{}` | Configure resource requests and limits for the container. |
73+
| service | object | `{"annotations":{},"containerPort":3000,"port":3000,"type":"ClusterIP"}` | Configure the Sourcebot Kubernetes service. |
74+
| service.annotations | object | `{}` | Service annotations. |
75+
| service.containerPort | int | `3000` | Internal container port. |
76+
| service.port | int | `3000` | External service port. |
77+
| service.type | string | `"ClusterIP"` | Type of the Kubernetes service (e.g., ClusterIP, NodePort, LoadBalancer). |
78+
| serviceAccount | object | `{"annotations":{},"automount":false,"create":true,"name":""}` | Configure the ServiceAccount. |
79+
| serviceAccount.annotations | object | `{}` | Add annotations to the ServiceAccount. |
80+
| serviceAccount.automount | bool | `false` | Enable or disable automatic ServiceAccount mounting. |
81+
| serviceAccount.create | bool | `true` | Create a new ServiceAccount. |
82+
| serviceAccount.name | string | `""` | Use an existing ServiceAccount (if set). |
83+
| startupProbe | object | `{"failureThreshold":30,"httpGet":{"path":"/","port":"http"},"periodSeconds":30}` | Startup probe to check if the container has started successfully. |
84+
| startupProbe.failureThreshold | int | `30` | Number of seconds to wait before starting the probe. |
85+
| startupProbe.httpGet | object | `{"path":"/","port":"http"}` | Http GET request to check if the container has started. |
86+
| startupProbe.httpGet.path | string | `"/"` | Path to check. |
87+
| startupProbe.httpGet.port | string | `"http"` | Port to check. |
88+
| startupProbe.periodSeconds | int | `30` | Initial delay before the first probe. |
89+
| tolerations | list | `[]` | Set tolerations for pod scheduling. See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
90+
| volumeMounts | list | `[]` | Define volume mounts for the container. See: https://kubernetes.io/docs/concepts/storage/volumes/ |
91+
| volumes | list | `[]` | Define additional volumes. See: https://kubernetes.io/docs/concepts/storage/volumes/ |
92+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if $.Values.ingress.enabled }}
3+
{{- range $host := $.Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" $.Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sourcebot.fullname" $ }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ $.Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" $.Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch its status by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "sourcebot.fullname" $ }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ $.Release.Namespace }} {{ include "sourcebot.fullname" $ }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ $.Values.service.port }}
17+
{{- else if contains "ClusterIP" $.Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "sourcebot.name" $ }},app.kubernetes.io/instance={{ $.Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ $.Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:3000 to use Sourcebot after forwarding"
21+
kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME 3000:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "sourcebot.name" -}}
5+
{{- default $.Chart.Name $.Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "sourcebot.fullname" -}}
14+
{{- if $.Values.fullnameOverride }}
15+
{{- $.Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default $.Chart.Name $.Values.nameOverride }}
18+
{{- if contains $name $.Release.Name }}
19+
{{- $.Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" $.Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "sourcebot.chart" -}}
30+
{{- printf "%s-%s" $.Chart.Name $.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "sourcebot.labels" -}}
37+
helm.sh/chart: {{ include "sourcebot.chart" $ }}
38+
{{ include "sourcebot.selectorLabels" $ }}
39+
{{- if $.Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ $.Release.Service }}
43+
{{- with $.Values.additionalLabels }}
44+
{{ toYaml . }}
45+
{{- end }}
46+
{{- end }}
47+
48+
{{/*
49+
Selector labels
50+
*/}}
51+
{{- define "sourcebot.selectorLabels" -}}
52+
app.kubernetes.io/name: {{ include "sourcebot.name" $ }}
53+
app.kubernetes.io/instance: {{ $.Release.Name }}
54+
{{- end }}
55+
56+
{{/*
57+
Create the image to use for the container.
58+
*/}}
59+
{{- define "sourcebot.image" -}}
60+
{{- if $.Values.image.digest -}}
61+
"{{ $.Values.image.repository }}@{{ $.Values.image.digest }}"
62+
{{- else if $.Values.image.tag -}}
63+
"{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
64+
{{- else -}}
65+
"{{ $.Values.image.repository }}:{{ $.Chart.AppVersion }}"
66+
{{- end -}}
67+
{{- end }}
68+
69+
{{/*
70+
Create the name of the service account to use
71+
*/}}
72+
{{- define "sourcebot.serviceAccountName" -}}
73+
{{- if $.Values.serviceAccount.create }}
74+
{{- default (include "sourcebot.fullname" $) $.Values.serviceAccount.name }}
75+
{{- else }}
76+
{{- default "default" $.Values.serviceAccount.name }}
77+
{{- end }}
78+
{{- end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "sourcebot.fullname" $ }}
6+
labels:
7+
{{- include "sourcebot.labels" $ | nindent 4 }}
8+
data:
9+
config.json: |
10+
{{- toJson $.Values.config | nindent 4 }}

0 commit comments

Comments
 (0)