events: Enable by default, disable flag (#22815)

The flag `events.alpha1` will no longer do anything, but we keep it
to prevent breaking users who have it in their configurations or
startup flags, or if it is referenced in other code.
This commit is contained in:
Christopher Swenson
2023-09-07 11:27:14 -07:00
committed by GitHub
parent 9af1c4a183
commit 7f7907d3a0
10 changed files with 58 additions and 58 deletions

View File

@@ -3,10 +3,15 @@
package experiments
import "slices"
const (
VaultExperimentEventsAlpha1 = "events.alpha1"
VaultExperimentCoreAuditEventsAlpha1 = "core.audit.events.alpha1"
VaultExperimentSecretsSyncAlpha1 = "secrets.sync.alpha1"
// Unused experiments. We keep them so that we don't break users who include them in their
// flags or configs, but they no longer have any effect.
VaultExperimentEventsAlpha1 = "events.alpha1"
)
var validExperiments = []string{
@@ -15,11 +20,18 @@ var validExperiments = []string{
VaultExperimentSecretsSyncAlpha1,
}
// ValidExperiments exposes the list without exposing a mutable global variable.
// Experiments can only be enabled when starting a server, and will typically
// enable pre-GA API functionality.
func ValidExperiments() []string {
result := make([]string, len(validExperiments))
copy(result, validExperiments)
return result
var unusedExperiments = []string{
VaultExperimentEventsAlpha1,
}
// ValidExperiments exposes the list of valid experiments without exposing a mutable
// global variable. Experiments can only be enabled when starting a server, and will
// typically enable pre-GA API functionality.
func ValidExperiments() []string {
return slices.Clone(validExperiments)
}
// IsUnused returns true if the given experiment is in the unused list.
func IsUnused(experiment string) bool {
return slices.Contains(unusedExperiments, experiment)
}