Skip to content

Commit

Permalink
Remove usage of *_STORAGE_API_ENDPOINT` environment variables for pro…
Browse files Browse the repository at this point in the history
…viders (#856)

* Remove usage of `*_STORAGE_API_ENDPOINT` environment variables for providers

* update TODO comment
  • Loading branch information
shreyas-s-rao authored Sep 9, 2024
1 parent 92a3192 commit d3ac301
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 31 deletions.
1 change: 1 addition & 0 deletions config/samples/etcd-secret-azurite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ data:
storageAccount: ZGV2c3RvcmVhY2NvdW50MQ==
storageKey: RWJ5OHZkTTAyeE5PY3FGbHFVd0pQTGxtRXRsQ0RYSjFPVXpGVDUwdVNSWjZJRnN1RnEyVVZFckN6NEk2dHEvSzFTWkZQVE90ci9LQkhCZWtzb0dNR3c9PQ==
emulatorEnabled: dHJ1ZQ== # true
# TODO: replace with `domain` once we support using [production-style URLs](https://github.com/Azure/Azurite?tab=readme-ov-file#production-style-url) for Azurite
storageAPIEndpoint: aHR0cDovL2F6dXJpdGUtc2VydmljZToxMDAwMA== # http://azurite-service:10000, emulatorEnabled has to be true
1 change: 0 additions & 1 deletion hack/ci-e2e-kind-azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ echo -n "${STORAGE_KEY}" > "${AZURE_APPLICATION_CREDENTIALS}/storageKey"
make deploy-azurite
make STORAGE_ACCOUNT="${STORAGE_ACCOUNT}" \
STORAGE_KEY="${STORAGE_KEY}" \
AZURE_STORAGE_API_ENDPOINT="${AZURITE_ENDPOINT}" \
AZURE_EMULATOR_ENABLED="true" \
AZURITE_HOST="${AZURITE_HOST}" \
AZURE_STORAGE_CONNECTION_STRING="${AZURE_STORAGE_CONNECTION_STRING}" \
Expand Down
4 changes: 0 additions & 4 deletions internal/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,8 @@ const (
EnvAzureApplicationCredentials = "AZURE_APPLICATION_CREDENTIALS"
// EnvAzureEmulatorEnabled is the environment variable key that is checked to see if the Azure storage emulator Azurite is enabled.
EnvAzureEmulatorEnabled = "AZURE_EMULATOR_ENABLED"
// EnvAzureStorageAPIEndpoint is the environment variable key for Azure storage API endpoint override.
EnvAzureStorageAPIEndpoint = "AZURE_STORAGE_API_ENDPOINT"
// EnvGoogleApplicationCredentials is the environment variable key for Google application credentials.
EnvGoogleApplicationCredentials = "GOOGLE_APPLICATION_CREDENTIALS"
// EnvGoogleStorageAPIEndpoint is the environment variable key for Google storage API endpoint override.
EnvGoogleStorageAPIEndpoint = "GOOGLE_STORAGE_API_ENDPOINT"
// EnvOpenstackApplicationCredentials is the environment variable key for OpenStack application credentials.
EnvOpenstackApplicationCredentials = "OPENSTACK_APPLICATION_CREDENTIALS"
// EnvAlicloudApplicationCredentials is the environment variable key for Alicloud application credentials.
Expand Down
2 changes: 0 additions & 2 deletions internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ func GetProviderEnvVars(store *druidv1alpha1.StoreSpec) ([]corev1.EnvVar, error)
case ABS:
envVars = append(envVars, utils.GetEnvVarFromValue(common.EnvAzureApplicationCredentials, common.VolumeMountPathNonGCSProviderBackupSecret))
envVars = append(envVars, utils.GetEnvVarFromSecret(common.EnvAzureEmulatorEnabled, store.SecretRef.Name, "emulatorEnabled", true))
envVars = append(envVars, utils.GetEnvVarFromSecret(common.EnvAzureStorageAPIEndpoint, store.SecretRef.Name, "storageAPIEndpoint", true))

case GCS:
envVars = append(envVars, utils.GetEnvVarFromValue(common.EnvGoogleApplicationCredentials, fmt.Sprintf("%sserviceaccount.json", common.VolumeMountPathGCSBackupSecret)))
envVars = append(envVars, utils.GetEnvVarFromSecret(common.EnvGoogleStorageAPIEndpoint, store.SecretRef.Name, "storageAPIEndpoint", true))

case Swift:
envVars = append(envVars, utils.GetEnvVarFromValue(common.EnvOpenstackApplicationCredentials, common.VolumeMountPathNonGCSProviderBackupSecret))
Expand Down
1 change: 1 addition & 0 deletions test/e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ func getProviders() ([]TestProvider, error) {
azuriteHost := getEnvOrFallback("AZURITE_HOST", "")
if azuriteHost != "" {
provider.Storage.SecretData["emulatorEnabled"] = []byte("true")
// TODO: replace with `domain`
provider.Storage.SecretData["storageAPIEndpoint"] = []byte("http://" + azuriteHost)
}
}
Expand Down
24 changes: 0 additions & 24 deletions test/integration/controllers/compaction/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,18 +420,6 @@ func validateStoreGCPForCompactionJob(instance *druidv1alpha1.Etcd, j *batchv1.J
"Name": Equal(common.EnvGoogleApplicationCredentials),
"Value": Equal("/var/.gcp/serviceaccount.json"),
}),
common.EnvGoogleStorageAPIEndpoint: MatchFields(IgnoreExtras, Fields{
"Name": Equal(common.EnvGoogleStorageAPIEndpoint),
"ValueFrom": PointTo(MatchFields(IgnoreExtras, Fields{
"SecretKeyRef": PointTo(MatchFields(IgnoreExtras, Fields{
"LocalObjectReference": MatchFields(IgnoreExtras, Fields{
"Name": Equal(instance.Spec.Backup.Store.SecretRef.Name),
}),
"Key": Equal("storageAPIEndpoint"),
"Optional": Equal(ptr.To(true)),
})),
})),
}),
}),
}),
}),
Expand Down Expand Up @@ -556,18 +544,6 @@ func validateStoreAzureForCompactionJob(instance *druidv1alpha1.Etcd, j *batchv1
})),
})),
}),
common.EnvAzureStorageAPIEndpoint: MatchFields(IgnoreExtras, Fields{
"Name": Equal(common.EnvAzureStorageAPIEndpoint),
"ValueFrom": PointTo(MatchFields(IgnoreExtras, Fields{
"SecretKeyRef": PointTo(MatchFields(IgnoreExtras, Fields{
"LocalObjectReference": MatchFields(IgnoreExtras, Fields{
"Name": Equal(instance.Spec.Backup.Store.SecretRef.Name),
}),
"Key": Equal("storageAPIEndpoint"),
"Optional": Equal(ptr.To(true)),
})),
})),
}),
}),
}),
}),
Expand Down

0 comments on commit d3ac301

Please sign in to comment.