From c440f49518458d146dfae8931476d4d57497f4bd Mon Sep 17 00:00:00 2001 From: Ryan Turner Date: Tue, 26 Jul 2022 00:05:23 +0000 Subject: [PATCH] Deprecate ambiguous svids_count field in Agent GetDebug API Introduce new SVID count fields for each SVID cache in SPIRE Agent. These new fields clarify what exactly is represented in the counts and provide integration tests a way to assert on the state of the various Agent in-memory caches. Signed-off-by: Ryan Turner --- proto/spire/api/agent/debug/v1/debug.pb.go | 92 ++++++++++++++++------ proto/spire/api/agent/debug/v1/debug.proto | 9 ++- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/proto/spire/api/agent/debug/v1/debug.pb.go b/proto/spire/api/agent/debug/v1/debug.pb.go index 15de1e1..011fca3 100644 --- a/proto/spire/api/agent/debug/v1/debug.pb.go +++ b/proto/spire/api/agent/debug/v1/debug.pb.go @@ -69,9 +69,18 @@ type GetInfoResponse struct { // Agent uptime in seconds Uptime int32 `protobuf:"varint,2,opt,name=uptime,proto3" json:"uptime,omitempty"` // Number of SVIDs cached in memory + // Deprecated in favor of cached_x509_svids_count, cached_jwt_svids_count, and cached_svidstore_x509_svids_count + // + // Deprecated: Do not use. SvidsCount int32 `protobuf:"varint,3,opt,name=svids_count,json=svidsCount,proto3" json:"svids_count,omitempty"` // last successful sync with server (in seconds since unix epoch) LastSyncSuccess int64 `protobuf:"varint,4,opt,name=last_sync_success,json=lastSyncSuccess,proto3" json:"last_sync_success,omitempty"` + // Number of X.509-SVIDs in Agent primary in-memory cache + CachedX509SvidsCount int32 `protobuf:"varint,5,opt,name=cached_x509_svids_count,json=cachedX509SvidsCount,proto3" json:"cached_x509_svids_count,omitempty"` + // Number of JWT-SVIDs in Agent primary in-memory cache + CachedJwtSvidsCount int32 `protobuf:"varint,6,opt,name=cached_jwt_svids_count,json=cachedJwtSvidsCount,proto3" json:"cached_jwt_svids_count,omitempty"` + // Number of X.509-SVIDs in Agent svidstore in-memory cache + CachedSvidstoreX509SvidsCount int32 `protobuf:"varint,7,opt,name=cached_svidstore_x509_svids_count,json=cachedSvidstoreX509SvidsCount,proto3" json:"cached_svidstore_x509_svids_count,omitempty"` } func (x *GetInfoResponse) Reset() { @@ -120,6 +129,7 @@ func (x *GetInfoResponse) GetUptime() int32 { return 0 } +// Deprecated: Do not use. func (x *GetInfoResponse) GetSvidsCount() int32 { if x != nil { return x.SvidsCount @@ -134,6 +144,27 @@ func (x *GetInfoResponse) GetLastSyncSuccess() int64 { return 0 } +func (x *GetInfoResponse) GetCachedX509SvidsCount() int32 { + if x != nil { + return x.CachedX509SvidsCount + } + return 0 +} + +func (x *GetInfoResponse) GetCachedJwtSvidsCount() int32 { + if x != nil { + return x.CachedJwtSvidsCount + } + return 0 +} + +func (x *GetInfoResponse) GetCachedSvidstoreX509SvidsCount() int32 { + if x != nil { + return x.CachedSvidstoreX509SvidsCount + } + return 0 +} + type GetInfoResponse_Cert struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -209,38 +240,49 @@ var file_spire_api_agent_debug_v1_debug_proto_rawDesc = []byte{ 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x70, 0x69, 0x66, 0x66, 0x65, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xad, - 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe7, + 0x03, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x73, 0x76, 0x69, 0x64, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x52, 0x09, 0x73, 0x76, 0x69, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, - 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x76, 0x69, 0x64, 0x73, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x76, 0x69, 0x64, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, - 0x79, 0x6e, 0x63, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x1a, 0x6a, 0x0a, 0x04, 0x43, 0x65, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x50, 0x49, 0x46, 0x46, 0x45, 0x49, - 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, - 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x65, 0x73, 0x41, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x32, 0x5f, - 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, 0x12, 0x56, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0b, 0x73, 0x76, 0x69, 0x64, 0x73, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, + 0x73, 0x76, 0x69, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, + 0x73, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x17, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, + 0x5f, 0x78, 0x35, 0x30, 0x39, 0x5f, 0x73, 0x76, 0x69, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x58, + 0x35, 0x30, 0x39, 0x53, 0x76, 0x69, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x33, 0x0a, + 0x16, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x6a, 0x77, 0x74, 0x5f, 0x73, 0x76, 0x69, 0x64, + 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x63, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x4a, 0x77, 0x74, 0x53, 0x76, 0x69, 0x64, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x21, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x73, 0x76, 0x69, + 0x64, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x78, 0x35, 0x30, 0x39, 0x5f, 0x73, 0x76, 0x69, 0x64, + 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1d, 0x63, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x53, 0x76, 0x69, 0x64, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x58, 0x35, + 0x30, 0x39, 0x53, 0x76, 0x69, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x6a, 0x0a, 0x04, + 0x43, 0x65, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x53, 0x50, 0x49, 0x46, 0x46, 0x45, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x32, 0x5f, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x12, 0x56, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x73, + 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x73, 0x70, 0x69, 0x72, 0x65, - 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x76, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, - 0x69, 0x66, 0x66, 0x65, 0x2f, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x73, - 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x76, - 0x31, 0x3b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x69, 0x66, 0x66, 0x65, 0x2f, 0x73, + 0x70, 0x69, 0x72, 0x65, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x70, 0x69, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/spire/api/agent/debug/v1/debug.proto b/proto/spire/api/agent/debug/v1/debug.proto index 23e7151..dac8c6b 100644 --- a/proto/spire/api/agent/debug/v1/debug.proto +++ b/proto/spire/api/agent/debug/v1/debug.proto @@ -27,7 +27,14 @@ message GetInfoResponse { // Agent uptime in seconds int32 uptime = 2; // Number of SVIDs cached in memory - int32 svids_count = 3; + // Deprecated in favor of cached_x509_svids_count, cached_jwt_svids_count, and cached_svidstore_x509_svids_count + int32 svids_count = 3 [deprecated=true]; // last successful sync with server (in seconds since unix epoch) int64 last_sync_success = 4; + // Number of X.509-SVIDs in Agent primary in-memory cache + int32 cached_x509_svids_count = 5; + // Number of JWT-SVIDs in Agent primary in-memory cache + int32 cached_jwt_svids_count = 6; + // Number of X.509-SVIDs in Agent svidstore in-memory cache + int32 cached_svidstore_x509_svids_count = 7; }