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

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


The following commit(s) were added to refs/heads/master by this push:
     new f296f118 fix: Using different protocols at the same time in 
ApisixUpstream (#1331)
f296f118 is described below

commit f296f118542f93b28b9673197dcc81be181d2685
Author: xianshun163 <[email protected]>
AuthorDate: Fri Sep 16 11:26:48 2022 +0800

    fix: Using different protocols at the same time in ApisixUpstream (#1331)
    
    Co-authored-by: xianshun <[email protected]>
---
 pkg/providers/apisix/apisix_upstream.go | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pkg/providers/apisix/apisix_upstream.go 
b/pkg/providers/apisix/apisix_upstream.go
index b30c3430..bf27b510 100644
--- a/pkg/providers/apisix/apisix_upstream.go
+++ b/pkg/providers/apisix/apisix_upstream.go
@@ -158,11 +158,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
                        }
                }
 
@@ -198,10 +198,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.translator.TranslateUpstreamConfigV2beta3(cfg)
+                                       newUps, err = 
c.translator.TranslateUpstreamConfigV2beta3(&cfg)
                                        if err != nil {
                                                log.Errorw("found malformed 
ApisixUpstream",
                                                        zap.Any("object", au),
@@ -242,11 +242,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
                        }
                }
 
@@ -282,10 +282,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.translator.TranslateUpstreamConfigV2(cfg)
+                                               newUps, err = 
c.translator.TranslateUpstreamConfigV2(&cfg)
                                                if err != nil {
                                                        
log.Errorw("ApisixUpstream conversion cannot be completed, or the format is 
incorrect",
                                                                
zap.Any("object", au),

Reply via email to