Skip to content

Commit

Permalink
Fix a bug in the code where we merge actionset and bp labels/annotati…
Browse files Browse the repository at this point in the history
…ons (#3097)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
viveksinghggits and mergify[bot] authored Sep 9, 2024
1 parent ff17a9e commit 5a943b4
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 14 deletions.
3 changes: 2 additions & 1 deletion pkg/function/backup_data_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ func (b *BackupDataStatsFunc) Exec(ctx context.Context, tp param.TemplateParams,
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/checkRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ func (c *CheckRepositoryFunc) Exec(ctx context.Context, tp param.TemplateParams,
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/copy_volume_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ func (c *copyVolumeDataFunc) Exec(ctx context.Context, tp param.TemplateParams,
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/delete_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ func (d *deleteDataFunc) Exec(ctx context.Context, tp param.TemplateParams, args
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/delete_data_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func (d *deleteDataAllFunc) Exec(ctx context.Context, tp param.TemplateParams, a
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/delete_data_using_kopia_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func (d *deleteDataUsingKopiaServerFunc) Exec(ctx context.Context, tp param.Temp
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/export_rds_snapshot_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ func (e *exportRDSSnapshotToLocationFunc) Exec(ctx context.Context, tp param.Tem
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/kube_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ func (ktf *kubeTaskFunc) Exec(ctx context.Context, tp param.TemplateParams, args
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/prepare_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ func (p *prepareDataFunc) Exec(ctx context.Context, tp param.TemplateParams, arg
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/restore_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ func (r *restoreDataFunc) Exec(ctx context.Context, tp param.TemplateParams, arg
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/restore_data_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ func (r *restoreDataAllFunc) Exec(ctx context.Context, tp param.TemplateParams,
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/restore_data_using_kopia_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func (r *restoreDataUsingKopiaServerFunc) Exec(ctx context.Context, tp param.Tem
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
3 changes: 2 additions & 1 deletion pkg/function/restore_rds_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ func (r *restoreRDSSnapshotFunc) Exec(ctx context.Context, tp param.TemplatePara
return nil, err
}

var labels, annotations map[string]string
annotations := bpAnnotations
labels := bpLabels
if tp.PodAnnotations != nil {
// merge the actionset annotations with blueprint annotations
var actionSetAnn ActionSetAnnotations = tp.PodAnnotations
Expand Down
2 changes: 1 addition & 1 deletion pkg/testing/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (s *E2ESuite) TestPodLabelsAndAnnotations(c *C) {
c.Assert(err, IsNil)

// 4. scenario where labels/annotations are only provided via blueprint
asThree := backupActionsetWihtPodLabelsAndAnnotations(s.namespace, bp.Name, map[string]string{}, map[string]string{})
asThree := backupActionsetWihtPodLabelsAndAnnotations(s.namespace, bp.Name, nil, nil)
asCreatedThree, err := s.crCli.ActionSets(s.namespace).Create(context.Background(), asThree, metav1.CreateOptions{})
c.Assert(err, IsNil)

Expand Down

0 comments on commit 5a943b4

Please sign in to comment.