From 83e0448f41026997454878131ad1c5c7bbf63c3c Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Mon, 28 Oct 2024 10:37:23 -0600 Subject: [PATCH] Re-add flag and deprecate --- pkg/cmd/serve.go | 11 +++++++++++ pkg/cmd/server/server.go | 23 ++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/pkg/cmd/serve.go b/pkg/cmd/serve.go index 6a98e4bd3e..7f91cb4a2e 100644 --- a/pkg/cmd/serve.go +++ b/pkg/cmd/serve.go @@ -8,6 +8,7 @@ import ( "github.com/fatih/color" "github.com/jzelinskie/cobrautil/v2" "github.com/jzelinskie/cobrautil/v2/cobraotel" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/authzed/spicedb/internal/telemetry" @@ -158,6 +159,16 @@ func RegisterServeFlags(cmd *cobra.Command, config *server.Config) error { experimentalFlags := nfs.FlagSet(BoldBlue("Experimental")) // Flags for experimental features + experimentalFlags.BoolVar(&config.EnableExperimentalLookupResources, "enable-experimental-lookup-resources", true, "enables the experimental version of the lookup resources API") + if err := experimentalFlags.MarkDeprecated("enable-experimental-lookup-resources", "The old implementation of LookupResources has been removed and this flag is a no-op. This flag will be removed in the future."); err != nil { + return fmt.Errorf("failed to mark flag as deprecated: %w", err) + } + if !config.EnableExperimentalLookupResources { + log.Warn(). + Bool("value", false). + Msg("The old implementation of LookupResources is no longer available, and a `false` value is no longer valid. Please remove this flag.") + } + experimentalFlags.BoolVar(&config.EnableExperimentalWatchableSchemaCache, "enable-experimental-watchable-schema-cache", false, "enables the experimental schema cache which makes use of the Watch API for automatic updates") // TODO: these two could reasonably be put in either the Dispatch group or the Experimental group. Is there a preference? experimentalFlags.StringToStringVar(&config.DispatchSecondaryUpstreamAddrs, "experimental-dispatch-secondary-upstream-addrs", nil, "secondary upstream addresses for dispatches, each with a name") diff --git a/pkg/cmd/server/server.go b/pkg/cmd/server/server.go index 78d9d8b7ab..e8c1a52f17 100644 --- a/pkg/cmd/server/server.go +++ b/pkg/cmd/server/server.go @@ -107,17 +107,18 @@ type Config struct { ClusterDispatchCacheConfig CacheConfig `debugmap:"visible"` // API Behavior - DisableV1SchemaAPI bool `debugmap:"visible"` - V1SchemaAdditiveOnly bool `debugmap:"visible"` - MaximumUpdatesPerWrite uint16 `debugmap:"visible"` - MaximumPreconditionCount uint16 `debugmap:"visible"` - MaxDatastoreReadPageSize uint64 `debugmap:"visible"` - StreamingAPITimeout time.Duration `debugmap:"visible"` - WatchHeartbeat time.Duration `debugmap:"visible"` - MaxReadRelationshipsLimit uint32 `debugmap:"visible"` - MaxDeleteRelationshipsLimit uint32 `debugmap:"visible"` - MaxLookupResourcesLimit uint32 `debugmap:"visible"` - MaxBulkExportRelationshipsLimit uint32 `debugmap:"visible"` + DisableV1SchemaAPI bool `debugmap:"visible"` + V1SchemaAdditiveOnly bool `debugmap:"visible"` + MaximumUpdatesPerWrite uint16 `debugmap:"visible"` + MaximumPreconditionCount uint16 `debugmap:"visible"` + MaxDatastoreReadPageSize uint64 `debugmap:"visible"` + StreamingAPITimeout time.Duration `debugmap:"visible"` + WatchHeartbeat time.Duration `debugmap:"visible"` + MaxReadRelationshipsLimit uint32 `debugmap:"visible"` + MaxDeleteRelationshipsLimit uint32 `debugmap:"visible"` + MaxLookupResourcesLimit uint32 `debugmap:"visible"` + MaxBulkExportRelationshipsLimit uint32 `debugmap:"visible"` + EnableExperimentalLookupResources bool `debugmap:"visible"` // Additional Services MetricsAPI util.HTTPServerConfig `debugmap:"visible"`