diff --git a/api/core/v1beta1/common/common.go b/api/core/v1beta1/common/common.go index fef1712fa..b07d953fa 100644 --- a/api/core/v1beta1/common/common.go +++ b/api/core/v1beta1/common/common.go @@ -11,6 +11,7 @@ type SyncProviderType string const ( SyncProviderKubernetes SyncProviderType = "kubernetes" SyncProviderFilepath SyncProviderType = "file" + SyncProviderGcs SyncProviderType = "gcs" SyncProviderHttp SyncProviderType = "http" SyncProviderGrpc SyncProviderType = "grpc" SyncProviderFlagdProxy SyncProviderType = "flagd-proxy" @@ -57,6 +58,10 @@ func (s SyncProviderType) IsHttp() bool { return s == SyncProviderHttp } +func (s SyncProviderType) IsGcs() bool { + return s == SyncProviderGcs +} + func (s SyncProviderType) IsFilepath() bool { return s == SyncProviderFilepath } diff --git a/api/core/v1beta1/common/common_test.go b/api/core/v1beta1/common/common_test.go index 7aefcf87b..5f6d0b557 100644 --- a/api/core/v1beta1/common/common_test.go +++ b/api/core/v1beta1/common/common_test.go @@ -12,16 +12,19 @@ func Test_FeatureFlagSource_SyncProvider(t *testing.T) { f := SyncProviderFilepath h := SyncProviderHttp g := SyncProviderGrpc + gcs := SyncProviderGcs require.True(t, k.IsKubernetes()) require.True(t, f.IsFilepath()) require.True(t, h.IsHttp()) require.True(t, g.IsGrpc()) + require.True(t, gcs.IsGcs()) require.False(t, f.IsKubernetes()) require.False(t, h.IsFilepath()) require.False(t, k.IsGrpc()) require.False(t, g.IsHttp()) + require.False(t, g.IsGcs()) } func Test_FLagSourceConfiguration_EnvVarKey(t *testing.T) { diff --git a/internal/common/flagdinjector/flagdinjector.go b/internal/common/flagdinjector/flagdinjector.go index 94b72115a..8ac6ea239 100644 --- a/internal/common/flagdinjector/flagdinjector.go +++ b/internal/common/flagdinjector/flagdinjector.go @@ -230,6 +230,8 @@ func (fi *FlagdContainerInjector) newSourceConfig(ctx context.Context, source ap sourceCfg, err = fi.toFilepathProviderConfig(ctx, objectMeta, podSpec, sidecar, source) case source.Provider.IsHttp(): sourceCfg = fi.toHttpProviderConfig(source) + case source.Provider.IsGcs(): + sourceCfg = fi.toGcsConfig(source) case source.Provider.IsGrpc(): sourceCfg = fi.toGrpcProviderConfig(source) case source.Provider.IsFlagdProxy(): @@ -306,6 +308,14 @@ func (fi *FlagdContainerInjector) toHttpProviderConfig(source api.Source) types. } } +func (fi *FlagdContainerInjector) toGcsConfig(source api.Source) types.SourceConfig { + return types.SourceConfig{ + URI: source.Source, + Provider: string(apicommon.SyncProviderGcs), + Interval: source.Interval, + } +} + func (fi *FlagdContainerInjector) toGrpcProviderConfig(source api.Source) types.SourceConfig { return types.SourceConfig{ URI: source.Source,