This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch v1.5.0
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/v1.5.0 by this push:
     new a288408e cherry-pick #1331: fix: Using different protocols at the same 
time in ApisixUpstream (#1464)
a288408e is described below

commit a288408ef71b7e7c456ba7e178013eefba8ee21c
Author: Jintao Zhang <[email protected]>
AuthorDate: Wed Nov 16 22:37:39 2022 +0800

    cherry-pick #1331: fix: Using different protocols at the same time in 
ApisixUpstream (#1464)
    
    Signed-off-by: Jintao Zhang <[email protected]>
---
 pkg/ingress/apisix_upstream.go | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pkg/ingress/apisix_upstream.go b/pkg/ingress/apisix_upstream.go
index 3c5a1e02..9a2da4fd 100644
--- a/pkg/ingress/apisix_upstream.go
+++ b/pkg/ingress/apisix_upstream.go
@@ -142,11 +142,11 @@ func (c *apisixUpstreamController) sync(ctx 
context.Context, ev *types.Event) er
        case config.ApisixV2beta3:
                au := multiVersioned.V2beta3()
 
-               var portLevelSettings 
map[int32]*configv2beta3.ApisixUpstreamConfig
+               var portLevelSettings 
map[int32]configv2beta3.ApisixUpstreamConfig
                if au.Spec != nil && len(au.Spec.PortLevelSettings) > 0 {
-                       portLevelSettings = 
make(map[int32]*configv2beta3.ApisixUpstreamConfig, 
len(au.Spec.PortLevelSettings))
+                       portLevelSettings = 
make(map[int32]configv2beta3.ApisixUpstreamConfig, 
len(au.Spec.PortLevelSettings))
                        for _, port := range au.Spec.PortLevelSettings {
-                               portLevelSettings[port.Port] = 
&port.ApisixUpstreamConfig
+                               portLevelSettings[port.Port] = 
port.ApisixUpstreamConfig
                        }
                }
 
@@ -182,10 +182,10 @@ func (c *apisixUpstreamController) sync(ctx 
context.Context, ev *types.Event) er
                                if au.Spec != nil && ev.Type != 
types.EventDelete {
                                        cfg, ok := portLevelSettings[port.Port]
                                        if !ok {
-                                               cfg = 
&au.Spec.ApisixUpstreamConfig
+                                               cfg = 
au.Spec.ApisixUpstreamConfig
                                        }
                                        // FIXME Same ApisixUpstreamConfig 
might be translated multiple times.
-                                       newUps, err = 
c.controller.translator.TranslateUpstreamConfigV2beta3(cfg)
+                                       newUps, err = 
c.controller.translator.TranslateUpstreamConfigV2beta3(&cfg)
                                        if err != nil {
                                                log.Errorw("found malformed 
ApisixUpstream",
                                                        zap.Any("object", au),
@@ -226,11 +226,11 @@ func (c *apisixUpstreamController) sync(ctx 
context.Context, ev *types.Event) er
        case config.ApisixV2:
                au := multiVersioned.V2()
 
-               var portLevelSettings map[int32]*configv2.ApisixUpstreamConfig
+               var portLevelSettings map[int32]configv2.ApisixUpstreamConfig
                if au.Spec != nil && len(au.Spec.PortLevelSettings) > 0 {
-                       portLevelSettings = 
make(map[int32]*configv2.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
+                       portLevelSettings = 
make(map[int32]configv2.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
                        for _, port := range au.Spec.PortLevelSettings {
-                               portLevelSettings[port.Port] = 
&port.ApisixUpstreamConfig
+                               portLevelSettings[port.Port] = 
port.ApisixUpstreamConfig
                        }
                }
 
@@ -266,10 +266,10 @@ func (c *apisixUpstreamController) sync(ctx 
context.Context, ev *types.Event) er
                                if au.Spec != nil && ev.Type != 
types.EventDelete {
                                        cfg, ok := portLevelSettings[port.Port]
                                        if !ok {
-                                               cfg = 
&au.Spec.ApisixUpstreamConfig
+                                               cfg = 
au.Spec.ApisixUpstreamConfig
                                        }
                                        // FIXME Same ApisixUpstreamConfig 
might be translated multiple times.
-                                       newUps, err = 
c.controller.translator.TranslateUpstreamConfigV2(cfg)
+                                       newUps, err = 
c.controller.translator.TranslateUpstreamConfigV2(&cfg)
                                        if err != nil {
                                                log.Errorw("found malformed 
ApisixUpstream",
                                                        zap.Any("object", au),

Reply via email to