Skip to content

Commit

Permalink
fix: correctly map resources with differrent ns in MapperSameID
Browse files Browse the repository at this point in the history
The namespace should be taken from the output resource definition, not
from the input metadata.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Dec 5, 2024
1 parent f179603 commit 6f0a50c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/generic/qtransform/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ type MapperFuncGeneric[I generic.ResourceWithRD] func(context.Context, *zap.Logg
func MapperSameID[I generic.ResourceWithRD, O generic.ResourceWithRD]() MapperFuncGeneric[I] {
var zeroOutput O

outputType := zeroOutput.ResourceDefinition().Type
outputRD := zeroOutput.ResourceDefinition()

return func(_ context.Context, _ *zap.Logger, _ controller.QRuntime, v I) ([]resource.Pointer, error) {
return []resource.Pointer{resource.NewMetadata(v.Metadata().Namespace(), outputType, v.Metadata().ID(), resource.VersionUndefined)}, nil
return []resource.Pointer{resource.NewMetadata(outputRD.DefaultNamespace, outputRD.Type, v.Metadata().ID(), resource.VersionUndefined)}, nil
}
}

Expand Down

0 comments on commit 6f0a50c

Please sign in to comment.