From 6f0a50caeca62befbd987d47a6e73491fd7cf149 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Thu, 5 Dec 2024 18:26:21 +0300 Subject: [PATCH] fix: correctly map resources with differrent ns in `MapperSameID` The namespace should be taken from the output resource definition, not from the input metadata. Signed-off-by: Artem Chernyshev --- pkg/controller/generic/qtransform/options.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/generic/qtransform/options.go b/pkg/controller/generic/qtransform/options.go index 11c3001..12fc259 100644 --- a/pkg/controller/generic/qtransform/options.go +++ b/pkg/controller/generic/qtransform/options.go @@ -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 } }