This chart contains a single Job to run migrator operations. It is a supplemental chart for the parent sourcegraph/sourcegraph Helm Chart.
Use cases:
- Perform initial migrations against external PostgreSQL databases prior to the Sourcegraph deployment
- Perform database migrations prior to upgrading the Sourcegraph deployment
- Troubleshoot a dirty database
- Helm 3 CLI
- Kubernetes 1.19 or greater
Add the Sourcegraph charts repo to Helm:
helm repo add sourcegraph https://helm.sourcegraph.com/releaseThe chart has to be installed in the same namespace as the parent sourcegraph/sourcegraph chart
By default, the sourcegraph/sourcegraph-migrator chart references database credentials from a Kubernetes Secret created by the parent sourcegraph/sourcegraph chart. If you provide your own Secret resources, update the codeInsightsDB.auth.existingSecret, codeIntelDB.auth.existingSecret and pgsql.auth.existingSecret settings in values.yaml to match. Learn more about using your own PostgreSQL server.
You should consult the list of available migrator commands. Below is some example usage.
- Perform database migrations prior to upgrading the Sourcegraph deployment
- Perform initial migrations against external PostgreSQL databases prior to the Sourcegraph deployment
helm upgrade --install -f <your-override-file.yaml> --version 6.12.2541 sg-migrator sourcegraph/sourcegraph-migratormigrator add-log -db=frontend -version=1528395834
Add an entry to the migration log after a site administrator has explicitly applied the contents of a migration file, learn more about troubleshooting a dirty database.
helm upgrade --install -f <your-override-file.yaml> --set "migrator.args={add-log,-db=frontend,-version=1528395834}" --version 6.12.2541 sg-migrator sourcegraph/sourcegraph-migratorManifests rendered using the helm template command can be used for direct deployment using kubectl.
Reference the table below for available configuration parameters and consult migrator documentation.
In addition to the documented values, the migrator service also supports the following values
migrator.affinity- learn moremigrator.nodeSelector- learn moremigrator.tolerations- learn moremigrator.podSecurityContext- learn moremigrator.env- consultvalues.yamlfile
| Key | Type | Default | Description |
|---|---|---|---|
| codeInsightsDB.auth.existingSecret | string | "" |
Name of existing secret to use for codeinsights-db credentials This should match the setting in the sourcegraph chart values |
| codeInsightsDB.name | string | "codeinsights-db" |
|
| codeIntelDB.auth.existingSecret | string | "" |
Name of existing secret to use for codeintel-db credentials This should match the setting in the sourcegraph chart values |
| codeIntelDB.name | string | "codeintel-db" |
|
| migrator.args | list | ["up","-db=all"] |
Override default migrator container args Available commands can be found at https://docs.sourcegraph.com/admin/how-to/manual_database_migrations |
| migrator.containerSecurityContext | object | {"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100} |
Security context for the migrator container, learn more from the Kubernetes documentation |
| migrator.env | object | {} |
Environment variables for the migrator container |
| migrator.image.defaultTag | string | "6.12.2541@sha256:902d6d2529a8257cedbd53e282061c2bb23683e90e44be05b567631f7cdce0ff" |
Docker image tag for the migrator image |
| migrator.image.name | string | "migrator" |
Docker image name for the migrator image |
| migrator.resources | object | {"limits":{"cpu":"500m","memory":"100M"},"requests":{"cpu":"100m","memory":"50M"}} |
Resource requests & limits for the migrator container, learn more from the Kubernetes documentation |
| pgsql.auth.existingSecret | string | "" |
Name of existing secret to use for pgsql credentials This should match the setting in the sourcegraph chart values |
| pgsql.name | string | "pgsql" |
|
| sourcegraph.affinity | object | {} |
Affinity, learn more from the Kubernetes documentation |
| sourcegraph.image.defaultTag | string | "{{ .Chart.AppVersion }}" |
Global docker image tag |
| sourcegraph.image.pullPolicy | string | "IfNotPresent" |
Global docker image pull policy |
| sourcegraph.image.repository | string | "index.docker.io/sourcegraph" |
Global docker image registry or prefix |
| sourcegraph.image.useGlobalTagAsDefault | bool | false |
When set to true, sourcegraph.image.defaultTag is used as the default defaultTag for all services, instead of service-specific default defaultTags |
| sourcegraph.imagePullSecrets | list | [] |
Mount named secrets containing docker credentials |
| sourcegraph.labels | object | {} |
Add a global label to all resources |
| sourcegraph.nameOverride | string | "" |
Set a custom name for the app.kubernetes.io/name annotation |
| sourcegraph.nodeSelector | object | {} |
NodeSelector, learn more from the Kubernetes documentation |
| sourcegraph.podAnnotations | object | {} |
Add extra annotations to attach to all pods |
| sourcegraph.podLabels | object | {} |
Add extra labels to attach to all pods |
| sourcegraph.priorityClassName | string | "" |
Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) |
| sourcegraph.tolerations | list | [] |
Tolerations, learn more from the Kubernetes documentation |
See a list of running migrator jobs
kubectl get jobs -l app.kubernetes.io/component=migratorCheck logs of the migrator job
kubectl logs -l job=migrator -c migrator