Skip to content

Commit

Permalink
docs: update docs to reflect recent api changes (#146)
Browse files Browse the repository at this point in the history
## Issue
N/A

## Description
We've had a lot of recent changes to our supported commands. This PR
ensures our docs are up to date
  • Loading branch information
ahmad-ibra authored Aug 8, 2024
1 parent e88bd71 commit f2b3217
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 7 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ make build

`validatorctl` provides several commands for managing validator plugins. Below are some common commands:

- Install validator plugins with the `validator install` command.
- Install validator and plugins in a cluster, and apply validation rules with the `validator install --apply` command.
- Describe validation results with the `validator describe` command.
- Re-configure validator plugins after they've been installed with the `validator upgrade` command.
- Uninstall the validator and all plugins with the `validator uninstall` command.
- Directly invoke validation rules with the `validator rules check` command.

Refer to the [subcommands](./docs/subcommands.md) page to learn more about each command. You can also issue the `validator help` command to learn more about the available commands.

Expand All @@ -75,8 +76,10 @@ Usage:
Available Commands:
completion Generate the autocompletion script for the specified shell
describe Describe all validation results in a Kubernetes cluster
docs Display information about supported validator plugins
help Help about any command
install Install validator & configure validator plugin(s)
install Install validator & validator plugin(s)
rules Configure & apply, or directly evaluate validator plugin rules.
uninstall Uninstall validator & all validator plugin(s)
upgrade Upgrade validator & re-configure validator plugin(s)
version Prints the Validator CLI version
Expand Down
6 changes: 3 additions & 3 deletions cmd/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ For more information about validator, see: https://github.com/validator-labs/val
func NewValidatorRulesCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "rules",
Short: "Configure & apply, or directly evaluate rules validator plugin rules.",
Long: `Configure & apply, or directly evaluate rules validator plugin rules.
Short: "Configure & apply, or directly evaluate validator plugin rules.",
Long: `Configure & apply, or directly evaluate validator plugin rules.
To configure and apply validator plugin rules, use 'validatorctl rules apply'.
Running 'validatorctl rules apply' requires a configuration file, which can be
Expand Down Expand Up @@ -199,7 +199,7 @@ For more information about validator, see: https://github.com/validator-labs/val
}

flags := cmd.Flags()
flags.StringVarP(&tc.ConfigFile, "config-file", "f", "", "Validator configuration file. Required unless using --direct.")
flags.StringVarP(&tc.ConfigFile, "config-file", "f", "", "Validator configuration file.")
flags.BoolVarP(&tc.CreateConfigOnly, "config-only", "o", false, "Update configuration file only. Do not proceed with checks. Default: false.")
flags.BoolVarP(&tc.UpdatePasswords, "update-passwords", "p", false, "Update passwords only. Do not proceed with checks. Default: false.")
flags.BoolVarP(&tc.Reconfigure, "reconfigure", "r", false, "Re-configure plugin rules prior to running checks. Default: false.")
Expand Down
78 changes: 76 additions & 2 deletions docs/subcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ The `validator` command exposes the following subcommands.

- [`describe`](#describe) - Describe Validator results in a Kubernetes cluster.

- [`install`](#install) - Install Validator and configure Validator plugins.
- [`install`](#install) - Install Validator and Validator plugins.

- [`rules`](#rules) - Configure and apply, or directly evaluate validator plugin rules.

- [`uninstall`](#uninstall) - Uninstall Validator and remove all Validator plugins.

Expand Down Expand Up @@ -32,11 +34,13 @@ The `install` subcommand accepts the following flags.

| **Short Flag** | **Long Flag** | **Description** | **Type** |
| -------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| | `--apply` | Configure and apply validator plugin rules. Default: false | - |
| `-f` | `--config-file` | Install Validator using a configuration file (optional). Provide the file path to the configuration file. | string |
| `-o` | `--config-only` | Generate a configuration file without proceeding with an actual install. Default: false | boolean |
| `-h` | `--help` | Help with any command. | - |
| `-r` | `--reconfigure` | Reconfigure Validator and plugins prior to installation. The `--config-file` flag must be included. Default: false. | boolean |
| `-p` | `--update-passwords` | Update credentials provided in the configuration file. This does not proceed with installation. The `--config-file` flag must be included. Default: false. | boolean |
| | `--wait` | Wait for validation to succeed and describe results. Only applies when --apply is set. Default: false | - |

### Examples

Expand Down Expand Up @@ -290,6 +294,76 @@ Use the `kubectl describe` command to view the validation results.
kubectl describe validationresults --namespace validator
```

## Rules

Use the `rules` subcommand to configure and apply validator plugin rules, or directly invoke validation rules.

The `rules` subcommand accepts the following flags.

| **Short Flag** | **Long Flag** | **Description** | **Type** |
| -------------- | ------------------ | ------------------------- | -------- |
| `-h` | `--help` | Help with any command. | - |

The rules subcommand exposes the following subcommands.

- [`apply`](#apply) - Configure and apply validator plugin rules in a Kubernetes cluster.

- [`check`](#check) - Directly evaluate rules for validator plugins.

### Apply

Use the `apply` subcommand to configure and apply validator plugin rules.

The `apply` subcommand accepts the following flags.

| **Short Flag** | **Long Flag** | **Description** | **Type** |
| -------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `-f` | `--config-file` | Validator configuration file (required). | string |
| `-o` | `--config-only` | Update the configuration file only. Do not proceed with checks. Default: false | boolean |
| `-h` | `--help` | Help with any command. | - |
| `-r` | `--reconfigure` | Reconfigure plugins rules prior to running checks. The `--config-file` flag must be included. Default: false. | boolean |
| `-p` | `--update-passwords` | Update credentials provided in the configuration file. This does not proceed with installation. The `--config-file` flag must be included. Default: false. | boolean |
| | `--wait` | Wait for validation to succeed and describe results. Default: false | - |

#### Examples

Apply Validator plugin rules in a cluster and wait for results.

```shell
validator rules apply \
--config-file /Users/demo/.validator/validator-20231109135306/validator.yaml \
--wait
```

### Check

Use the `check` subcommand to directly evaluate rules for validator plugins.

The `check` subcommand accepts the following flags.

| **Short Flag** | **Long Flag** | **Description** | **Type** |
| -------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `-f` | `--config-file` | Validator configuration file. | string |
| `-o` | `--config-only` | Update the configuration file only. Do not proceed with checks. Default: false | boolean |
| `-h` | `--help` | Help with any command. | - |
| `-r` | `--reconfigure` | Reconfigure plugins rules prior to running checks. The `--config-file` flag must be included. Default: false. | boolean |
| `-p` | `--update-passwords` | Update credentials provided in the configuration file. This does not proceed with installation. The `--config-file` flag must be included. Default: false. | boolean |

#### Examples

Directly evaluate Validator plugin rules.

```shell
validator rules check
```

Directly evaluate preconfigured Validator plugin rules.

```shell
validator rules check \
--config-file /Users/demo/.validator/validator-20231109135306/validator.yaml
```

## Uninstall

Use the `uninstall` subcommand to uninstall the Validator framework and remove all Validator plugins. To remove
Expand Down Expand Up @@ -454,5 +528,5 @@ validator version
```

```shell
Validator CLI version: 0.0.6
Validator CLI version: 0.1.0
```

0 comments on commit f2b3217

Please sign in to comment.