Skip to content

Commit

Permalink
Fix node port usage
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Jul 21, 2021
1 parent 8b9a8c4 commit ec23ea8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion controllers/cloud.redhat.com/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,23 @@ func MakeService(service *core.Service, nn types.NamespacedName, labels map[stri
labeler := GetCustomLabeler(labels, nn, baseResource)
labeler(service)
service.Spec.Selector = labels
service.Spec.Ports = ports
if nodePort {
for i, sport := range ports {
for _, dport := range service.Spec.Ports {
if sport.Name == dport.Name {
if dport.NodePort != 0 {
sport.NodePort = dport.NodePort
}
break
}
}
ports[i] = sport
}
service.Spec.Type = "NodePort"
} else {
service.Spec.Type = "ClusterIP"
}
service.Spec.Ports = ports
}

// MakePVC takes a PVC object and applies the correct ownership and labels to it.
Expand Down

0 comments on commit ec23ea8

Please sign in to comment.