mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
Merge pull request #116053 from aramase/aramase/c/rm_dek_interarrival_kmsv2
[KMSv2] remove setting `dek_cache_inter_arrival_time_seconds` for KMSv2 only
This commit is contained in:
commit
c48a7971e3
@ -96,8 +96,6 @@ func newEnvelopeTransformerWithClock(envelopeService kmsservice.Service, provide
|
||||
|
||||
// TransformFromStorage decrypts data encrypted by this transformer using envelope encryption.
|
||||
func (t *envelopeTransformer) TransformFromStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, bool, error) {
|
||||
metrics.RecordArrival(metrics.FromStorageLabel, time.Now())
|
||||
|
||||
// Deserialize the EncryptedObject from the data.
|
||||
encryptedObject, err := t.doDecode(data)
|
||||
if err != nil {
|
||||
@ -148,7 +146,6 @@ func (t *envelopeTransformer) TransformFromStorage(ctx context.Context, data []b
|
||||
|
||||
// TransformToStorage encrypts data to be written to disk using envelope encryption.
|
||||
func (t *envelopeTransformer) TransformToStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, error) {
|
||||
metrics.RecordArrival(metrics.ToStorageLabel, time.Now())
|
||||
newKey, err := generateKey(32)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -638,13 +638,11 @@ func TestEnvelopeMetrics(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
metrics.DekCacheInterArrivals.Reset()
|
||||
metrics.KeyIDHashTotal.Reset()
|
||||
metrics.InvalidKeyIDFromStatusTotal.Reset()
|
||||
|
||||
for _, tt := range testCases {
|
||||
t.Run(tt.desc, func(t *testing.T) {
|
||||
defer metrics.DekCacheInterArrivals.Reset()
|
||||
defer metrics.KeyIDHashTotal.Reset()
|
||||
defer metrics.InvalidKeyIDFromStatusTotal.Reset()
|
||||
ctx := testContext(t)
|
||||
|
@ -66,6 +66,7 @@ var (
|
||||
keyIDHashStatusLastTimestampSecondsMetricLabels *lru.Cache
|
||||
cacheSize int = 10
|
||||
|
||||
// This metric is only used for KMS v1 API.
|
||||
dekCacheFillPercent = metrics.NewGauge(
|
||||
&metrics.GaugeOpts{
|
||||
Namespace: namespace,
|
||||
@ -75,8 +76,9 @@ var (
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
)
|
||||
// These metrics are made public to be used by unit tests.
|
||||
DekCacheInterArrivals = metrics.NewHistogramVec(
|
||||
|
||||
// This metric is only used for KMS v1 API.
|
||||
dekCacheInterArrivals = metrics.NewHistogramVec(
|
||||
&metrics.HistogramOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
@ -88,6 +90,7 @@ var (
|
||||
[]string{"transformation_type"},
|
||||
)
|
||||
|
||||
// These metrics are made public to be used by unit tests.
|
||||
KMSOperationsLatencyMetric = metrics.NewHistogramVec(
|
||||
&metrics.HistogramOpts{
|
||||
Namespace: namespace,
|
||||
@ -193,7 +196,7 @@ func RegisterMetrics() {
|
||||
},
|
||||
}
|
||||
legacyregistry.MustRegister(dekCacheFillPercent)
|
||||
legacyregistry.MustRegister(DekCacheInterArrivals)
|
||||
legacyregistry.MustRegister(dekCacheInterArrivals)
|
||||
legacyregistry.MustRegister(KeyIDHashTotal)
|
||||
legacyregistry.MustRegister(KeyIDHashLastTimestampSeconds)
|
||||
legacyregistry.MustRegister(KeyIDHashStatusLastTimestampSeconds)
|
||||
@ -234,7 +237,7 @@ func RecordArrival(transformationType string, start time.Time) {
|
||||
if lastFromStorage.IsZero() {
|
||||
lastFromStorage = start
|
||||
}
|
||||
DekCacheInterArrivals.WithLabelValues(transformationType).Observe(start.Sub(lastFromStorage).Seconds())
|
||||
dekCacheInterArrivals.WithLabelValues(transformationType).Observe(start.Sub(lastFromStorage).Seconds())
|
||||
lastFromStorage = start
|
||||
case ToStorageLabel:
|
||||
lockLastToStorage.Lock()
|
||||
@ -243,7 +246,7 @@ func RecordArrival(transformationType string, start time.Time) {
|
||||
if lastToStorage.IsZero() {
|
||||
lastToStorage = start
|
||||
}
|
||||
DekCacheInterArrivals.WithLabelValues(transformationType).Observe(start.Sub(lastToStorage).Seconds())
|
||||
dekCacheInterArrivals.WithLabelValues(transformationType).Observe(start.Sub(lastToStorage).Seconds())
|
||||
lastToStorage = start
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user