Move apiserver cloudprovider dep into kubeapiserver

This commit is contained in:
Dr. Stefan Schimanski
2017-01-04 18:57:06 +01:00
parent 5e9f39b5fb
commit f96fa748d8
9 changed files with 103 additions and 55 deletions

View File

@@ -43,6 +43,7 @@ type ServerRunOptions struct {
InsecureServing *genericoptions.ServingOptions
Authentication *kubeoptions.BuiltInAuthenticationOptions
Authorization *kubeoptions.BuiltInAuthorizationOptions
CloudProvider *kubeoptions.CloudProviderOptions
AllowPrivileged bool
EventTTL time.Duration
@@ -65,6 +66,7 @@ func NewServerRunOptions() *ServerRunOptions {
InsecureServing: genericoptions.NewInsecureServingOptions(),
Authentication: kubeoptions.NewBuiltInAuthenticationOptions().WithAll(),
Authorization: kubeoptions.NewBuiltInAuthorizationOptions(),
CloudProvider: kubeoptions.NewCloudProviderOptions(),
EventTTL: 1 * time.Hour,
MasterCount: 1,
@@ -96,6 +98,7 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
s.InsecureServing.AddDeprecatedFlags(fs)
s.Authentication.AddFlags(fs)
s.Authorization.AddFlags(fs)
s.CloudProvider.AddFlags(fs)
// Note: the weird ""+ in below lines seems to be the only way to get gofmt to
// arrange these text blocks sensibly. Grrr.

View File

@@ -90,7 +90,7 @@ func Run(s *options.ServerRunOptions) error {
if err := s.SecureServing.MaybeDefaultWithSelfSignedCerts(s.GenericServerRunOptions.AdvertiseAddress.String(), apiServerServiceIP); err != nil {
return fmt.Errorf("error creating self-signed certificates: %v", err)
}
if err := s.GenericServerRunOptions.DefaultExternalHost(); err != nil {
if err := s.CloudProvider.DefaultExternalHost(s.GenericServerRunOptions); err != nil {
return fmt.Errorf("error setting the external host value: %v", err)
}
@@ -128,7 +128,7 @@ func Run(s *options.ServerRunOptions) error {
if len(s.SSHUser) > 0 {
// Get ssh key distribution func, if supported
var installSSH genericapiserver.InstallSSHKey
cloud, err := cloudprovider.InitCloudProvider(s.GenericServerRunOptions.CloudProvider, s.GenericServerRunOptions.CloudConfigFile)
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider.CloudProvider, s.CloudProvider.CloudConfigFile)
if err != nil {
return fmt.Errorf("cloud provider could not be initialized: %v", err)
}