Skip to content

Commit

Permalink
Merge pull request #401 from RedHatInsights/psav/fix_nodeport
Browse files Browse the repository at this point in the history
Fix node port usage
  • Loading branch information
psav authored Jul 21, 2021
2 parents f85a745 + ec23ea8 commit cb40885
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 cb40885

Please sign in to comment.