diff --git a/pkg/exposer/generic_restore.go b/pkg/exposer/generic_restore.go index d498470a77..975981d49a 100644 --- a/pkg/exposer/generic_restore.go +++ b/pkg/exposer/generic_restore.go @@ -370,6 +370,7 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec VolumeMounts: volumeMounts, VolumeDevices: volumeDevices, Env: podInfo.env, + EnvFrom: podInfo.envFrom, Resources: resources, }, }, diff --git a/pkg/exposer/image.go b/pkg/exposer/image.go index 8091e12bd4..daf6c1adc0 100644 --- a/pkg/exposer/image.go +++ b/pkg/exposer/image.go @@ -31,6 +31,7 @@ type inheritedPodInfo struct { image string serviceAccount string env []v1.EnvVar + envFrom []v1.EnvFromSource volumeMounts []v1.VolumeMount volumes []v1.Volume logLevelArgs []string @@ -53,6 +54,7 @@ func getInheritedPodInfo(ctx context.Context, client kubernetes.Interface, veler podInfo.serviceAccount = podSpec.ServiceAccountName podInfo.env = podSpec.Containers[0].Env + podInfo.envFrom = podSpec.Containers[0].EnvFrom podInfo.volumeMounts = podSpec.Containers[0].VolumeMounts podInfo.volumes = podSpec.Volumes diff --git a/pkg/exposer/image_test.go b/pkg/exposer/image_test.go index b9aaf51ebc..1a2e038f0d 100644 --- a/pkg/exposer/image_test.go +++ b/pkg/exposer/image_test.go @@ -67,6 +67,22 @@ func TestGetInheritedPodInfo(t *testing.T) { Value: "value-2", }, }, + EnvFrom: []v1.EnvFromSource{ + { + ConfigMapRef: &v1.ConfigMapEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-configmap", + }, + }, + }, + { + SecretRef: &v1.SecretEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-secret", + }, + }, + }, + }, VolumeMounts: []v1.VolumeMount{ { Name: "volume-1", @@ -116,6 +132,22 @@ func TestGetInheritedPodInfo(t *testing.T) { Value: "value-2", }, }, + EnvFrom: []v1.EnvFromSource{ + { + ConfigMapRef: &v1.ConfigMapEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-configmap", + }, + }, + }, + { + SecretRef: &v1.SecretEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-secret", + }, + }, + }, + }, VolumeMounts: []v1.VolumeMount{ { Name: "volume-1", @@ -191,6 +223,22 @@ func TestGetInheritedPodInfo(t *testing.T) { Value: "value-2", }, }, + envFrom: []v1.EnvFromSource{ + { + ConfigMapRef: &v1.ConfigMapEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-configmap", + }, + }, + }, + { + SecretRef: &v1.SecretEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-secret", + }, + }, + }, + }, volumeMounts: []v1.VolumeMount{ { Name: "volume-1", @@ -228,6 +276,22 @@ func TestGetInheritedPodInfo(t *testing.T) { Value: "value-2", }, }, + envFrom: []v1.EnvFromSource{ + { + ConfigMapRef: &v1.ConfigMapEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-configmap", + }, + }, + }, + { + SecretRef: &v1.SecretEnvSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: "test-secret", + }, + }, + }, + }, volumeMounts: []v1.VolumeMount{ { Name: "volume-1",