Skip to content

Commit 25f3c5f

Browse files
committed
fixup: google env vars and docs
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent 3a9b29d commit 25f3c5f

3 files changed

Lines changed: 62 additions & 17 deletions

File tree

api/core/v1beta1/featureflagsource_types.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,12 @@ func (fc *FeatureFlagSourceSpec) Merge(new *FeatureFlagSourceSpec) {
266266
}
267267

268268
func (fc *FeatureFlagSourceSpec) decorateEnvVarName(original string) string {
269-
// Credential env vars for cloud blob sync providers must reach the sidecar
270-
// unmodified — flagd/gocloud reads the vendor-native names directly
271-
// (AZURE_STORAGE_* for azblob, AWS_* for s3).
272-
if strings.HasPrefix(original, "AZURE_STORAGE") || strings.HasPrefix(original, "AWS_") {
269+
// credential env vars for cloud blob sync providers must reach the sidecar
270+
// unmodified; flagd/gocloud reads the vendor-native names directly
271+
// (AZURE_STORAGE_* for azblob, AWS_* for s3, GOOGLE_* for gcs)
272+
if strings.HasPrefix(original, "AZURE_STORAGE") ||
273+
strings.HasPrefix(original, "AWS_") ||
274+
strings.HasPrefix(original, "GOOGLE_") {
273275
return original
274276
}
275277
return common.EnvVarKey(fc.EnvVarPrefix, original)

api/core/v1beta1/featureflagsource_types_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ func Test_FLagSourceConfiguration_ToEnvVars(t *testing.T) {
254254
Name: "AWS_REGION",
255255
Value: "us-east-1",
256256
},
257+
{
258+
Name: "GOOGLE_APPLICATION_CREDENTIALS",
259+
Value: "/var/run/secrets/gcp/key.json",
260+
},
257261
},
258262
EnvVarPrefix: "PRE",
259263
ManagementPort: 22,
@@ -288,6 +292,10 @@ func Test_FLagSourceConfiguration_ToEnvVars(t *testing.T) {
288292
Name: "AWS_REGION",
289293
Value: "us-east-1",
290294
},
295+
{
296+
Name: "GOOGLE_APPLICATION_CREDENTIALS",
297+
Value: "/var/run/secrets/gcp/key.json",
298+
},
291299
{
292300
Name: "PRE_MANAGEMENT_PORT",
293301
Value: "22",

docs/feature_flag_source.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,60 @@ sources:
8383
selector: 'source=database,app=weatherapp' # flag filtering options
8484
```
8585

86-
### Azure Blob Storage
86+
### Cloud blob storage providers
87+
88+
The `azblob`, `gcs`, and `s3` providers use [Go CDK](https://gocloud.dev/howto/blob/)
89+
to access cloud object storage. Because the underlying SDKs expect their
90+
native credential env vars (e.g. `AWS_ACCESS_KEY_ID`,
91+
`GOOGLE_APPLICATION_CREDENTIALS`, `AZURE_STORAGE_ACCOUNT`), the operator
92+
forwards env vars matching the following prefixes to the flagd sidecar
93+
**without** applying the configured `envVarPrefix`:
94+
95+
| Provider | Passthrough prefix |
96+
|----------|--------------------|
97+
| `azblob` | `AZURE_STORAGE_*` |
98+
| `gcs` | `GOOGLE_*` |
99+
| `s3` | `AWS_*` |
100+
101+
All other env vars are prefixed as usual (e.g. `FLAGD_MY_VAR`).
102+
103+
#### Azure Blob Storage
87104

88105
Given below is an example configuration with provider type `azblob` and supported options,
89106

90107
```yaml
91108
sources:
92109
- source: azblob://my-bucket/test.json # my-bucket - container name
93110
provider: azblob
94-
envVars:
95-
- name: AZURE_STORAGE_ACCOUNT
96-
value: <account_name>
97-
- name: AZURE_STORAGE_SAS_TOKEN
98-
value: <SAS token>
111+
envVars:
112+
- name: AZURE_STORAGE_ACCOUNT
113+
value: <account_name>
114+
- name: AZURE_STORAGE_SAS_TOKEN
115+
value: <SAS token>
99116
```
100-
Other type of credentials for Azure Blob Storage are supported, for details (see [AZ credentials config](https://pkg.go.dev/gocloud.dev/blob/azureblob#hdr-URLs))
101117

102-
### Amazon S3
118+
Other types of credentials for Azure Blob Storage are supported; for details see
119+
[AZ credentials config](https://pkg.go.dev/gocloud.dev/blob/azureblob#hdr-URLs).
120+
121+
#### Google Cloud Storage
122+
123+
Given below is an example configuration with provider type `gcs` and supported options,
124+
125+
```yaml
126+
sources:
127+
- source: gs://my-bucket/flags.json # my-bucket - GCS bucket name
128+
provider: gcs
129+
interval: 10 # optional polling interval in seconds, defaults to 5
130+
envVars:
131+
- name: GOOGLE_APPLICATION_CREDENTIALS
132+
value: /var/run/secrets/gcp/key.json
133+
```
134+
135+
On GKE, prefer [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
136+
over static credentials. For the full set of supported URL options see
137+
the [gocloud `blob/gcsblob` URL reference](https://pkg.go.dev/gocloud.dev/blob/gcsblob#hdr-URLs).
138+
139+
#### Amazon S3
103140

104141
Given below is an example configuration with provider type `s3` and supported options,
105142

@@ -123,11 +160,9 @@ envVars:
123160
key: secret-access-key
124161
```
125162

126-
Any env var beginning with `AWS_` is forwarded to the flagd sidecar unmodified
127-
(the `FLAGD` prefix is not applied), so the standard AWS SDK credential chain
128-
works without further wiring. On EKS, prefer [IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html)
129-
or EKS Pod Identity over static access keys — both auto-inject the right
130-
`AWS_*` variables on the pod's service account.
163+
On EKS, prefer [IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html)
164+
or EKS Pod Identity over static access keys; both auto-inject the right
165+
`AWS_*` variables via the pod's service account.
131166

132167
For S3-compatible endpoints such as MinIO or LocalStack, set
133168
`AWS_ENDPOINT_URL_S3` and (usually) `AWS_S3_FORCE_PATH_STYLE=true`, or pass

0 commit comments

Comments
 (0)