mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Check uper limit of port and ensure 0 corresponds to random port
This commit is contained in:
parent
1ffcba7d83
commit
462b8d87cc
@ -237,7 +237,7 @@ func (i *initFederation) Complete(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("%s should be passed only with '%s=NodePort'", apiserverPortFlag, apiserverServiceTypeFlag)
|
return fmt.Errorf("%s should be passed only with '%s=NodePort'", apiserverPortFlag, apiserverServiceTypeFlag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if i.options.apiServerNodePortsPort < 0 {
|
if i.options.apiServerNodePortsPort < 0 || i.options.apiServerNodePortsPort > 65535 {
|
||||||
return fmt.Errorf("Please provide a valid port number for %s", apiserverPortFlag)
|
return fmt.Errorf("Please provide a valid port number for %s", apiserverPortFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ func createService(cmdOut io.Writer, clientset client.Interface, namespace, svcN
|
|||||||
Port: 443,
|
Port: 443,
|
||||||
TargetPort: intstr.FromString(apiServerSecurePortName),
|
TargetPort: intstr.FromString(apiServerSecurePortName),
|
||||||
}
|
}
|
||||||
if apiserverServiceType == v1.ServiceTypeNodePort {
|
if apiserverServiceType == v1.ServiceTypeNodePort && apiserverPort > 0 {
|
||||||
port.NodePort = apiserverPort
|
port.NodePort = apiserverPort
|
||||||
}
|
}
|
||||||
svc := &api.Service{
|
svc := &api.Service{
|
||||||
|
Loading…
Reference in New Issue
Block a user