From 51a945fcdf67d4af9ddf6d0be37a58db0f9a9864 Mon Sep 17 00:00:00 2001 From: Pavan Navarathna Devaraj Date: Tue, 15 Oct 2019 17:07:24 -0700 Subject: [PATCH] Honor the image argument in functions (#363) --- pkg/function/restore_data.go | 7 ++++--- pkg/function/restore_data_all.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/function/restore_data.go b/pkg/function/restore_data.go index 7104c33dd3..af124fe54a 100644 --- a/pkg/function/restore_data.go +++ b/pkg/function/restore_data.go @@ -123,7 +123,8 @@ func fetchPodVolumes(pod string, tp param.TemplateParams) (map[string]string, er } } -func restoreData(ctx context.Context, cli kubernetes.Interface, tp param.TemplateParams, namespace, encryptionKey, backupArtifactPrefix, restorePath, backupTag, backupID, jobPrefix string, vols map[string]string, podOverride sp.JSONMap) (map[string]interface{}, error) { +func restoreData(ctx context.Context, cli kubernetes.Interface, tp param.TemplateParams, namespace, encryptionKey, backupArtifactPrefix, restorePath, backupTag, backupID, jobPrefix, image string, + vols map[string]string, podOverride sp.JSONMap) (map[string]interface{}, error) { // Validate volumes for pvc := range vols { if _, err := cli.CoreV1().PersistentVolumeClaims(namespace).Get(pvc, metav1.GetOptions{}); err != nil { @@ -133,7 +134,7 @@ func restoreData(ctx context.Context, cli kubernetes.Interface, tp param.Templat options := &kube.PodOptions{ Namespace: namespace, GenerateName: jobPrefix, - Image: kanisterToolsImage, + Image: image, Command: []string{"sh", "-c", "tail -f /dev/null"}, Volumes: vols, PodOverride: podOverride, @@ -222,7 +223,7 @@ func (*restoreDataFunc) Exec(ctx context.Context, tp param.TemplateParams, args if err != nil { return nil, errors.Wrapf(err, "Failed to create Kubernetes client") } - return restoreData(ctx, cli, tp, namespace, encryptionKey, backupArtifactPrefix, restorePath, backupTag, backupID, restoreDataJobPrefix, vols, podOverride) + return restoreData(ctx, cli, tp, namespace, encryptionKey, backupArtifactPrefix, restorePath, backupTag, backupID, restoreDataJobPrefix, image, vols, podOverride) } func (*restoreDataFunc) RequiredArgs() []string { diff --git a/pkg/function/restore_data_all.go b/pkg/function/restore_data_all.go index c51b78194d..af522a6870 100644 --- a/pkg/function/restore_data_all.go +++ b/pkg/function/restore_data_all.go @@ -146,7 +146,7 @@ func (*restoreDataAllFunc) Exec(ctx context.Context, tp param.TemplateParams, ar outputChan <- out return } - out, err = restoreData(ctx, cli, tp, namespace, encryptionKey, fmt.Sprintf("%s/%s", backupArtifactPrefix, pod), restorePath, "", input[pod].BackupID, restoreDataAllJobPrefix, vols, podOverride) + out, err = restoreData(ctx, cli, tp, namespace, encryptionKey, fmt.Sprintf("%s/%s", backupArtifactPrefix, pod), restorePath, "", input[pod].BackupID, restoreDataAllJobPrefix, image, vols, podOverride) errChan <- errors.Wrapf(err, "Failed to restore data for pod %s", pod) outputChan <- out }(pod)