VAULT-23516: Disable secret sync billing (#25091)

This commit is contained in:
miagilepner 2024-01-26 12:01:19 +01:00 committed by GitHub
parent fa54dd8c32
commit afe599145d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import (
"github.com/hashicorp/vault/helper/metricsutil"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/helper/timeutil"
"github.com/hashicorp/vault/sdk/helper/license"
"github.com/hashicorp/vault/sdk/logical"
"github.com/hashicorp/vault/vault/activity"
"go.uber.org/atomic"
@ -85,6 +86,9 @@ const (
nonEntityTokenActivityType = "non-entity-token"
entityActivityType = "entity"
secretSyncActivityType = "secret-sync"
// FeatureSecretSyncBilling will always be false
FeatureSecretSyncBilling = license.FeatureNone
)
type segmentInfo struct {
@ -1478,6 +1482,9 @@ func (a *ActivityLog) AddClientToFragment(clientID string, namespaceID string, t
// fragment. The timestamp is a Unix timestamp *without* nanoseconds,
// as that is what token.CreationTime uses.
func (a *ActivityLog) AddActivityToFragment(clientID string, namespaceID string, timestamp int64, activityType string, mountAccessor string) {
if activityType == secretSyncActivityType && !a.core.HasFeature(FeatureSecretSyncBilling) {
return
}
// Check whether entity ID already recorded
var present bool

View file

@ -4811,6 +4811,9 @@ func TestAddActivityToFragment(t *testing.T) {
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
if tc.activityType == secretSyncActivityType && !core.HasFeature(FeatureSecretSyncBilling) {
t.Skip()
}
a.fragmentLock.RLock()
numClientsBefore := len(a.fragment.Clients)
a.fragmentLock.RUnlock()