Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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