mirror of
https://github.com/minio/minio.git
synced 2025-04-20 18:44:21 -04:00
use GenerateKey
as more reliable KMS health-check (#19404)
This commit replaces the `KMS.Stat` API call with a `KMS.GenerateKey` call. This approach is more reliable since data key generation also works when the KMS backend is unavailable (temp. offline), but KES has cached the key. Ref: KES offline caching. With this change, it is less likely that MinIO readiness checks fail in cases where the KMS backend is offline. Signed-off-by: Andreas Auernhammer <github@aead.dev>
This commit is contained in:
parent
97ce11cb6b
commit
faeb2b7e79
@ -24,6 +24,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
|
"github.com/minio/minio/internal/kms"
|
||||||
)
|
)
|
||||||
|
|
||||||
const unavailable = "offline"
|
const unavailable = "offline"
|
||||||
@ -134,7 +135,7 @@ func ReadinessCheckHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
ctx, cancel := context.WithTimeout(r.Context(), time.Minute)
|
ctx, cancel := context.WithTimeout(r.Context(), time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
if _, err := GlobalKMS.Stat(ctx); err != nil {
|
if _, err := GlobalKMS.GenerateKey(ctx, "", kms.Context{"healthcheck": ""}); err != nil {
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodHead:
|
case http.MethodHead:
|
||||||
apiErr := toAPIError(r.Context(), err)
|
apiErr := toAPIError(r.Context(), err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user