Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Docs: update docs for src validate command to add new kube subcommand #46794

Merged
merged 3 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions doc/admin/validation.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Sourcegraph Instance Validation

>🚨 WARNING 🚨: **Sourcegraph Instance Validation is currently experimental.** We're exploring this feature set.
>🚨 WARNING 🚨: **Sourcegraph Validation is currently experimental.** We're exploring this feature set.
>Let us know what you think! [File an issue](https://github.com/sourcegraph/sourcegraph/issues/new/choose)
>with feedback/problems/questions, or [contact us directly](https://about.sourcegraph.com/contact).

Instance validation provides a quick way to check that a Sourcegraph instance functions properly after a fresh install
## Validate Sourcegraph Installation

Installation validation provides a quick way to check that a Sourcegraph installation functions properly after a fresh install
or an update.

The [`src` CLI](https://github.com/sourcegraph/src-cli) has an experimental command `validate install` which drives the
validation from a user-provided configuration file with a validation specification (in JSON or YAML format). If no validation specification file is provided it will execute the following:
validation from a user-provided configuration file with a validation specification (in JSON or YAML format). If no validation specification file is provided it will execute the following defaults:

* temporarily adds an external service
* waits for a repository to be cloned
Expand Down Expand Up @@ -72,6 +74,7 @@ insight:
"timeScopeValue": 1
}
]
deleteWhenDone: true
```
#### JSON File Specification

Expand Down Expand Up @@ -122,7 +125,8 @@ insight:
"timeScopeUnit": "MONTH",
"timeScopeValue": 1
}
]
],
"deleteWhenDone": true
}

}
Expand Down Expand Up @@ -174,3 +178,42 @@ src validate install

The `src` binary finds the Sourcegraph instance to validate from the environment variables
[`SRC_ENDPOINT` and `SRC_ACCESS_TOKEN`](https://github.com/sourcegraph/src-cli#setup-with-your-sourcegraph-instance).

## Validate Sourcegraph Kubernetes Deployment

Kubernetes deployment validation provides a quick way to check that a Sourcegraph deployment on Kubernetes is configured correctly.

The [`src` CLI](https://github.com/sourcegraph/src-cli) has an experimental command `validate kube` which performs validation of a Sourcegraph deployment on Kubernetes. These validation checks include:

* Pod validation
* Service validation
* Persistent Volume Claim (PVC) validation
* Inter-Service network connection validation

These validations can also include warnings for non-failure states that should be addressed, e.g. high restart counts.

### Cluster Authentication

Kubernetes cluster authentication is handled via a standard [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) file. You can also use the `--kubeconfig` option to use a different configuration file. By default this program will use the default file used by `kubectl`.

### Usage

Use the [`src` CLI](https://github.com/sourcegraph/src-cli) to validate Kubernetes deployment:
```shell script
src validate kube
```

Specify a non-default Kubernetes namespace:
```shell script
src validate kube --namespace sourcegraph
```

Specify a different kubeconfig file:
```shell script
src validate kube --kubeconfig ~/.kube/config
```

Silence output:
```shell script
src validate kube --quiet
```
2 changes: 1 addition & 1 deletion doc/cli/references/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
* [`serve-git`](serve-git.md)
* [`snapshot`](snapshot.md)
* [`users`](users/index.md)
* [`validate`](validate.md)
* [`validate`](validate/index.md)
* [`version`](version.md)

26 changes: 0 additions & 26 deletions doc/cli/references/validate.md

This file was deleted.

7 changes: 7 additions & 0 deletions doc/cli/references/validate/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `src validate`

## Subcommands


* [`install`](install.md)
* [`kube`](kube.md)
47 changes: 47 additions & 0 deletions doc/cli/references/validate/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# `src validate install`


## Flags

| Name | Description | Default Value |
|------|-------------|---------------|
| `-dump-requests` | Log GraphQL requests and responses to stdout | `false` |
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) | `false` |
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains | `false` |
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing | `false` |
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph | `true` |

## Usage

```
Usage of 'src validate install':
-dump-requests
Log GraphQL requests and responses to stdout
-get-curl
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
-insecure-skip-verify
Skip validation of TLS certificates against trusted chains
-trace
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
-user-agent-telemetry
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
'src validate install' is a tool that validates a Sourcegraph installation.

Examples:

Run default checks:

$ src validate install

Provide a YAML configuration file:

$ src validate install config.yml

Provide a JSON configuration file:

$ src validate install config.json

Environmental variables

SRC_GITHUB_TOKEN GitHub access token for validation features
```
38 changes: 38 additions & 0 deletions doc/cli/references/validate/kube.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# `src validate kube`


## Flags

| Name | Description | Default Value |
|------|-------------|---------------|
| `-kubeconfig` | Absolute path to the kubeconfig file | `~/.kube/config` |
| `-namespace` | Specify the Kubernetes namespace to use | `default` |
| `-quiet` | Suppress output and return exit status only | `false` |


## Usage

```
Usage of 'src validate kube':
-kubeconfig string
(optional) absolute path to the kubeconfig file (default "~/.kube/config")
-namespace string
(optional) specify the kubernetes namespace to use
-quiet
(optional) suppress output and return exit status only
'src validate kube' is a tool that validates a Kubernetes based Sourcegraph deployment

Examples:

Run default deployment validation:
$ src validate kube

Specify Kubernetes namespace:
$ src validate kube --namespace sourcegraph

Specify the kubeconfig file location:
$ src validate kube --kubeconfig ~/.kube/config

Suppress output (useful for CI/CD pipelines)
$ src validate kube --quiet
```