rename field

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
This commit is contained in:
Ashish Amarnath
2020-06-15 15:26:44 -07:00
parent b71173228a
commit b0fd3d35c1
14 changed files with 116 additions and 116 deletions

View File

@@ -83,11 +83,11 @@ type BackupSpec struct {
// +optional
VolumeSnapshotLocations []string `json:"volumeSnapshotLocations,omitempty"`
// DefaultRestic specifies whether restic should be used to take
// DefaultVolumesToRestic specifies whether restic should be used to take a
// backup of all pod volumes by default.
// +optional
// + nullable
DefaultRestic *bool `json:"defaultRestic,omitempty"`
DefaultVolumesToRestic *bool `json:"defaultVolumesToRestic,omitempty"`
}
// BackupHooks contains custom behaviors that should be executed at different phases of the backup.

View File

@@ -246,8 +246,8 @@ func (in *BackupSpec) DeepCopyInto(out *BackupSpec) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.DefaultRestic != nil {
in, out := &in.DefaultRestic, &out.DefaultRestic
if in.DefaultVolumesToRestic != nil {
in, out := &in.DefaultVolumesToRestic, &out.DefaultVolumesToRestic
*out = new(bool)
**out = **in
}

View File

@@ -71,7 +71,7 @@ type kubernetesBackupper struct {
podCommandExecutor podexec.PodCommandExecutor
resticBackupperFactory restic.BackupperFactory
resticTimeout time.Duration
defaultRestic bool
defaultVolumesToRestic bool
}
type resolvedAction struct {
@@ -104,7 +104,7 @@ func NewKubernetesBackupper(
podCommandExecutor podexec.PodCommandExecutor,
resticBackupperFactory restic.BackupperFactory,
resticTimeout time.Duration,
defaultRestic bool,
defaultVolumesToRestic bool,
) (Backupper, error) {
return &kubernetesBackupper{
backupClient: backupClient,
@@ -113,7 +113,7 @@ func NewKubernetesBackupper(
podCommandExecutor: podCommandExecutor,
resticBackupperFactory: resticBackupperFactory,
resticTimeout: resticTimeout,
defaultRestic: defaultRestic,
defaultVolumesToRestic: defaultVolumesToRestic,
}, nil
}
@@ -243,10 +243,10 @@ func (kb *kubernetesBackupper) Backup(log logrus.FieldLogger, backupRequest *Req
log.Infof("Including resources: %s", backupRequest.ResourceIncludesExcludes.IncludesString())
log.Infof("Excluding resources: %s", backupRequest.ResourceIncludesExcludes.ExcludesString())
if backupRequest.Backup.Spec.DefaultRestic == nil {
backupRequest.Backup.Spec.DefaultRestic = &kb.defaultRestic
if backupRequest.Backup.Spec.DefaultVolumesToRestic == nil {
backupRequest.Backup.Spec.DefaultVolumesToRestic = &kb.defaultVolumesToRestic
}
log.Infof("Backing up all pod volumes using restic: %t", *backupRequest.Backup.Spec.DefaultRestic)
log.Infof("Backing up all pod volumes using restic: %t", *backupRequest.Backup.Spec.DefaultVolumesToRestic)
var err error
backupRequest.ResourceHooks, err = getResourceHooks(backupRequest.Spec.Hooks.Resources, kb.discoveryHelper)

View File

@@ -141,7 +141,7 @@ func (ib *itemBackupper) backupItem(logger logrus.FieldLogger, obj runtime.Unstr
// Get the list of volumes to back up using restic from the pod's annotations. Remove from this list
// any volumes that use a PVC that we've already backed up (this would be in a read-write-many scenario,
// where it's been backed up from another pod), since we don't need >1 backup per PVC.
for _, volume := range restic.GetPodVolumesUsingRestic(pod, boolptr.IsSetToTrue(ib.backupRequest.Spec.DefaultRestic)) {
for _, volume := range restic.GetPodVolumesUsingRestic(pod, boolptr.IsSetToTrue(ib.backupRequest.Spec.DefaultVolumesToRestic)) {
if found, pvcName := ib.resticSnapshotTracker.HasPVCForPodVolume(pod, volume); found {
log.WithFields(map[string]interface{}{
"podVolume": volume,

View File

@@ -128,9 +128,9 @@ func (b *BackupBuilder) SnapshotVolumes(val bool) *BackupBuilder {
return b
}
// DefaultRestic sets the Backup's "DefaultRestic" flag.
func (b *BackupBuilder) DefaultRestic(val bool) *BackupBuilder {
b.object.Spec.DefaultRestic = &val
// DefaultVolumesToRestic sets the Backup's "DefaultVolumesToRestic" flag.
func (b *BackupBuilder) DefaultVolumesToRestic(val bool) *BackupBuilder {
b.object.Spec.DefaultVolumesToRestic = &val
return b
}

View File

@@ -81,7 +81,7 @@ type CreateOptions struct {
Name string
TTL time.Duration
SnapshotVolumes flag.OptionalBool
DefaultRestic flag.OptionalBool
DefaultVolumesToRestic flag.OptionalBool
IncludeNamespaces flag.StringArray
ExcludeNamespaces flag.StringArray
IncludeResources flag.StringArray
@@ -125,7 +125,7 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
f = flags.VarPF(&o.IncludeClusterResources, "include-cluster-resources", "", "include cluster-scoped resources in the backup")
f.NoOptDefVal = "true"
f = flags.VarPF(&o.DefaultRestic, "default-restic", "", "use restic by default to backup all pod volumes")
f = flags.VarPF(&o.DefaultVolumesToRestic, "default-volumes-to-restic", "", "use restic by default to backup all pod volumes")
f.NoOptDefVal = "true"
}
@@ -299,8 +299,8 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro
if o.IncludeClusterResources.Value != nil {
backupBuilder.IncludeClusterResources(*o.IncludeClusterResources.Value)
}
if o.DefaultRestic.Value != nil {
backupBuilder.DefaultRestic(*o.DefaultRestic.Value)
if o.DefaultVolumesToRestic.Value != nil {
backupBuilder.DefaultVolumesToRestic(*o.DefaultVolumesToRestic.Value)
}
}

View File

@@ -126,7 +126,7 @@ type serverConfig struct {
profilerAddress string
formatFlag *logging.FormatFlag
defaultResticMaintenanceFrequency time.Duration
defaultRestic bool
defaultVolumesToRestic bool
}
type controllerRunInfo struct {
@@ -153,7 +153,7 @@ func NewCommand(f client.Factory) *cobra.Command {
resourceTerminatingTimeout: defaultResourceTerminatingTimeout,
formatFlag: logging.NewFormatFlag(),
defaultResticMaintenanceFrequency: restic.DefaultMaintenanceFrequency,
defaultRestic: restic.DefaultRestic,
defaultVolumesToRestic: restic.DefaultVolumesToRestic,
}
)
@@ -215,7 +215,7 @@ func NewCommand(f client.Factory) *cobra.Command {
command.Flags().DurationVar(&config.resourceTerminatingTimeout, "terminating-resource-timeout", config.resourceTerminatingTimeout, "how long to wait on persistent volumes and namespaces to terminate during a restore before timing out")
command.Flags().DurationVar(&config.defaultBackupTTL, "default-backup-ttl", config.defaultBackupTTL, "how long to wait by default before backups can be garbage collected")
command.Flags().DurationVar(&config.defaultResticMaintenanceFrequency, "default-restic-prune-frequency", config.defaultResticMaintenanceFrequency, "how often 'restic prune' is run for restic repositories by default")
command.Flags().BoolVar(&config.defaultRestic, "default-restic", config.defaultRestic, "backup all volumes with restic by default")
command.Flags().BoolVar(&config.defaultVolumesToRestic, "default-volumes-to-restic", config.defaultVolumesToRestic, "backup all volumes with restic by default")
return command
}
@@ -640,7 +640,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string
podexec.NewPodCommandExecutor(s.kubeClientConfig, s.kubeClient.CoreV1().RESTClient()),
s.resticManager,
s.config.podVolumeOperationTimeout,
s.config.defaultRestic,
s.config.defaultVolumesToRestic,
)
cmd.CheckError(err)
@@ -655,7 +655,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string
backupTracker,
s.sharedInformerFactory.Velero().V1().BackupStorageLocations().Lister(),
s.config.defaultBackupLocation,
s.config.defaultRestic,
s.config.defaultVolumesToRestic,
s.config.defaultBackupTTL,
s.sharedInformerFactory.Velero().V1().VolumeSnapshotLocations().Lister(),
defaultVolumeSnapshotLocations,

View File

@@ -71,7 +71,7 @@ type backupController struct {
backupTracker BackupTracker
backupLocationLister velerov1listers.BackupStorageLocationLister
defaultBackupLocation string
defaultRestic bool
defaultVolumesToRestic bool
defaultBackupTTL time.Duration
snapshotLocationLister velerov1listers.VolumeSnapshotLocationLister
defaultSnapshotLocations map[string]string
@@ -93,7 +93,7 @@ func NewBackupController(
backupTracker BackupTracker,
backupLocationLister velerov1listers.BackupStorageLocationLister,
defaultBackupLocation string,
defaultRestic bool,
defaultVolumesToRestic bool,
defaultBackupTTL time.Duration,
volumeSnapshotLocationLister velerov1listers.VolumeSnapshotLocationLister,
defaultSnapshotLocations map[string]string,
@@ -122,7 +122,7 @@ func NewBackupController(
volumeSnapshotLister: volumeSnapshotLister,
volumeSnapshotContentLister: volumeSnapshotContentLister,
newBackupStore: persistence.NewObjectBackupStore,
defaultRestic: defaultRestic,
defaultVolumesToRestic: defaultVolumesToRestic,
}
c.syncHandler = c.processBackup
@@ -342,8 +342,8 @@ func (c *backupController) prepareBackupRequest(backup *velerov1api.Backup) *pkg
request.Spec.StorageLocation = c.defaultBackupLocation
}
if request.Spec.DefaultRestic == nil {
request.Spec.DefaultRestic = &c.defaultRestic
if request.Spec.DefaultVolumesToRestic == nil {
request.Spec.DefaultVolumesToRestic = &c.defaultVolumesToRestic
}
// add the storage location as a label for easy filtering later.

View File

@@ -340,20 +340,20 @@ func TestProcessBackupCompletions(t *testing.T) {
timestamp := metav1.NewTime(now)
tests := []struct {
name string
backup *velerov1api.Backup
backupLocation *velerov1api.BackupStorageLocation
defaultRestic bool
expectedResult *velerov1api.Backup
backupExists bool
existenceCheckError error
name string
backup *velerov1api.Backup
backupLocation *velerov1api.BackupStorageLocation
defaultVolumesToRestic bool
expectedResult *velerov1api.Backup
backupExists bool
existenceCheckError error
}{
// Completed
{
name: "backup with no backup location gets the default",
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultRestic: true,
name: "backup with no backup location gets the default",
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -372,8 +372,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.True(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -386,10 +386,10 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "backup with a specific backup location keeps it",
backup: defaultBackup().StorageLocation("alt-loc").Result(),
backupLocation: builder.ForBackupStorageLocation("velero", "alt-loc").Bucket("store-1").Result(),
defaultRestic: false,
name: "backup with a specific backup location keeps it",
backup: defaultBackup().StorageLocation("alt-loc").Result(),
backupLocation: builder.ForBackupStorageLocation("velero", "alt-loc").Bucket("store-1").Result(),
defaultVolumesToRestic: false,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -408,8 +408,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: "alt-loc",
DefaultRestic: boolptr.False(),
StorageLocation: "alt-loc",
DefaultVolumesToRestic: boolptr.False(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -428,7 +428,7 @@ func TestProcessBackupCompletions(t *testing.T) {
Bucket("store-1").
AccessMode(velerov1api.BackupStorageLocationAccessModeReadWrite).
Result(),
defaultRestic: true,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -447,8 +447,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: "read-write",
DefaultRestic: boolptr.True(),
StorageLocation: "read-write",
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -461,10 +461,10 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "backup with a TTL has expiration set",
backup: defaultBackup().TTL(10 * time.Minute).Result(),
backupLocation: defaultBackupLocation,
defaultRestic: false,
name: "backup with a TTL has expiration set",
backup: defaultBackup().TTL(10 * time.Minute).Result(),
backupLocation: defaultBackupLocation,
defaultVolumesToRestic: false,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -483,9 +483,9 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
TTL: metav1.Duration{Duration: 10 * time.Minute},
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.False(),
TTL: metav1.Duration{Duration: 10 * time.Minute},
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.False(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -498,11 +498,11 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "backup without an existing backup will succeed",
backupExists: false,
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultRestic: true,
name: "backup without an existing backup will succeed",
backupExists: false,
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -521,8 +521,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.True(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -535,12 +535,12 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "backup specifying a false value for 'DefaultRestic' keeps it",
name: "backup specifying a false value for 'DefaultVolumesToRestic' keeps it",
backupExists: false,
backup: defaultBackup().DefaultRestic(false).Result(),
backup: defaultBackup().DefaultVolumesToRestic(false).Result(),
backupLocation: defaultBackupLocation,
// value set in the controller is different from that specified in the backup
defaultRestic: true,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -559,8 +559,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.False(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.False(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -573,12 +573,12 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "backup specifying a true value for 'DefaultRestic' keeps it",
name: "backup specifying a true value for 'DefaultVolumesToRestic' keeps it",
backupExists: false,
backup: defaultBackup().DefaultRestic(true).Result(),
backup: defaultBackup().DefaultVolumesToRestic(true).Result(),
backupLocation: defaultBackupLocation,
// value set in the controller is different from that specified in the backup
defaultRestic: false,
defaultVolumesToRestic: false,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -597,8 +597,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.True(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseCompleted,
@@ -613,11 +613,11 @@ func TestProcessBackupCompletions(t *testing.T) {
// Failed
{
name: "backup with existing backup will fail",
backupExists: true,
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultRestic: true,
name: "backup with existing backup will fail",
backupExists: true,
backup: defaultBackup().Result(),
backupLocation: defaultBackupLocation,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -636,8 +636,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.True(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseFailed,
@@ -650,11 +650,11 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
{
name: "error when checking if backup exists will cause backup to fail",
backup: defaultBackup().Result(),
existenceCheckError: errors.New("Backup already exists in object storage"),
backupLocation: defaultBackupLocation,
defaultRestic: true,
name: "error when checking if backup exists will cause backup to fail",
backup: defaultBackup().Result(),
existenceCheckError: errors.New("Backup already exists in object storage"),
backupLocation: defaultBackupLocation,
defaultVolumesToRestic: true,
expectedResult: &velerov1api.Backup{
TypeMeta: metav1.TypeMeta{
Kind: "Backup",
@@ -673,8 +673,8 @@ func TestProcessBackupCompletions(t *testing.T) {
},
},
Spec: velerov1api.BackupSpec{
StorageLocation: defaultBackupLocation.Name,
DefaultRestic: boolptr.True(),
StorageLocation: defaultBackupLocation.Name,
DefaultVolumesToRestic: boolptr.True(),
},
Status: velerov1api.BackupStatus{
Phase: velerov1api.BackupPhaseFailed,
@@ -725,7 +725,7 @@ func TestProcessBackupCompletions(t *testing.T) {
backupLocationLister: sharedInformers.Velero().V1().BackupStorageLocations().Lister(),
snapshotLocationLister: sharedInformers.Velero().V1().VolumeSnapshotLocations().Lister(),
defaultBackupLocation: defaultBackupLocation.Name,
defaultRestic: test.defaultRestic,
defaultVolumesToRestic: test.defaultVolumesToRestic,
backupTracker: NewBackupTracker(),
metrics: metrics.NewServerMetrics(),
clock: clock.NewFakeClock(now),

File diff suppressed because one or more lines are too long

View File

@@ -36,9 +36,9 @@ spec:
spec:
description: BackupSpec defines the specification for a Velero backup.
properties:
defaultRestic:
description: DefaultRestic specifies whether restic should be used to
take backup of all pod volumes by default.
defaultVolumesToRestic:
description: DefaultVolumesToRestic specifies whether restic should
be used to take a backup of all pod volumes by default.
type: boolean
excludedNamespaces:
description: ExcludedNamespaces contains a list of namespaces that are

View File

@@ -44,9 +44,9 @@ spec:
description: Template is the definition of the Backup to be run on the
provided schedule
properties:
defaultRestic:
description: DefaultRestic specifies whether restic should be used
to take backup of all pod volumes by default.
defaultVolumesToRestic:
description: DefaultVolumesToRestic specifies whether restic should
be used to take a backup of all pod volumes by default.
type: boolean
excludedNamespaces:
description: ExcludedNamespaces contains a list of namespaces that

View File

@@ -46,9 +46,9 @@ const (
// at which restic prune is run.
DefaultMaintenanceFrequency = 7 * 24 * time.Hour
// DefaultRestic specifies whether restic should be used, by default, to
// DefaultVolumesToRestic specifies whether restic should be used, by default, to
// take backup of all pod volumes.
DefaultRestic = false
DefaultVolumesToRestic = false
// PVCNameAnnotation is the key for the annotation added to
// pod volume backups when they're for a PVC.
@@ -154,8 +154,8 @@ func contains(list []string, k string) bool {
}
// GetPodVolumesUsingRestic returns a list of volume names to backup for the provided pod.
func GetPodVolumesUsingRestic(pod *corev1api.Pod, defaultRestic bool) []string {
if !defaultRestic {
func GetPodVolumesUsingRestic(pod *corev1api.Pod, defaultVolumesToRestic bool) []string {
if !defaultVolumesToRestic {
return GetVolumesToBackup(pod)
}

View File

@@ -422,14 +422,14 @@ func TestTempCACertFile(t *testing.T) {
func TestGetPodVolumesUsingRestic(t *testing.T) {
testCases := []struct {
name string
pod *corev1api.Pod
expected []string
defaultRestic bool
name string
pod *corev1api.Pod
expected []string
defaultVolumesToRestic bool
}{
{
name: "should get PVs from VolumesToBackupAnnotation when defaultRestic is false",
defaultRestic: false,
name: "should get PVs from VolumesToBackupAnnotation when defaultVolumesToRestic is false",
defaultVolumesToRestic: false,
pod: &corev1api.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
@@ -440,8 +440,8 @@ func TestGetPodVolumesUsingRestic(t *testing.T) {
expected: []string{"resticPV1", "resticPV2", "resticPV3"},
},
{
name: "should get all pod volumes when defaultRestic is true and no PVs are excluded",
defaultRestic: true,
name: "should get all pod volumes when defaultVolumesToRestic is true and no PVs are excluded",
defaultVolumesToRestic: true,
pod: &corev1api.Pod{
Spec: corev1api.PodSpec{
Volumes: []corev1api.Volume{
@@ -453,8 +453,8 @@ func TestGetPodVolumesUsingRestic(t *testing.T) {
expected: []string{"resticPV1", "resticPV2", "resticPV3"},
},
{
name: "should get all pod volumes except ones excluded when defaultRestic is true",
defaultRestic: true,
name: "should get all pod volumes except ones excluded when defaultVolumesToRestic is true",
defaultVolumesToRestic: true,
pod: &corev1api.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
@@ -473,8 +473,8 @@ func TestGetPodVolumesUsingRestic(t *testing.T) {
expected: []string{"resticPV1", "resticPV2", "resticPV3"},
},
{
name: "should exclude default service account token from restic backup",
defaultRestic: true,
name: "should exclude default service account token from restic backup",
defaultVolumesToRestic: true,
pod: &corev1api.Pod{
Spec: corev1api.PodSpec{
Volumes: []corev1api.Volume{
@@ -488,8 +488,8 @@ func TestGetPodVolumesUsingRestic(t *testing.T) {
expected: []string{"resticPV1", "resticPV2", "resticPV3"},
},
{
name: "should exclude host path volumes from restic backups",
defaultRestic: true,
name: "should exclude host path volumes from restic backups",
defaultVolumesToRestic: true,
pod: &corev1api.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
@@ -513,7 +513,7 @@ func TestGetPodVolumesUsingRestic(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
actual := GetPodVolumesUsingRestic(tc.pod, tc.defaultRestic)
actual := GetPodVolumesUsingRestic(tc.pod, tc.defaultVolumesToRestic)
sort.Strings(tc.expected)
sort.Strings(actual)