From 8dfc8e35a62cb2d6dae892c68c92ba36d90e5cfb Mon Sep 17 00:00:00 2001 From: barnettZQG Date: Mon, 1 Aug 2022 22:41:41 +0800 Subject: [PATCH] Fix: can not find the resource when the resource namespace is diffrent with application (#4517) Signed-off-by: barnettZQG --- references/cli/portforward.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/references/cli/portforward.go b/references/cli/portforward.go index 4f1c547e4..b246f8830 100644 --- a/references/cli/portforward.go +++ b/references/cli/portforward.go @@ -230,7 +230,7 @@ func (o *VelaPortForwardOptions) Init(ctx context.Context, cmd *cobra.Command, a } cf := genericclioptions.NewConfigFlags(true) - cf.Namespace = pointer.String(o.namespace) + cf.Namespace = pointer.String(o.targetResource.namespace) cf.WrapConfigFn = func(cfg *rest.Config) *rest.Config { cfg.Wrap(multicluster.NewClusterGatewayRoundTripperWrapperGenerator(o.targetResource.cluster)) return cfg @@ -286,6 +286,7 @@ func (o *VelaPortForwardOptions) Complete() error { args := make([]string, len(o.Args)) copy(args, o.Args) args[0] = forwardTypeName + o.kcPortForwardOptions.Namespace = o.targetResource.namespace o.ioStreams.Infof("trying to connect the remote endpoint %s ..", strings.Join(args, " ")) return o.kcPortForwardOptions.Complete(o.f, o.Cmd, args) }