Skip to content

Commit ba84465

Browse files
committed
feat(flagd): add support for azure blob
- fix for ToEnvVars function to not add prefix for Azure blob related env vars Signed-off-by: vmai <[email protected]>
1 parent ca1bf86 commit ba84465

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

api/core/v1beta1/featureflagsource_types.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1beta1
1818

1919
import (
2020
"fmt"
21+
"strings"
2122

2223
"github.com/open-feature/open-feature-operator/apis/core/v1beta1/common"
2324
corev1 "k8s.io/api/core/v1"
@@ -209,12 +210,19 @@ func (fc *FeatureFlagSourceSpec) Merge(new *FeatureFlagSourceSpec) {
209210
}
210211
}
211212

213+
func (fc *FeatureFlagSourceSpec) decorateEnvVarName(original string) string {
214+
if strings.HasPrefix(original, "AZURE_STORAGE") {
215+
return original
216+
}
217+
return common.EnvVarKey(fc.EnvVarPrefix, original)
218+
}
219+
212220
func (fc *FeatureFlagSourceSpec) ToEnvVars() []corev1.EnvVar {
213221
envs := []corev1.EnvVar{}
214222

215223
for _, envVar := range fc.EnvVars {
216224
envs = append(envs, corev1.EnvVar{
217-
Name: common.EnvVarKey(fc.EnvVarPrefix, envVar.Name),
225+
Name: fc.decorateEnvVarName(envVar.Name),
218226
Value: envVar.Value,
219227
})
220228
}

api/core/v1beta1/featureflagsource_types_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ func Test_FLagSourceConfiguration_ToEnvVars(t *testing.T) {
180180
Name: "env2",
181181
Value: "val2",
182182
},
183+
{
184+
Name: "AZURE_STORAGE_ACCOUNT",
185+
Value: "account123",
186+
},
187+
{
188+
Name: "AZURE_STORAGE_KEY",
189+
Value: "key456",
190+
},
183191
},
184192
EnvVarPrefix: "PRE",
185193
ManagementPort: 22,
@@ -198,6 +206,14 @@ func Test_FLagSourceConfiguration_ToEnvVars(t *testing.T) {
198206
Name: "PRE_env2",
199207
Value: "val2",
200208
},
209+
{
210+
Name: "AZURE_STORAGE_ACCOUNT",
211+
Value: "account123",
212+
},
213+
{
214+
Name: "AZURE_STORAGE_KEY",
215+
Value: "key456",
216+
},
201217
{
202218
Name: "PRE_MANAGEMENT_PORT",
203219
Value: "22",

chart/open-feature-operator/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ sidecarConfiguration:
4141
## @param sidecarConfiguration.providerArgs Used to append arguments to the sidecar startup command. This value is a comma separated string of key values separated by '=', e.g. `key=value,key2=value2` results in the appending of `--sync-provider-args key=value --sync-provider-args key2=value2`.
4242
providerArgs: ""
4343
## @param sidecarConfiguration.envVarPrefix Sets the prefix for all environment variables set in the injected sidecar.
44-
## Needs to be empty to support azblob sync type
4544
envVarPrefix: "FLAGD"
4645
## @param sidecarConfiguration.defaultSyncProvider Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 4 valid sync providers: `kubernetes`, `grpc`, `file` and `http`.
4746
defaultSyncProvider: kubernetes

docs/feature_flag_source.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Given below is an example configuration with provider type `azblob` and supporte
9191
sources:
9292
- source: azblob://my-bucket/test.json # my-bucket - container name
9393
provider: azblob
94-
envVarPrefix: "" # MUST be empty to prevent adding prefix to next env vars
9594
envVars:
9695
- name: AZURE_STORAGE_ACCOUNT
9796
value: <account_name>

0 commit comments

Comments
 (0)