From c832e52905dc1b00b2fa4354e37b483dc13cbbe8 Mon Sep 17 00:00:00 2001 From: Shuwei Hao Date: Tue, 7 Jan 2020 06:56:23 +0800 Subject: [PATCH] add ALIBABA_CLOUD_CREDENTIALS_FILE env in deployment and daemonset installation (#2166) Signed-off-by: haoshuwei --- pkg/install/daemonset.go | 4 ++++ pkg/install/daemonset_test.go | 2 +- pkg/install/deployment.go | 4 ++++ pkg/install/deployment_test.go | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/install/daemonset.go b/pkg/install/daemonset.go index 3c39be25f..145f75b68 100644 --- a/pkg/install/daemonset.go +++ b/pkg/install/daemonset.go @@ -172,6 +172,10 @@ func DaemonSet(namespace string, opts ...podTemplateOption) *appsv1.DaemonSet { Name: "AZURE_CREDENTIALS_FILE", Value: "/credentials/cloud", }, + { + Name: "ALIBABA_CLOUD_CREDENTIALS_FILE", + Value: "/credentials/cloud", + }, }...) } diff --git a/pkg/install/daemonset_test.go b/pkg/install/daemonset_test.go index 2fd6a263d..75b44a674 100644 --- a/pkg/install/daemonset_test.go +++ b/pkg/install/daemonset_test.go @@ -34,6 +34,6 @@ func TestDaemonSet(t *testing.T) { assert.Equal(t, corev1.PullIfNotPresent, ds.Spec.Template.Spec.Containers[0].ImagePullPolicy) ds = DaemonSet("velero", WithSecret(true)) - assert.Equal(t, 6, len(ds.Spec.Template.Spec.Containers[0].Env)) + assert.Equal(t, 7, len(ds.Spec.Template.Spec.Containers[0].Env)) assert.Equal(t, 3, len(ds.Spec.Template.Spec.Volumes)) } diff --git a/pkg/install/deployment.go b/pkg/install/deployment.go index cc86e54dd..94c48d2d0 100644 --- a/pkg/install/deployment.go +++ b/pkg/install/deployment.go @@ -232,6 +232,10 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment Name: "AZURE_CREDENTIALS_FILE", Value: "/credentials/cloud", }, + { + Name: "ALIBABA_CLOUD_CREDENTIALS_FILE", + Value: "/credentials/cloud", + }, }...) } diff --git a/pkg/install/deployment_test.go b/pkg/install/deployment_test.go index 459fc979d..13970a963 100644 --- a/pkg/install/deployment_test.go +++ b/pkg/install/deployment_test.go @@ -43,7 +43,7 @@ func TestDeployment(t *testing.T) { assert.Equal(t, corev1.PullIfNotPresent, deploy.Spec.Template.Spec.Containers[0].ImagePullPolicy) deploy = Deployment("velero", WithSecret(true)) - assert.Equal(t, 6, len(deploy.Spec.Template.Spec.Containers[0].Env)) + assert.Equal(t, 7, len(deploy.Spec.Template.Spec.Containers[0].Env)) assert.Equal(t, 3, len(deploy.Spec.Template.Spec.Volumes)) deploy = Deployment("velero", WithDefaultResticMaintenanceFrequency(24*time.Hour))