From 0cbe71bb27e7ae28de874d3d35dd99fbfd2cd93e Mon Sep 17 00:00:00 2001 From: Martin Emrich Date: Tue, 23 Jan 2024 14:32:48 +0100 Subject: [PATCH 1/3] New --skip-healthchecks option for vector validate Runs full validation including VRL remaps, but skips health check connection attempts to remote sinks. --- .../validate_skip_healthchecks.enhancement.md | 5 +++++ src/validate.rs | 7 +++++-- website/content/en/docs/administration/validating.md | 12 ++++++++++++ website/cue/reference/cli.cue | 6 ++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 changelog.d/validate_skip_healthchecks.enhancement.md diff --git a/changelog.d/validate_skip_healthchecks.enhancement.md b/changelog.d/validate_skip_healthchecks.enhancement.md new file mode 100644 index 0000000000000..b1d3216645cba --- /dev/null +++ b/changelog.d/validate_skip_healthchecks.enhancement.md @@ -0,0 +1,5 @@ +New Option `--skip-healthchecks` for `vector validate` validates config +including VRL, but skips health checks for sinks. + +Usesful to validate configuration before deploying it remotely. +authors: MartinEmrich diff --git a/src/validate.rs b/src/validate.rs index cc3e336b1d403..a06ea9a9bf5ce 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -21,6 +21,10 @@ pub struct Opts { #[arg(long)] pub no_environment: bool, + /// Disables health checks during validation. + #[arg(long)] + pub skip_healthchecks: bool, + /// Fail validation on warnings that are probably a mistake in the configuration /// or are recommended to be fixed. #[arg(short, long)] @@ -178,8 +182,7 @@ async fn validate_environment(opts: &Opts, config: &Config, fmt: &mut Formatter) } else { return false; }; - - validate_healthchecks(opts, config, &diff, &mut pieces, fmt).await + opts.skip_healthchecks || validate_healthchecks(opts, config, &diff, &mut pieces, fmt).await } async fn validate_components( diff --git a/website/content/en/docs/administration/validating.md b/website/content/en/docs/administration/validating.md index e00ae9e210cec..c2a46621486c6 100644 --- a/website/content/en/docs/administration/validating.md +++ b/website/content/en/docs/administration/validating.md @@ -55,6 +55,18 @@ These environment checks can be disabled using the [`--no-environment`][no_envir vector validate --no-environment /etc/vector/vector.yaml ``` +#### Skipping health checks + +To validate the vector configuration even if the health-checked endpoints are not reachable +(i.e. from a local workstation), but still run all other environment checks, use the +[`--skip-healthchecks`][skip_healthchecks] flag: + +```bash +vector validate --skip-healthchecks /etc/vector/vector.yaml +``` + +Note that the configured `data_dir` must still be writeable. + [components]: /components [no_environment]: /docs/reference/cli/#validate-no-environment [sinks]: /sinks diff --git a/website/cue/reference/cli.cue b/website/cue/reference/cli.cue index 3f13cb4908f33..33b5ef448e062 100644 --- a/website/cue/reference/cli.cue +++ b/website/cue/reference/cli.cue @@ -413,6 +413,12 @@ cli: { checks and health checks """ } + "skip-healthchecks": { + _short: "ne" + description: """ + Disables health checks during validation. + """ + } "deny-warnings": { _short: "d" description: "Fail validation on warnings" From 237e39d52d7b047023f3dacbf53feda17f11ec0c Mon Sep 17 00:00:00 2001 From: Martin Emrich Date: Tue, 23 Jan 2024 14:58:07 +0100 Subject: [PATCH 2/3] Spelling fix --- changelog.d/validate_skip_healthchecks.enhancement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/validate_skip_healthchecks.enhancement.md b/changelog.d/validate_skip_healthchecks.enhancement.md index b1d3216645cba..5ba1ef5f60ff6 100644 --- a/changelog.d/validate_skip_healthchecks.enhancement.md +++ b/changelog.d/validate_skip_healthchecks.enhancement.md @@ -1,5 +1,5 @@ New Option `--skip-healthchecks` for `vector validate` validates config including VRL, but skips health checks for sinks. -Usesful to validate configuration before deploying it remotely. +Useful to validate configuration before deploying it remotely. authors: MartinEmrich From 03e75836a479aef730e87dfee447c5a983f1c388 Mon Sep 17 00:00:00 2001 From: Martin Emrich Date: Wed, 24 Jan 2024 08:44:03 +0100 Subject: [PATCH 3/3] Documentation suggestions by @maycmlee --- website/content/en/docs/administration/validating.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/content/en/docs/administration/validating.md b/website/content/en/docs/administration/validating.md index c2a46621486c6..bfdaec1f98189 100644 --- a/website/content/en/docs/administration/validating.md +++ b/website/content/en/docs/administration/validating.md @@ -58,14 +58,14 @@ vector validate --no-environment /etc/vector/vector.yaml #### Skipping health checks To validate the vector configuration even if the health-checked endpoints are not reachable -(i.e. from a local workstation), but still run all other environment checks, use the -[`--skip-healthchecks`][skip_healthchecks] flag: +(for example, from a local workstation), but still run all the other environment checks, use +the [`--skip-healthchecks`][skip_healthchecks] flag: ```bash vector validate --skip-healthchecks /etc/vector/vector.yaml ``` -Note that the configured `data_dir` must still be writeable. +**Note:** The configured `data_dir` must still be writeable. [components]: /components [no_environment]: /docs/reference/cli/#validate-no-environment