Skip to content

Commit fdb0722

Browse files
committed
update validation for conflict
1 parent 49b16b1 commit fdb0722

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

apis/v1alpha1/upstreamsettingspolicy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const (
137137
// distributing requests evenly across all upstream servers.
138138
LoadBalancingTypeRoundRobin LoadBalancingType = "round_robin"
139139

140-
// LoadBalancingTypeLeastConn enables least-connections load balancing,
140+
// LoadBalancingTypeLeastConnection enables least-connections load balancing,
141141
// routing requests to the upstream server with the fewest active connections.
142142
LoadBalancingTypeLeastConnection LoadBalancingType = "least_conn"
143143

internal/controller/nginx/config/policies/upstreamsettings/validator.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ func conflicts(a, b ngfAPI.UpstreamSettingsPolicySpec) bool {
9191
}
9292
}
9393

94-
if !checkConflictForLoadBalancingFields(a, b) {
94+
if checkConflictsForLoadBalancingFields(a, b) {
9595
return true
9696
}
9797

9898
return false
9999
}
100100

101-
func checkConflictForLoadBalancingFields(a, b ngfAPI.UpstreamSettingsPolicySpec) bool {
101+
func checkConflictsForLoadBalancingFields(a, b ngfAPI.UpstreamSettingsPolicySpec) bool {
102102
if a.LoadBalancingMethod != nil && b.LoadBalancingMethod != nil {
103-
return *a.LoadBalancingMethod == *b.LoadBalancingMethod
103+
return true
104104
}
105105

106106
if a.HashMethodKey != nil && b.HashMethodKey != nil {
107-
return *a.HashMethodKey == *b.HashMethodKey
107+
return true
108108
}
109109

110-
return true
110+
return false
111111
}
112112

113113
// validateSettings performs validation on fields in the spec that are vulnerable to code injection.

0 commit comments

Comments
 (0)