mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 20:57:32 +08:00
fix: prevent port-level policy from overwriting existing ingress annotation configs (#3118)
This commit is contained in:
@@ -857,8 +857,17 @@ func (m *IngressConfig) convertDestinationRule(configs []common.WrapperConfig) [
|
|||||||
portUpdated := false
|
portUpdated := false
|
||||||
for _, policy := range dr.DestinationRule.TrafficPolicy.PortLevelSettings {
|
for _, policy := range dr.DestinationRule.TrafficPolicy.PortLevelSettings {
|
||||||
if policy.Port.Number == portTrafficPolicy.Port.Number {
|
if policy.Port.Number == portTrafficPolicy.Port.Number {
|
||||||
policy.Tls = portTrafficPolicy.Tls
|
// Only set Tls if not already configured
|
||||||
policy.LoadBalancer = portTrafficPolicy.LoadBalancer
|
if policy.Tls == nil && portTrafficPolicy.Tls != nil {
|
||||||
|
policy.Tls = portTrafficPolicy.Tls
|
||||||
|
}
|
||||||
|
// Only set LoadBalancer if not already configured
|
||||||
|
if policy.LoadBalancer == nil && portTrafficPolicy.LoadBalancer != nil {
|
||||||
|
policy.LoadBalancer = portTrafficPolicy.LoadBalancer
|
||||||
|
} else if policy.LoadBalancer != nil && policy.LoadBalancer.LbPolicy == nil &&
|
||||||
|
portTrafficPolicy.LoadBalancer != nil && portTrafficPolicy.LoadBalancer.LbPolicy != nil {
|
||||||
|
policy.LoadBalancer.LbPolicy = portTrafficPolicy.LoadBalancer.LbPolicy
|
||||||
|
}
|
||||||
portUpdated = true
|
portUpdated = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user