From c43821c58e560a64aee3713cf6d39616332a8a63 Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Thu, 1 Aug 2019 19:00:33 -0400 Subject: [PATCH 1/3] Follow what documentation says we should do we're a perf standby and perfstandbyok=true, i.e. return 200 instead of 429. --- http/sys_health.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http/sys_health.go b/http/sys_health.go index 8e9f57b6617f..90b98320abc3 100644 --- a/http/sys_health.go +++ b/http/sys_health.go @@ -148,6 +148,8 @@ func getSysHealth(core *vault.Core, r *http.Request) (int, *HealthResponse, erro code = drSecondaryCode case !perfStandbyOK && perfStandby: code = perfStandbyCode + case perfStandbyOK && perfStandby: + code = activeCode case !standbyOK && standby: code = standbyCode } From 155d52dde627c7c1a5c8ee4c6774312a9544f1cc Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Mon, 5 Aug 2019 09:21:39 -0400 Subject: [PATCH 2/3] Rework switch statement for readability. --- http/sys_health.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/http/sys_health.go b/http/sys_health.go index 90b98320abc3..59f9b5a6959a 100644 --- a/http/sys_health.go +++ b/http/sys_health.go @@ -146,12 +146,14 @@ func getSysHealth(core *vault.Core, r *http.Request) (int, *HealthResponse, erro code = sealedCode case replicationState.HasState(consts.ReplicationDRSecondary): code = drSecondaryCode - case !perfStandbyOK && perfStandby: - code = perfStandbyCode - case perfStandbyOK && perfStandby: - code = activeCode - case !standbyOK && standby: - code = standbyCode + case perfStandby: + if !perfStandbyOK { + code = perfStandbyCode + } + case standby: + if !standbyOK { + code = standbyCode + } } // Fetch the local cluster name and identifier From cfcc27e603005b1b0b1cbcff02383cf7f6145f6c Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Mon, 5 Aug 2019 16:43:38 -0400 Subject: [PATCH 3/3] Fix typos in docs. --- website/source/api/system/health.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/source/api/system/health.html.md b/website/source/api/system/health.html.md index 097218d432f4..21439d38c463 100644 --- a/website/source/api/system/health.html.md +++ b/website/source/api/system/health.html.md @@ -35,12 +35,12 @@ The default status codes are: - `standbyok` `(bool: false)` – Specifies if being a standby should still return the active status code instead of the standby status code. This is useful when - Vault is behind a non-configurable load balance that just wants a 200-level + Vault is behind a non-configurable load balancer that just wants a 200-level response. This will not apply if the node is a performance standby. - `perfstandbyok` `(bool: false)` – Specifies if being a performance standby should still return the active status code instead of the performance standby status code. - This is useful when Vault is behind a non-configurable load balance that just wants + This is useful when Vault is behind a non-configurable load balancer that just wants a 200-level response. - `activecode` `(int: 200)` – Specifies the status code that should be returned