Skip to content

Commit a6d651f

Browse files
committed
security: address a couple of nits in a recent change
I don't see why we would make the cluster setting a SystemVisible given that it affects every tenant and seems ok to be allowed for a tenant to change. Also there was a typo in the setting name as well as we should've registered the setting as ByteSize (which gives non-negative int validation). Additionally, unify the logging channels used for the error message (both will now go to DEV). Release note: None
1 parent 5aaab78 commit a6d651f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/security/certificate_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ func (cm *CertificateManager) RegisterSignalHandler(
198198
})
199199
}
200200

201-
var CertCacheMemLimit = settings.RegisterIntSetting(
202-
settings.SystemVisible,
203-
"security.clienc_cert.cache_memory_limit",
201+
var certCacheMemLimit = settings.RegisterByteSizeSetting(
202+
settings.ApplicationLevel,
203+
"security.client_cert.cache_memory_limit",
204204
"memory limit for the client certificate expiration cache",
205205
1<<29, // 512MiB
206206
)
@@ -214,7 +214,7 @@ func (cm *CertificateManager) RegisterExpirationCache(
214214
parentMon *mon.BytesMonitor,
215215
st *cluster.Settings,
216216
) error {
217-
limit := CertCacheMemLimit.Get(&st.SV)
217+
limit := certCacheMemLimit.Get(&st.SV)
218218
m := mon.NewMonitorInheritWithLimit(mon.MakeName("client-expiration-caches"), limit, parentMon, true /* longLiving */)
219219
acc := m.MakeConcurrentBoundAccount()
220220
m.StartNoReserved(ctx, parentMon)

pkg/security/clientcert/cert_expiry_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *Cache) Upsert(ctx context.Context, user string, serial string, newExpir
9999
if _, ok := c.cache[user]; !ok {
100100
err := c.account.Grow(ctx, 2*GaugeSize)
101101
if err != nil {
102-
log.Ops.Warningf(ctx, "no memory available to cache cert expiry: %v", err)
102+
log.Warningf(ctx, "no memory available to cache cert expiry: %v", err)
103103
return
104104
}
105105
c.cache[user] = map[string]certInfo{}

0 commit comments

Comments
 (0)