mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Return error instead of crashing apiserver when updating services with duplicate nodeports
This commit is contained in:
parent
e6ad515315
commit
330517a3a0
@ -617,9 +617,8 @@ func (rs *REST) updateNodePorts(oldService, newService *api.Service, nodePortOp
|
||||
servicePort.NodePort = int32(nodePortNumber)
|
||||
nodePort.NodePort = servicePort.NodePort
|
||||
}
|
||||
// Detect duplicate node ports; this should have been caught by validation, so we panic
|
||||
if containsNodePort(newNodePorts, nodePort) {
|
||||
panic("duplicate node port")
|
||||
return fmt.Errorf("duplicate nodePort: %v", nodePort)
|
||||
}
|
||||
newNodePorts = append(newNodePorts, nodePort)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user