Skip to content

Commit a288408

Browse files
cherry-pick #1331: fix: Using different protocols at the same time in ApisixUpstream (#1464)
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
1 parent dd5acd3 commit a288408

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

pkg/ingress/apisix_upstream.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ func (c *apisixUpstreamController) sync(ctx context.Context, ev *types.Event) er
142142
case config.ApisixV2beta3:
143143
au := multiVersioned.V2beta3()
144144

145-
var portLevelSettings map[int32]*configv2beta3.ApisixUpstreamConfig
145+
var portLevelSettings map[int32]configv2beta3.ApisixUpstreamConfig
146146
if au.Spec != nil && len(au.Spec.PortLevelSettings) > 0 {
147-
portLevelSettings = make(map[int32]*configv2beta3.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
147+
portLevelSettings = make(map[int32]configv2beta3.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
148148
for _, port := range au.Spec.PortLevelSettings {
149-
portLevelSettings[port.Port] = &port.ApisixUpstreamConfig
149+
portLevelSettings[port.Port] = port.ApisixUpstreamConfig
150150
}
151151
}
152152

@@ -182,10 +182,10 @@ func (c *apisixUpstreamController) sync(ctx context.Context, ev *types.Event) er
182182
if au.Spec != nil && ev.Type != types.EventDelete {
183183
cfg, ok := portLevelSettings[port.Port]
184184
if !ok {
185-
cfg = &au.Spec.ApisixUpstreamConfig
185+
cfg = au.Spec.ApisixUpstreamConfig
186186
}
187187
// FIXME Same ApisixUpstreamConfig might be translated multiple times.
188-
newUps, err = c.controller.translator.TranslateUpstreamConfigV2beta3(cfg)
188+
newUps, err = c.controller.translator.TranslateUpstreamConfigV2beta3(&cfg)
189189
if err != nil {
190190
log.Errorw("found malformed ApisixUpstream",
191191
zap.Any("object", au),
@@ -226,11 +226,11 @@ func (c *apisixUpstreamController) sync(ctx context.Context, ev *types.Event) er
226226
case config.ApisixV2:
227227
au := multiVersioned.V2()
228228

229-
var portLevelSettings map[int32]*configv2.ApisixUpstreamConfig
229+
var portLevelSettings map[int32]configv2.ApisixUpstreamConfig
230230
if au.Spec != nil && len(au.Spec.PortLevelSettings) > 0 {
231-
portLevelSettings = make(map[int32]*configv2.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
231+
portLevelSettings = make(map[int32]configv2.ApisixUpstreamConfig, len(au.Spec.PortLevelSettings))
232232
for _, port := range au.Spec.PortLevelSettings {
233-
portLevelSettings[port.Port] = &port.ApisixUpstreamConfig
233+
portLevelSettings[port.Port] = port.ApisixUpstreamConfig
234234
}
235235
}
236236

@@ -266,10 +266,10 @@ func (c *apisixUpstreamController) sync(ctx context.Context, ev *types.Event) er
266266
if au.Spec != nil && ev.Type != types.EventDelete {
267267
cfg, ok := portLevelSettings[port.Port]
268268
if !ok {
269-
cfg = &au.Spec.ApisixUpstreamConfig
269+
cfg = au.Spec.ApisixUpstreamConfig
270270
}
271271
// FIXME Same ApisixUpstreamConfig might be translated multiple times.
272-
newUps, err = c.controller.translator.TranslateUpstreamConfigV2(cfg)
272+
newUps, err = c.controller.translator.TranslateUpstreamConfigV2(&cfg)
273273
if err != nil {
274274
log.Errorw("found malformed ApisixUpstream",
275275
zap.Any("object", au),

0 commit comments

Comments
 (0)