Skip to content

Commit

Permalink
chore: correct destination path migration (#384)
Browse files Browse the repository at this point in the history
- should be destination.spec.path / destination.name
  • Loading branch information
ChunyiLyu authored Feb 21, 2025
1 parent 41d09e5 commit 5b9c859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/controller/destination_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (r *DestinationReconciler) Reconcile(ctx context.Context, req ctrl.Request)
// this destination was created prior to `spec.path` being required and
// the destination name being used as part of the path.
metav1.SetMetaDataAnnotation(&destination.ObjectMeta, v1alpha1.SkipPathDefaultingAnnotation, "true")
destination.Spec.Path = path.Join(destination.Name, destination.Spec.Path)
destination.Spec.Path = path.Join(destination.Spec.Path, destination.Name)
return ctrl.Result{}, r.Client.Update(ctx, destination)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/controller/destination_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var _ = Describe("DestinationReconciler", func() {
})

It("should patch the path with the destination name", func() {
Expect(updatedDestination.Spec.Path).To(Equal(updatedDestination.Name + "/foo/bar"))
Expect(updatedDestination.Spec.Path).To(Equal("foo/bar/" + updatedDestination.Name))
})

It("should add the skip annotation", func() {
Expand Down

0 comments on commit 5b9c859

Please sign in to comment.