mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Do not retunr svc in case of error. Rename apiServerNodePortPort.
This commit is contained in:
parent
462b8d87cc
commit
e78699558b
@ -148,7 +148,7 @@ type initFederationOptions struct {
|
||||
apiServerServiceTypeString string
|
||||
apiServerServiceType v1.ServiceType
|
||||
apiServerAdvertiseAddress string
|
||||
apiServerNodePortsPort int32
|
||||
apiServerNodePortPort int32
|
||||
apiServerEnableHTTPBasicAuth bool
|
||||
apiServerEnableTokenAuth bool
|
||||
}
|
||||
@ -165,7 +165,7 @@ func (o *initFederationOptions) Bind(flags *pflag.FlagSet, defaultImage string)
|
||||
flags.StringVar(&o.controllerManagerOverridesString, "controllermanager-arg-overrides", "", "comma separated list of federation-controller-manager arguments to override: Example \"--arg1=value1,--arg2=value2...\"")
|
||||
flags.StringVar(&o.apiServerServiceTypeString, apiserverServiceTypeFlag, string(v1.ServiceTypeLoadBalancer), "The type of service to create for federation API server. Options: 'LoadBalancer' (default), 'NodePort'.")
|
||||
flags.StringVar(&o.apiServerAdvertiseAddress, apiserverAdvertiseAddressFlag, "", "Preferred address to advertise api server nodeport service. Valid only if '"+apiserverServiceTypeFlag+"=NodePort'.")
|
||||
flags.Int32Var(&o.apiServerNodePortsPort, apiserverPortFlag , 0, "Preferred port to use for api server nodeport service (0 for random port assignment). Valid only if '"+apiserverServiceTypeFlag+"=NodePort'.")
|
||||
flags.Int32Var(&o.apiServerNodePortPort, apiserverPortFlag , 0, "Preferred port to use for api server nodeport service (0 for random port assignment). Valid only if '"+apiserverServiceTypeFlag+"=NodePort'.")
|
||||
flags.BoolVar(&o.apiServerEnableHTTPBasicAuth, "apiserver-enable-basic-auth", false, "Enables HTTP Basic authentication for the federation-apiserver. Defaults to false.")
|
||||
flags.BoolVar(&o.apiServerEnableTokenAuth, "apiserver-enable-token-auth", false, "Enables token authentication for the federation-apiserver. Defaults to false.")
|
||||
}
|
||||
@ -232,12 +232,12 @@ func (i *initFederation) Complete(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if i.options.apiServerNodePortsPort != 0 {
|
||||
if i.options.apiServerNodePortPort != 0 {
|
||||
if i.options.apiServerServiceType != v1.ServiceTypeNodePort {
|
||||
return fmt.Errorf("%s should be passed only with '%s=NodePort'", apiserverPortFlag, apiserverServiceTypeFlag)
|
||||
}
|
||||
}
|
||||
if i.options.apiServerNodePortsPort < 0 || i.options.apiServerNodePortsPort > 65535 {
|
||||
if i.options.apiServerNodePortPort < 0 || i.options.apiServerNodePortPort > 65535 {
|
||||
return fmt.Errorf("Please provide a valid port number for %s", apiserverPortFlag)
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ func (i *initFederation) Run(cmdOut io.Writer, config util.AdminConfig) error {
|
||||
|
||||
fmt.Fprint(cmdOut, "Creating federation control plane service...")
|
||||
glog.V(4).Info("Creating federation control plane service")
|
||||
svc, ips, hostnames, err := createService(cmdOut, hostClientset, i.commonOptions.FederationSystemNamespace, serverName, i.commonOptions.Name, i.options.apiServerAdvertiseAddress, i.options.apiServerNodePortsPort, i.options.apiServerServiceType, i.options.dryRun)
|
||||
svc, ips, hostnames, err := createService(cmdOut, hostClientset, i.commonOptions.FederationSystemNamespace, serverName, i.commonOptions.Name, i.options.apiServerAdvertiseAddress, i.options.apiServerNodePortPort, i.options.apiServerServiceType, i.options.dryRun)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -485,7 +485,7 @@ func createService(cmdOut io.Writer, clientset client.Interface, namespace, svcN
|
||||
var err error
|
||||
svc, err = clientset.Core().Services(namespace).Create(svc)
|
||||
if err != nil {
|
||||
return svc, nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
ips := []string{}
|
||||
|
Loading…
Reference in New Issue
Block a user