Honor PodOverride in BackupDataStats
@@ -22,6 +22,7 @@ import (
"k8s.io/client-go/kubernetes"
kanister "github.com/kanisterio/kanister/pkg"
+ crv1alpha1 "github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/kanisterio/kanister/pkg/format"
"github.com/kanisterio/kanister/pkg/kube"
"github.com/kanisterio/kanister/pkg/param"
@@ -60,12 +61,13 @@ func (*BackupDataStatsFunc) Name() string {
return BackupDataStatsFuncName
}
-func backupDataStats(ctx context.Context, cli kubernetes.Interface, tp param.TemplateParams, namespace, encryptionKey, backupArtifactPrefix, backupID, mode, jobPrefix string) (map[string]interface{}, error) {
+func backupDataStats(ctx context.Context, cli kubernetes.Interface, tp param.TemplateParams, namespace, encryptionKey, backupArtifactPrefix, backupID, mode, jobPrefix string, podOverride crv1alpha1.JSONMap) (map[string]interface{}, error) {
options := &kube.PodOptions{
Namespace: namespace,
GenerateName: jobPrefix,
Image: kanisterToolsImage,
Command: []string{"sh", "-c", "tail -f /dev/null"},
+ PodOverride: podOverride,
}
pr := kube.NewPodRunner(cli, options)
podFunc := backupDataStatsPodFunc(cli, tp, namespace, encryptionKey, backupArtifactPrefix, backupID, mode)
@@ -126,6 +128,10 @@ func (*BackupDataStatsFunc) Exec(ctx context.Context, tp param.TemplateParams, a
if err = OptArg(args, BackupDataStatsEncryptionKeyArg, &encryptionKey, restic.GeneratePassword()); err != nil {
return nil, err
}
+ podOverride, err := GetPodSpecOverride(tp, args, DescribeBackupsPodOverrideArg)
+ if err != nil {
+ return nil, err
+ }
if err = ValidateProfile(tp.Profile); err != nil {
return nil, errors.Wrapf(err, "Failed to validate Profile")
@@ -137,7 +143,7 @@ func (*BackupDataStatsFunc) Exec(ctx context.Context, tp param.TemplateParams, a
if err != nil {
return nil, errors.Wrapf(err, "Failed to create Kubernetes client")
}
- return backupDataStats(ctx, cli, tp, namespace, encryptionKey, backupArtifactPrefix, backupID, mode, backupDataStatsJobPrefix)
+ return backupDataStats(ctx, cli, tp, namespace, encryptionKey, backupArtifactPrefix, backupID, mode, backupDataStatsJobPrefix, podOverride)
}
func (*BackupDataStatsFunc) RequiredArgs() []string {
