-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp config docs with helm-docs (#50)
This PR added autogen docs based on `values.yaml`. `charts/<chart_name>/README.md` should no longer be edited, and changes should be made in `charts/<chart_name>/README.md.gotmpl` View the rendered version here - https://github.com/sourcegraph/deploy-sourcegraph-helm/tree/02-25-Revamp_config_docs_with_helm-docs/charts/sourcegraph - https://github.com/sourcegraph/deploy-sourcegraph-helm/tree/02-25-Revamp_config_docs_with_helm-docs/charts/sourcegraph-migrator ## Test plan Run `./scripts/helm-docs.sh`, you should be able to generate the README.md close https://github.com/sourcegraph/sourcegraph/issues/31016
- Loading branch information
1 parent
9116a74
commit 8da42c5
Showing
14 changed files
with
937 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
charts/sourcegraph/examples/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!-- | ||
DO NOT EDIT README.md directly. | ||
README.md is automatically generated from README.md.gotmpl | ||
--> | ||
|
||
# Sourcegraph Migrator Helm Chart | ||
|
||
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] | ||
|
||
## Requirements | ||
|
||
* [Helm 3 CLI](https://helm.sh/docs/intro/install/) | ||
* Kubernetes 1.19 or greater | ||
|
||
## Installation | ||
|
||
Add the Sourcegraph charts repo to Helm: | ||
|
||
```sh | ||
helm repo add sourcegraph https://sourcegraph.github.io/deploy-sourcegraph-helm/ | ||
``` | ||
|
||
## Usage | ||
|
||
> If you are not using external databases, the chart has to be installed in the same namespace as the parent [sourcegraph/sourcegraph] chart | ||
|
||
[sourcegraph/sourcegraph-migrator] chart requires the correct `PG*`, `CODEINTEL_PG*`, and `CODEINSIGHTS_PG*` environment variables to be configured at `migrator.env`. Learn more about [using your own PostgreSQL server]. `PG*` and `CODEINTEL_PG*` environment variables are compatible with the `frontend.env` values from the parent [sourcegraph/sourcegraph] chart. | ||
|
||
You should consult the list of available [migrator commands]. Below is some example usage. | ||
|
||
### Run database migration | ||
|
||
[`migrator up`](https://docs.sourcegraph.com/admin/how-to/manual_database_migrations#up) | ||
|
||
- Perform database migrations prior to upgrading the Sourcegraph deployment | ||
- Perform initial migrations against external PostgreSQL databases prior to the Sourcegraph deployment | ||
|
||
```sh | ||
helm upgrade --install -f <your-override-file.yaml> sg-migrator sourcegraph/sourcegraph-migrator | ||
``` | ||
|
||
### Add a migration log entry | ||
|
||
[`migrator add-log -db=frontend -version=1528395834`](https://docs.sourcegraph.com/admin/how-to/manual_database_migrations#add-log) | ||
|
||
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]. | ||
|
||
```sh | ||
helm upgrade --install -f <your-override-file.yaml> --set "migrator.args={add-log,-db=frontend,-version=1528395834}" sg-migrator sourcegraph/sourcegraph-migrator | ||
``` | ||
|
||
## Rendering manifests for kubectl deployment | ||
|
||
Manifests rendered using the `helm template` command can be used for direct deployment using `kubectl`. | ||
|
||
## Configuration Options | ||
|
||
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 more](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | ||
- `migrator.nodeSelector` - [learn more](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) | ||
- `migrator.tolerations` - [learn more](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) | ||
- `migrator.podSecurityContext` - [learn more](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | ||
- `migrator.env` - consult `values.yaml` file | ||
|
||
{{ template "chart.valuesTable" . }} | ||
|
||
## Troubleshooting | ||
|
||
See a list of running migrator jobs | ||
|
||
```sh | ||
kubectl get jobs -l app.kubernetes.io/component=migrator | ||
``` | ||
|
||
Check logs of the migrator job | ||
|
||
```sb | ||
kubectl logs -l job=migrator -c migrator | ||
``` | ||
|
||
[sourcegraph/sourcegraph]: ../sourcegraph/ | ||
[sourcegraph/sourcegraph-migrator]: ./ | ||
[dirty database]: https://docs.sourcegraph.com/admin/how-to/dirty_database | ||
[migrator]: https://docs.sourcegraph.com/admin/how-to/manual_database_migrations | ||
[migrator commands]: https://docs.sourcegraph.com/admin/how-to/manual_database_migrations#commands | ||
[job]: https://kubernetes.io/docs/concepts/workloads/controllers/job/ | ||
[add-log]: https://docs.sourcegraph.com/admin/how-to/manual_database_migrations#add-log | ||
[using your own postgresql server]: https://docs.sourcegraph.com/admin/external_services/postgres#instructions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.