Skip to content

Commit

Permalink
remove len check
Browse files Browse the repository at this point in the history
Signed-off-by: Megrez Lu <[email protected]>
  • Loading branch information
lujiajing1126 committed Nov 29, 2024
1 parent 8880544 commit dc83e23
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pkg/trafficrouting/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,11 @@ func (m *Manager) createCanaryService(c *TrafficRoutingContext, cService string,
for i := range canaryService.Spec.Ports {
canaryService.Spec.Ports[i].NodePort = 0
}
if len(c.CanaryServiceSelectorPatch) > 0 {
for key, val := range c.CanaryServiceSelectorPatch {
if _, ok := canaryService.Spec.Selector[key]; ok {
canaryService.Spec.Selector[key] = val
} else if utilfeature.DefaultFeatureGate.Enabled(feature.AppendServiceSelectorGate) {
canaryService.Spec.Selector[key] = val
}
for key, val := range c.CanaryServiceSelectorPatch {
if _, ok := canaryService.Spec.Selector[key]; ok {
canaryService.Spec.Selector[key] = val
} else if utilfeature.DefaultFeatureGate.Enabled(feature.AppendServiceSelectorGate) {
canaryService.Spec.Selector[key] = val
}
}
err := m.Create(context.TODO(), canaryService)
Expand Down

0 comments on commit dc83e23

Please sign in to comment.