Skip to content

Commit

Permalink
Honor the image argument in functions (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavannd1 authored and mergify[bot] committed Oct 16, 2019
1 parent 41709ab commit 51a945f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/function/restore_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/function/restore_data_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 51a945f

Please sign in to comment.