Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manual licese reporting persist snapshots CE (#25021) #25051

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ func (c *Core) setupActivityLogLocked(ctx context.Context, wg *sync.WaitGroup) e
close(manager.retentionDone)
}(manager.retentionMonths)

manager.CensusReportDone = make(chan bool)
manager.CensusReportDone = make(chan bool, 1)
go c.activityLog.CensusReport(ctx, c.CensusAgent(), c.BillingStart())
}

Expand Down
17 changes: 9 additions & 8 deletions vault/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import "time"
// CensusAgent is a stub for OSS
type CensusReporter interface{}

// setupCensusAgent is a stub for OSS.
func (c *Core) setupCensusAgent() error { return nil }
func (c *Core) BillingStart() time.Time { return time.Time{} }
func (c *Core) AutomatedLicenseReportingEnabled() bool { return false }
func (c *Core) CensusAgent() CensusReporter { return nil }
func (c *Core) ReloadCensus() error { return nil }
func (c *Core) teardownCensusAgent() error { return nil }
func (c *Core) ManualLicenseReportingEnabled() bool { return false }
func (c *Core) setupCensusManager() error { return nil }
func (c *Core) BillingStart() time.Time { return time.Time{} }
func (c *Core) AutomatedLicenseReportingEnabled() bool { return false }
func (c *Core) CensusAgent() CensusReporter { return nil }
func (c *Core) ReloadCensus() error { return nil }
func (c *Core) teardownCensusManager() error { return nil }
func (c *Core) StartManualCensusSnapshots() {}
func (c *Core) ManualLicenseReportingEnabled() bool { return false }
func (c *Core) ManualCensusSnapshotInterval() time.Duration { return time.Duration(0) }
20 changes: 11 additions & 9 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ type Core struct {
// it is protected by activityLogLock
activityLogConfig ActivityLogCoreConfig

censusConfig atomic.Value

// activeTime is set on active nodes indicating the time at which this node
// became active.
activeTime time.Time
Expand Down Expand Up @@ -831,9 +829,6 @@ type CoreConfig struct {
LicensePath string
LicensingConfig *LicensingConfig

// Configured Census Agent
CensusAgent CensusReporter

DisablePerformanceStandby bool
DisableIndexing bool
DisableKeyEncodingChecks bool
Expand Down Expand Up @@ -2466,15 +2461,22 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
return err
}

if err := c.setupCensusAgent(); err != nil {
c.logger.Error("skipping reporting for nil agent", "error", err)
if !c.perfStandby {
if err := c.setupCensusManager(); err != nil {
logger.Error("skipping license reporting for nil agent", "error", err)
}
}

// not waiting on wg to avoid changing existing behavior
var wg sync.WaitGroup
if err := c.setupActivityLog(ctx, &wg); err != nil {
return err
}

if !c.perfStandby {
c.StartManualCensusSnapshots()
}

} else {
var err error
disableEventLogger, err := parseutil.ParseBool(os.Getenv(featureFlagDisableEventLogger))
Expand Down Expand Up @@ -2725,8 +2727,8 @@ func (c *Core) preSeal() error {
result = multierror.Append(result, fmt.Errorf("error stopping expiration: %w", err))
}
c.stopActivityLog()
// Clean up the censusAgent on seal
if err := c.teardownCensusAgent(); err != nil {
// Clean up census on seal
if err := c.teardownCensusManager(); err != nil {
result = multierror.Append(result, fmt.Errorf("error tearing down reporting agent: %w", err))
}

Expand Down
1 change: 0 additions & 1 deletion vault/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ func TestCoreWithSealAndUINoCleanup(t testing.T, opts *CoreConfig) *Core {
conf.PluginDirectory = opts.PluginDirectory
conf.DetectDeadlocks = opts.DetectDeadlocks
conf.Experiments = opts.Experiments
conf.CensusAgent = opts.CensusAgent
conf.AdministrativeNamespacePath = opts.AdministrativeNamespacePath
conf.ImpreciseLeaseRoleTracking = opts.ImpreciseLeaseRoleTracking

Expand Down
Loading