From e1e9ddd4a42aabeb05dc8c96e8715c62c68637d1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 16 Feb 2023 08:42:24 -0800 Subject: [PATCH] use kes.Status() for Status() call (#16629) --- internal/kms/kes.go | 7 ++++++- internal/kms/kms.go | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/kms/kes.go b/internal/kms/kes.go index 81ed1e4c2..fab5e3cbc 100644 --- a/internal/kms/kes.go +++ b/internal/kms/kes.go @@ -172,7 +172,11 @@ var _ KMS = (*kesClient)(nil) // compiler check // Stat returns the current KES status containing a // list of KES endpoints and the default key ID. func (c *kesClient) Stat(ctx context.Context) (Status, error) { - if _, err := c.client.Version(ctx); err != nil { + c.lock.RLock() + defer c.lock.RUnlock() + + st, err := c.client.Status(ctx) + if err != nil { return Status{}, err } endpoints := make([]string, len(c.client.Endpoints)) @@ -181,6 +185,7 @@ func (c *kesClient) Stat(ctx context.Context) (Status, error) { Name: "KES", Endpoints: endpoints, DefaultKey: c.defaultKeyID, + Details: st, }, nil } diff --git a/internal/kms/kms.go b/internal/kms/kms.go index a2efd64d6..71d220b5f 100644 --- a/internal/kms/kms.go +++ b/internal/kms/kms.go @@ -72,6 +72,11 @@ type Status struct { // is specified. It is empty if the KMS does not support // a default key. DefaultKey string + + // Details provides more details about the KMS endpoint status. + // including uptime, version and available CPUs. + // Could be more in future. + Details kes.State } // DEK is a data encryption key. It consists of a