mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update all k8s packages to 0.27.2
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
07b05616a0
commit
2551a0b05f
77
vendor/k8s.io/cloud-provider/options/options.go
generated
vendored
77
vendor/k8s.io/cloud-provider/options/options.go
generated
vendored
@ -57,20 +57,40 @@ type CloudControllerManagerOptions struct {
|
||||
Generic *cmoptions.GenericControllerManagerConfigurationOptions
|
||||
KubeCloudShared *KubeCloudSharedOptions
|
||||
ServiceController *ServiceControllerOptions
|
||||
NodeController *NodeControllerOptions
|
||||
|
||||
SecureServing *apiserveroptions.SecureServingOptionsWithLoopback
|
||||
Authentication *apiserveroptions.DelegatingAuthenticationOptions
|
||||
Authorization *apiserveroptions.DelegatingAuthorizationOptions
|
||||
|
||||
Master string
|
||||
Kubeconfig string
|
||||
Master string
|
||||
|
||||
WebhookServing *WebhookServingOptions
|
||||
Webhook *WebhookOptions
|
||||
|
||||
// NodeStatusUpdateFrequency is the frequency at which the controller updates nodes' status
|
||||
NodeStatusUpdateFrequency metav1.Duration
|
||||
}
|
||||
|
||||
// ProviderDefaults are provided by the consumer when calling
|
||||
// NewCloudControllerManagerOptions(), so that they can customize certain flag
|
||||
// default values.
|
||||
type ProviderDefaults struct {
|
||||
// WebhookBindAddress is the default address. It can be overridden by "--webhook-bind-address".
|
||||
WebhookBindAddress *net.IP
|
||||
// WebhookBindPort is the default port. It can be overridden by "--webhook-bind-port".
|
||||
WebhookBindPort *int
|
||||
}
|
||||
|
||||
// NewCloudControllerManagerOptions creates a new ExternalCMServer with a default config.
|
||||
func NewCloudControllerManagerOptions() (*CloudControllerManagerOptions, error) {
|
||||
return NewCloudControllerManagerOptionsWithProviderDefaults(ProviderDefaults{})
|
||||
}
|
||||
|
||||
// NewCloudControllerManagerOptionsWithProviderDefaults creates a new
|
||||
// ExternalCMServer with a default config, but allows the cloud provider to
|
||||
// override a select number of default option values.
|
||||
func NewCloudControllerManagerOptionsWithProviderDefaults(defaults ProviderDefaults) (*CloudControllerManagerOptions, error) {
|
||||
componentConfig, err := NewDefaultComponentConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -79,10 +99,15 @@ func NewCloudControllerManagerOptions() (*CloudControllerManagerOptions, error)
|
||||
s := CloudControllerManagerOptions{
|
||||
Generic: cmoptions.NewGenericControllerManagerConfigurationOptions(&componentConfig.Generic),
|
||||
KubeCloudShared: NewKubeCloudSharedOptions(&componentConfig.KubeCloudShared),
|
||||
NodeController: &NodeControllerOptions{
|
||||
NodeControllerConfiguration: &componentConfig.NodeController,
|
||||
},
|
||||
ServiceController: &ServiceControllerOptions{
|
||||
ServiceControllerConfiguration: &componentConfig.ServiceController,
|
||||
},
|
||||
SecureServing: apiserveroptions.NewSecureServingOptions().WithLoopback(),
|
||||
Webhook: NewWebhookOptions(),
|
||||
WebhookServing: NewWebhookServingOptions(defaults),
|
||||
Authentication: apiserveroptions.NewDelegatingAuthenticationOptions(),
|
||||
Authorization: apiserveroptions.NewDelegatingAuthorizationOptions(),
|
||||
NodeStatusUpdateFrequency: componentConfig.NodeStatusUpdateFrequency,
|
||||
@ -111,15 +136,23 @@ func NewDefaultComponentConfig() (*ccmconfig.CloudControllerManagerConfiguration
|
||||
if err := ccmconfigscheme.Scheme.Convert(versioned, internal, nil); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return internal, nil
|
||||
}
|
||||
|
||||
// Flags returns flags for a specific CloudController by section name
|
||||
func (o *CloudControllerManagerOptions) Flags(allControllers, disabledByDefaultControllers []string) cliflag.NamedFlagSets {
|
||||
func (o *CloudControllerManagerOptions) Flags(allControllers, disabledByDefaultControllers, allWebhooks, disabledByDefaultWebhooks []string) cliflag.NamedFlagSets {
|
||||
fss := cliflag.NamedFlagSets{}
|
||||
o.Generic.AddFlags(&fss, allControllers, disabledByDefaultControllers)
|
||||
o.KubeCloudShared.AddFlags(fss.FlagSet("generic"))
|
||||
o.NodeController.AddFlags(fss.FlagSet("node controller"))
|
||||
o.ServiceController.AddFlags(fss.FlagSet("service controller"))
|
||||
if o.Webhook != nil {
|
||||
o.Webhook.AddFlags(fss.FlagSet("webhook"), allWebhooks, disabledByDefaultWebhooks)
|
||||
}
|
||||
if o.WebhookServing != nil {
|
||||
o.WebhookServing.AddFlags(fss.FlagSet("webhook serving"))
|
||||
}
|
||||
|
||||
o.SecureServing.AddFlags(fss.FlagSet("secure serving"))
|
||||
o.Authentication.AddFlags(fss.FlagSet("authentication"))
|
||||
@ -127,9 +160,8 @@ func (o *CloudControllerManagerOptions) Flags(allControllers, disabledByDefaultC
|
||||
|
||||
fs := fss.FlagSet("misc")
|
||||
fs.StringVar(&o.Master, "master", o.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")
|
||||
fs.StringVar(&o.Kubeconfig, "kubeconfig", o.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
||||
fs.StringVar(&o.Generic.ClientConnection.Kubeconfig, "kubeconfig", o.Generic.ClientConnection.Kubeconfig, "Path to kubeconfig file with authorization and master location information (the master location can be overridden by the master flag).")
|
||||
fs.DurationVar(&o.NodeStatusUpdateFrequency.Duration, "node-status-update-frequency", o.NodeStatusUpdateFrequency.Duration, "Specifies how often the controller updates nodes' status.")
|
||||
|
||||
utilfeature.DefaultMutableFeatureGate.AddFlag(fss.FlagSet("generic"))
|
||||
|
||||
return fss
|
||||
@ -142,7 +174,7 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent stri
|
||||
// Build kubeconfig first to so that if it fails, it doesn't cause leaking
|
||||
// goroutines (started from initializing secure serving - which underneath
|
||||
// creates a queue which in its constructor starts a goroutine).
|
||||
c.Kubeconfig, err = clientcmd.BuildConfigFromFlags(o.Master, o.Kubeconfig)
|
||||
c.Kubeconfig, err = clientcmd.BuildConfigFromFlags(o.Master, o.Generic.ClientConnection.Kubeconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -161,6 +193,16 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent stri
|
||||
if err = o.ServiceController.ApplyTo(&c.ComponentConfig.ServiceController); err != nil {
|
||||
return err
|
||||
}
|
||||
if o.Webhook != nil {
|
||||
if err = o.Webhook.ApplyTo(&c.ComponentConfig.Webhook); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if o.WebhookServing != nil {
|
||||
if err = o.WebhookServing.ApplyTo(&c.WebhookSecureServing); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = o.SecureServing.ApplyTo(&c.SecureServing, &c.LoopbackClientConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -198,12 +240,13 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent stri
|
||||
// sync back to component config
|
||||
// TODO: find more elegant way than syncing back the values.
|
||||
c.ComponentConfig.NodeStatusUpdateFrequency = o.NodeStatusUpdateFrequency
|
||||
c.ComponentConfig.NodeController.ConcurrentNodeSyncs = o.NodeController.ConcurrentNodeSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate is used to validate config before launching the cloud controller manager
|
||||
func (o *CloudControllerManagerOptions) Validate(allControllers, disabledByDefaultControllers []string) error {
|
||||
func (o *CloudControllerManagerOptions) Validate(allControllers, disabledByDefaultControllers, allWebhooks, disabledByDefaultWebhooks []string) error {
|
||||
errors := []error{}
|
||||
|
||||
errors = append(errors, o.Generic.Validate(allControllers, disabledByDefaultControllers)...)
|
||||
@ -213,6 +256,16 @@ func (o *CloudControllerManagerOptions) Validate(allControllers, disabledByDefau
|
||||
errors = append(errors, o.Authentication.Validate()...)
|
||||
errors = append(errors, o.Authorization.Validate()...)
|
||||
|
||||
if o.Webhook != nil {
|
||||
errors = append(errors, o.Webhook.Validate(allWebhooks, disabledByDefaultWebhooks)...)
|
||||
}
|
||||
if o.WebhookServing != nil {
|
||||
errors = append(errors, o.WebhookServing.Validate()...)
|
||||
|
||||
if o.WebhookServing.BindPort == o.SecureServing.BindPort {
|
||||
errors = append(errors, fmt.Errorf("--webhook-secure-port cannot be the same value as --secure-port"))
|
||||
}
|
||||
}
|
||||
if len(o.KubeCloudShared.CloudProvider.Name) == 0 {
|
||||
errors = append(errors, fmt.Errorf("--cloud-provider cannot be empty"))
|
||||
}
|
||||
@ -229,8 +282,8 @@ func resyncPeriod(c *config.Config) func() time.Duration {
|
||||
}
|
||||
|
||||
// Config return a cloud controller manager config objective
|
||||
func (o *CloudControllerManagerOptions) Config(allControllers, disabledByDefaultControllers []string) (*config.Config, error) {
|
||||
if err := o.Validate(allControllers, disabledByDefaultControllers); err != nil {
|
||||
func (o *CloudControllerManagerOptions) Config(allControllers, disabledByDefaultControllers, allWebhooks, disabledByDefaultWebhooks []string) (*config.Config, error) {
|
||||
if err := o.Validate(allControllers, disabledByDefaultControllers, allWebhooks, disabledByDefaultWebhooks); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -238,6 +291,12 @@ func (o *CloudControllerManagerOptions) Config(allControllers, disabledByDefault
|
||||
return nil, fmt.Errorf("error creating self-signed certificates: %v", err)
|
||||
}
|
||||
|
||||
if o.WebhookServing != nil {
|
||||
if err := o.WebhookServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{netutils.ParseIPSloppy("127.0.0.1")}); err != nil {
|
||||
return nil, fmt.Errorf("error creating self-signed certificates for webhook: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
c := &config.Config{}
|
||||
if err := o.ApplyTo(c, CloudControllerManagerUserAgent); err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user