diff --git a/kubernetes/chart/Chart.yaml b/kubernetes/chart/Chart.yaml index 67362bf6..ab7ff2b2 100644 --- a/kubernetes/chart/Chart.yaml +++ b/kubernetes/chart/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 type: application name: sourcebot version: 0.1.0 -appVersion: "" +appVersion: v4.5.1 description: The open source Sourcegraph alternative. Sourcebot gives you a powerful interface to search though all your repos and branches across multiple code hosts. icon: https://raw.githubusercontent.com/sourcebot-dev/sourcebot/ebf6721836b8f878d42bb8c1e844bdc7867a74fe/packages/web/public/logo_512.png keywords: diff --git a/kubernetes/chart/README.md b/kubernetes/chart/README.md index 47861d5b..3fccf22d 100644 --- a/kubernetes/chart/README.md +++ b/kubernetes/chart/README.md @@ -1,6 +1,6 @@ # sourcebot -![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) +![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) The open source Sourcegraph alternative. Sourcebot gives you a powerful interface to search though all your repos and branches across multiple code hosts. @@ -27,14 +27,13 @@ The open source Sourcegraph alternative. Sourcebot gives you a powerful interfac | command | list | `[]` | Override the default command of the container. | | config | object | `{"$schema":"https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json","connections":{},"settings":{}}` | Configure Sourcebot-specific application settings. | | containerSecurityContext | object | `{}` | Set the container-level security context. | -| database | object | `{}` | Configure the database secret. | +| database | object | `{}` | Configure the database secret by providing database.secretName and database.secretKey to use a Kubernetes secret. | | envSecrets | list | `[]` | Set environment variables from Kubernetes secrets. | | envs | list | `[]` | Set additional environment variables. | | fullnameOverride | string | `""` | Override the full name of the chart. | -| image | object | `{"pullPolicy":"Always","repository":"ghcr.io/sourcebot-dev/sourcebot","tag":"latest"}` | Configure the container image. | -| image.pullPolicy | string | `"Always"` | Image pull policy. | +| image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/sourcebot-dev/sourcebot"}` | Configure the container image. | +| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. | | image.repository | string | `"ghcr.io/sourcebot-dev/sourcebot"` | Container image repository. | -| image.tag | string | `"latest"` | Container image tag. | | imagePullSecrets | list | `[]` | Configure image pull secrets for private registries. | | ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[],"tls":[]}` | Configure ingress for Sourcebot. | | ingress.annotations | object | `{}` | Ingress annotations. | @@ -43,7 +42,7 @@ The open source Sourcegraph alternative. Sourcebot gives you a powerful interfac | ingress.hosts | list | `[]` | List of hostnames and paths for ingress rules. | | ingress.tls | list | `[]` | TLS settings for ingress. | | initContainers | list | `[]` | Configure init containers to run before the main container. | -| license | object | `{}` | Configure the enterprise license key secret. | +| license | object | `{}` | Configure the enterprise license key secret by providing license.secretName and license.secretKey to use a Kubernetes secret. | | livenessProbe | object | `{"failureThreshold":5,"httpGet":{"path":"/","port":"http"},"initialDelaySeconds":10,"periodSeconds":10}` | Liveness probe to check if the container is alive. | | livenessProbe.failureThreshold | int | `5` | Number of consecutive failures before marking the container as unhealthy. | | livenessProbe.httpGet | object | `{"path":"/","port":"http"}` | Http GET request to check if the container is alive. | @@ -67,7 +66,7 @@ The open source Sourcegraph alternative. Sourcebot gives you a powerful interfac | readinessProbe.httpGet.port | string | `"http"` | Port to check. | | readinessProbe.initialDelaySeconds | int | `10` | Initial delay before the first probe. | | readinessProbe.periodSeconds | int | `10` | Frequency of the probe. | -| redis | object | `{}` | Configure the Redis secret. | +| redis | object | `{}` | Configure the Redis secret by providing redis.secretName and redis.secretKey to use a Kubernetes secret. | | replicaCount | int | `1` | Set the number of replicas for the deployment. | | resources | object | `{}` | Configure resource requests and limits for the container. | | service | object | `{"annotations":{},"containerPort":3000,"port":3000,"type":"ClusterIP"}` | Configure the Sourcebot Kubernetes service. | @@ -86,7 +85,12 @@ The open source Sourcegraph alternative. Sourcebot gives you a powerful interfac | startupProbe.httpGet.path | string | `"/"` | Path to check. | | startupProbe.httpGet.port | string | `"http"` | Port to check. | | startupProbe.periodSeconds | int | `30` | Initial delay before the first probe. | +| storage | object | `{"accessModes":["ReadWriteOnce"],"className":"","enabled":true,"size":"10Gi"}` | Configure persistent storage for the application (volume is mounted at /data) to use the internal database. | +| storage.accessModes | list | `["ReadWriteOnce"]` | Access modes for the persistent volume. | +| storage.className | string | `""` | Storage class name for the persistent volume. | +| storage.enabled | bool | `true` | Enable or disable persistent storage. | +| storage.size | string | `"10Gi"` | Size of the persistent volume. | | tolerations | list | `[]` | Set tolerations for pod scheduling. See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | -| volumeMounts | list | `[]` | Define volume mounts for the container. | -| volumes | list | `[]` | Define additional volumes. | +| volumeMounts | list | `[]` | Define volume mounts for the container. See: https://kubernetes.io/docs/concepts/storage/volumes/ | +| volumes | list | `[]` | Define additional volumes. See: https://kubernetes.io/docs/concepts/storage/volumes/ | diff --git a/kubernetes/chart/templates/deployment.yaml b/kubernetes/chart/templates/deloyable.yaml similarity index 87% rename from kubernetes/chart/templates/deployment.yaml rename to kubernetes/chart/templates/deloyable.yaml index 584f1fa7..744ef0e1 100644 --- a/kubernetes/chart/templates/deployment.yaml +++ b/kubernetes/chart/templates/deloyable.yaml @@ -1,11 +1,18 @@ --- apiVersion: apps/v1 +{{- if $.Values.storage }} +kind: StatefulSet +{{- else }} kind: Deployment +{{- end }} metadata: name: {{ include "sourcebot.fullname" $ }} labels: {{- include "sourcebot.labels" $ | nindent 4 }} spec: + {{- if $.Values.storage }} + serviceName: {{ include "sourcebot.fullname" $ }} + {{- end }} {{- if not $.Values.autoscaling.enabled }} replicas: {{ $.Values.replicaCount }} {{- end }} @@ -106,6 +113,10 @@ spec: mountPath: /etc/sourcebot/config.json subPath: config.json readOnly: true + {{- if $.Values.storage }} + - name: sourcebot-data + mountPath: /data + {{- end }} {{- with $.Values.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} @@ -134,3 +145,15 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if $.Values.storage }} + volumeClaimTemplates: + - metadata: + name: sourcebot-data + spec: + accessModes: + {{- $.Values.storage.accessModes | toYaml | nindent 10 }} + storageClassName: {{ $.Values.storage.className }} + resources: + requests: + storage: {{ $.Values.storage.size }} + {{- end }} diff --git a/kubernetes/chart/values.schema.json b/kubernetes/chart/values.schema.json index 3a8b10cf..01fddfb3 100644 --- a/kubernetes/chart/values.schema.json +++ b/kubernetes/chart/values.schema.json @@ -419,6 +419,33 @@ }, "priorityClassName": { "type": "string" + }, + "storage": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "size": { + "type": "string", + "pattern": "^[0-9]+Gi$" + }, + "accessModes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "ReadWriteOnce", + "ReadOnlyMany", + "ReadWriteMany" + ] + }, + "minItems": 1 + }, + "className": { + "type": "string" + } + } } }, "definitions": { diff --git a/kubernetes/chart/values.yaml b/kubernetes/chart/values.yaml index f9cb63af..67cbc245 100644 --- a/kubernetes/chart/values.yaml +++ b/kubernetes/chart/values.yaml @@ -14,11 +14,11 @@ image: # -- Container image repository. repository: ghcr.io/sourcebot-dev/sourcebot # -- Container image tag. - tag: latest + # tag: "" # -- Container image digest (used instead of tag if set). # digest: "" # -- Image pull policy. - pullPolicy: Always + pullPolicy: IfNotPresent # -- Configure image pull secrets for private registries. imagePullSecrets: [] @@ -29,17 +29,17 @@ command: [] # -- Override the default arguments of the container. args: [] -# -- Configure the database secret. +# -- Configure the database secret by providing database.secretName and database.secretKey to use a Kubernetes secret. database: {} # secretName: sourcebot-database-url # secretKey: url -# -- Configure the Redis secret. +# -- Configure the Redis secret by providing redis.secretName and redis.secretKey to use a Kubernetes secret. redis: {} # secretName: sourcebot-redis-url # secretKey: url -# -- Configure the enterprise license key secret. +# -- Configure the enterprise license key secret by providing license.secretName and license.secretKey to use a Kubernetes secret. license: {} # secretName: sourcebot-ee-license-key # secretKey: key @@ -212,6 +212,7 @@ autoscaling: targetMemoryUtilizationPercentage: 80 # -- Define additional volumes. +# See: https://kubernetes.io/docs/concepts/storage/volumes/ volumes: [] # - name: foo # secret: @@ -219,6 +220,7 @@ volumes: [] # optional: false # -- Define volume mounts for the container. +# See: https://kubernetes.io/docs/concepts/storage/volumes/ volumeMounts: [] # - name: foo # mountPath: "/etc/foo" @@ -263,3 +265,15 @@ affinity: {} # -- Set the priority class name for pods. # See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ priorityClassName: "" + +# -- Configure persistent storage for the application (volume is mounted at /data) to use the internal database. +storage: + # -- Enable or disable persistent storage. + enabled: true + # -- Access modes for the persistent volume. + accessModes: + - ReadWriteOnce + # -- Storage class name for the persistent volume. + className: "" + # -- Size of the persistent volume. + size: "10Gi"