remove duplicated validation for service-cluster-ip-range

This commit is contained in:
xiongzhongliang 2021-03-02 00:55:49 +08:00 committed by pandaamanda
parent 793390e13b
commit e6d6409cf8
2 changed files with 6 additions and 18 deletions

View File

@ -71,6 +71,8 @@ type ServerRunOptions struct {
// of parsing ServiceClusterIPRange into actual values
PrimaryServiceClusterIPRange net.IPNet
SecondaryServiceClusterIPRange net.IPNet
// APIServerServiceIP is the first valid IP from PrimaryServiceClusterIPRange
APIServerServiceIP net.IP
ServiceNodePortRange utilnet.PortRange
SSHKeyfile string

View File

@ -330,21 +330,6 @@ func CreateKubeAPIServerConfig(
s.Logs.Apply()
serviceIPRange, apiServerServiceIP, err := controlplane.ServiceIPRange(s.PrimaryServiceClusterIPRange)
if err != nil {
return nil, nil, nil, err
}
// defaults to empty range and ip
var secondaryServiceIPRange net.IPNet
// process secondary range only if provided by user
if s.SecondaryServiceClusterIPRange.IP != nil {
secondaryServiceIPRange, _, err = controlplane.ServiceIPRange(s.SecondaryServiceClusterIPRange)
if err != nil {
return nil, nil, nil, err
}
}
config := &controlplane.Config{
GenericConfig: genericConfig,
ExtraConfig: controlplane.ExtraConfig{
@ -357,9 +342,9 @@ func CreateKubeAPIServerConfig(
Tunneler: nodeTunneler,
ServiceIPRange: serviceIPRange,
APIServerServiceIP: apiServerServiceIP,
SecondaryServiceIPRange: secondaryServiceIPRange,
ServiceIPRange: s.PrimaryServiceClusterIPRange,
APIServerServiceIP: s.APIServerServiceIP,
SecondaryServiceIPRange: s.SecondaryServiceClusterIPRange,
APIServerServicePort: 443,
@ -611,6 +596,7 @@ func Complete(s *options.ServerRunOptions) (completedServerRunOptions, error) {
}
s.PrimaryServiceClusterIPRange = primaryServiceIPRange
s.SecondaryServiceClusterIPRange = secondaryServiceIPRange
s.APIServerServiceIP = apiServerServiceIP
if err := s.SecureServing.MaybeDefaultWithSelfSignedCerts(s.GenericServerRunOptions.AdvertiseAddress.String(), []string{"kubernetes.default.svc", "kubernetes.default", "kubernetes"}, []net.IP{apiServerServiceIP}); err != nil {
return options, fmt.Errorf("error creating self-signed certificates: %v", err)