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
4
vendor/k8s.io/cloud-provider/app/config/config.go
generated
vendored
4
vendor/k8s.io/cloud-provider/app/config/config.go
generated
vendored
@ -37,6 +37,10 @@ type Config struct {
|
||||
Authentication apiserver.AuthenticationInfo
|
||||
Authorization apiserver.AuthorizationInfo
|
||||
|
||||
// WebhookSecureServing is a separate SecureServing configuration from
|
||||
// healthz, configz, and metrics.
|
||||
WebhookSecureServing *apiserver.SecureServingInfo
|
||||
|
||||
// the general kube client
|
||||
Client *clientset.Clientset
|
||||
|
||||
|
5
vendor/k8s.io/cloud-provider/cloud.go
generated
vendored
5
vendor/k8s.io/cloud-provider/cloud.go
generated
vendored
@ -218,6 +218,11 @@ type Route struct {
|
||||
Name string
|
||||
// TargetNode is the NodeName of the target instance.
|
||||
TargetNode types.NodeName
|
||||
// EnableNodeAddresses is a feature gate for TargetNodeAddresses. If false, ignore TargetNodeAddresses.
|
||||
// Without this, if users haven't updated their cloud-provider, reconcile() will delete and create same route every time.
|
||||
EnableNodeAddresses bool
|
||||
// TargetNodeAddresses are the Node IPs of the target Node.
|
||||
TargetNodeAddresses []v1.NodeAddress
|
||||
// DestinationCIDR is the CIDR format IP range that this routing rule
|
||||
// applies to.
|
||||
DestinationCIDR string
|
||||
|
17
vendor/k8s.io/cloud-provider/config/types.go
generated
vendored
17
vendor/k8s.io/cloud-provider/config/types.go
generated
vendored
@ -18,6 +18,7 @@ package config
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
nodeconfig "k8s.io/cloud-provider/controllers/node/config"
|
||||
serviceconfig "k8s.io/cloud-provider/controllers/service/config"
|
||||
cmconfig "k8s.io/controller-manager/config"
|
||||
)
|
||||
@ -34,12 +35,19 @@ type CloudControllerManagerConfiguration struct {
|
||||
// both in cloud controller manager and kube-controller manager.
|
||||
KubeCloudShared KubeCloudSharedConfiguration
|
||||
|
||||
// NodeController holds configuration for node controller
|
||||
// related features.
|
||||
NodeController nodeconfig.NodeControllerConfiguration
|
||||
|
||||
// ServiceControllerConfiguration holds configuration for ServiceController
|
||||
// related features.
|
||||
ServiceController serviceconfig.ServiceControllerConfiguration
|
||||
|
||||
// NodeStatusUpdateFrequency is the frequency at which the controller updates nodes' status
|
||||
NodeStatusUpdateFrequency metav1.Duration
|
||||
|
||||
// Webhook is the configuration for cloud-controller-manager hosted webhooks
|
||||
Webhook WebhookConfiguration
|
||||
}
|
||||
|
||||
// KubeCloudSharedConfiguration contains elements shared by both kube-controller manager
|
||||
@ -84,3 +92,12 @@ type CloudProviderConfiguration struct {
|
||||
// cloudConfigFile is the path to the cloud provider configuration file.
|
||||
CloudConfigFile string
|
||||
}
|
||||
|
||||
type WebhookConfiguration struct {
|
||||
// Webhooks is the list of webhooks to enable or disable
|
||||
// '*' means "all enabled by default webhooks"
|
||||
// 'foo' means "enable 'foo'"
|
||||
// '-foo' means "disable 'foo'"
|
||||
// first item for a particular name wins
|
||||
Webhooks []string
|
||||
}
|
||||
|
3
vendor/k8s.io/cloud-provider/config/v1alpha1/defaults.go
generated
vendored
3
vendor/k8s.io/cloud-provider/config/v1alpha1/defaults.go
generated
vendored
@ -21,6 +21,7 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
nodeconfigv1alpha1 "k8s.io/cloud-provider/controllers/node/config/v1alpha1"
|
||||
serviceconfigv1alpha1 "k8s.io/cloud-provider/controllers/service/config/v1alpha1"
|
||||
cmconfigv1alpha1 "k8s.io/controller-manager/config/v1alpha1"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
@ -49,6 +50,8 @@ func SetDefaults_CloudControllerManagerConfiguration(obj *CloudControllerManager
|
||||
cmconfigv1alpha1.RecommendedDefaultGenericControllerManagerConfiguration(&obj.Generic)
|
||||
// Use the default RecommendedDefaultServiceControllerConfiguration options
|
||||
serviceconfigv1alpha1.RecommendedDefaultServiceControllerConfiguration(&obj.ServiceController)
|
||||
// Use the default RecommendedDefaultNodeControllerConfiguration options
|
||||
nodeconfigv1alpha1.RecommendedDefaultNodeControllerConfiguration(&obj.NodeController)
|
||||
}
|
||||
|
||||
func SetDefaults_KubeCloudSharedConfiguration(obj *KubeCloudSharedConfiguration) {
|
||||
|
18
vendor/k8s.io/cloud-provider/config/v1alpha1/types.go
generated
vendored
18
vendor/k8s.io/cloud-provider/config/v1alpha1/types.go
generated
vendored
@ -18,12 +18,14 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
nodeconfigv1alpha1 "k8s.io/cloud-provider/controllers/node/config/v1alpha1"
|
||||
serviceconfigv1alpha1 "k8s.io/cloud-provider/controllers/service/config/v1alpha1"
|
||||
cmconfigv1alpha1 "k8s.io/controller-manager/config/v1alpha1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// CloudControllerManagerConfiguration contains elements describing cloud-controller manager.
|
||||
type CloudControllerManagerConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
@ -32,11 +34,16 @@ type CloudControllerManagerConfiguration struct {
|
||||
// KubeCloudSharedConfiguration holds configuration for shared related features
|
||||
// both in cloud controller manager and kube-controller manager.
|
||||
KubeCloudShared KubeCloudSharedConfiguration
|
||||
// NodeController holds configuration for node controller
|
||||
// related features.
|
||||
NodeController nodeconfigv1alpha1.NodeControllerConfiguration
|
||||
// ServiceControllerConfiguration holds configuration for ServiceController
|
||||
// related features.
|
||||
ServiceController serviceconfigv1alpha1.ServiceControllerConfiguration
|
||||
// NodeStatusUpdateFrequency is the frequency at which the controller updates nodes' status
|
||||
NodeStatusUpdateFrequency metav1.Duration
|
||||
// Webhook is the configuration for cloud-controller-manager hosted webhooks
|
||||
Webhook WebhookConfiguration
|
||||
}
|
||||
|
||||
// KubeCloudSharedConfiguration contains elements shared by both kube-controller manager
|
||||
@ -81,3 +88,14 @@ type CloudProviderConfiguration struct {
|
||||
// cloudConfigFile is the path to the cloud provider configuration file.
|
||||
CloudConfigFile string
|
||||
}
|
||||
|
||||
// WebhookConfiguration contains configuration related to
|
||||
// cloud-controller-manager hosted webhooks
|
||||
type WebhookConfiguration struct {
|
||||
// Webhooks is the list of webhooks to enable or disable
|
||||
// '*' means "all enabled by default webhooks"
|
||||
// 'foo' means "enable 'foo'"
|
||||
// '-foo' means "disable 'foo'"
|
||||
// first item for a particular name wins
|
||||
Webhooks []string
|
||||
}
|
||||
|
45
vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.conversion.go
generated
vendored
45
vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.conversion.go
generated
vendored
@ -22,10 +22,13 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
config "k8s.io/cloud-provider/config"
|
||||
nodeconfigv1alpha1 "k8s.io/cloud-provider/controllers/node/config/v1alpha1"
|
||||
serviceconfigv1alpha1 "k8s.io/cloud-provider/controllers/service/config/v1alpha1"
|
||||
configv1alpha1 "k8s.io/controller-manager/config/v1alpha1"
|
||||
)
|
||||
@ -47,6 +50,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*WebhookConfiguration)(nil), (*config.WebhookConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(a.(*WebhookConfiguration), b.(*config.WebhookConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.WebhookConfiguration)(nil), (*WebhookConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(a.(*config.WebhookConfiguration), b.(*WebhookConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*config.CloudProviderConfiguration)(nil), (*CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(a.(*config.CloudProviderConfiguration), b.(*CloudProviderConfiguration), scope)
|
||||
}); err != nil {
|
||||
@ -77,10 +90,16 @@ func autoConvert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudCon
|
||||
if err := Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(&in.KubeCloudShared, &out.KubeCloudShared, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := nodeconfigv1alpha1.Convert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(&in.NodeController, &out.NodeController, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := serviceconfigv1alpha1.Convert_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration(&in.ServiceController, &out.ServiceController, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
if err := Convert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(&in.Webhook, &out.Webhook, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -96,10 +115,16 @@ func autoConvert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudCon
|
||||
if err := Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(&in.KubeCloudShared, &out.KubeCloudShared, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := nodeconfigv1alpha1.Convert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(&in.NodeController, &out.NodeController, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := serviceconfigv1alpha1.Convert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration(&in.ServiceController, &out.ServiceController, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
if err := Convert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(&in.Webhook, &out.Webhook, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -159,3 +184,23 @@ func autoConvert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudShared
|
||||
out.NodeSyncPeriod = in.NodeSyncPeriod
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(in *WebhookConfiguration, out *config.WebhookConfiguration, s conversion.Scope) error {
|
||||
out.Webhooks = *(*[]string)(unsafe.Pointer(&in.Webhooks))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(in *WebhookConfiguration, out *config.WebhookConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in *config.WebhookConfiguration, out *WebhookConfiguration, s conversion.Scope) error {
|
||||
out.Webhooks = *(*[]string)(unsafe.Pointer(&in.Webhooks))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in *config.WebhookConfiguration, out *WebhookConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in, out, s)
|
||||
}
|
||||
|
23
vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
23
vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
@ -31,8 +31,10 @@ func (in *CloudControllerManagerConfiguration) DeepCopyInto(out *CloudController
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Generic.DeepCopyInto(&out.Generic)
|
||||
in.KubeCloudShared.DeepCopyInto(&out.KubeCloudShared)
|
||||
out.NodeController = in.NodeController
|
||||
out.ServiceController = in.ServiceController
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
in.Webhook.DeepCopyInto(&out.Webhook)
|
||||
return
|
||||
}
|
||||
|
||||
@ -94,3 +96,24 @@ func (in *KubeCloudSharedConfiguration) DeepCopy() *KubeCloudSharedConfiguration
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WebhookConfiguration) DeepCopyInto(out *WebhookConfiguration) {
|
||||
*out = *in
|
||||
if in.Webhooks != nil {
|
||||
in, out := &in.Webhooks, &out.Webhooks
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfiguration.
|
||||
func (in *WebhookConfiguration) DeepCopy() *WebhookConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
23
vendor/k8s.io/cloud-provider/config/zz_generated.deepcopy.go
generated
vendored
23
vendor/k8s.io/cloud-provider/config/zz_generated.deepcopy.go
generated
vendored
@ -31,8 +31,10 @@ func (in *CloudControllerManagerConfiguration) DeepCopyInto(out *CloudController
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Generic.DeepCopyInto(&out.Generic)
|
||||
out.KubeCloudShared = in.KubeCloudShared
|
||||
out.NodeController = in.NodeController
|
||||
out.ServiceController = in.ServiceController
|
||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
||||
in.Webhook.DeepCopyInto(&out.Webhook)
|
||||
return
|
||||
}
|
||||
|
||||
@ -89,3 +91,24 @@ func (in *KubeCloudSharedConfiguration) DeepCopy() *KubeCloudSharedConfiguration
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WebhookConfiguration) DeepCopyInto(out *WebhookConfiguration) {
|
||||
*out = *in
|
||||
if in.Webhooks != nil {
|
||||
in, out := &in.Webhooks, &out.Webhooks
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfiguration.
|
||||
func (in *WebhookConfiguration) DeepCopy() *WebhookConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
24
vendor/k8s.io/cloud-provider/controllers/node/config/types.go
generated
vendored
Normal file
24
vendor/k8s.io/cloud-provider/controllers/node/config/types.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
// NodeControllerConfiguration contains elements describing NodeController.
|
||||
type NodeControllerConfiguration struct {
|
||||
// ConcurrentNodeSyncs is the number of workers
|
||||
// concurrently synchronizing nodes
|
||||
ConcurrentNodeSyncs int32
|
||||
}
|
39
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/conversion.go
generated
vendored
Normal file
39
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/conversion.go
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/cloud-provider/controllers/node/config"
|
||||
)
|
||||
|
||||
// Important! The public back-and-forth conversion functions for the types in this generic
|
||||
// package with ComponentConfig types need to be manually exposed like this in order for
|
||||
// other packages that reference this package to be able to call these conversion functions
|
||||
// in an autogenerated manner.
|
||||
// TODO: Fix the bug in conversion-gen so it automatically discovers these Convert_* functions
|
||||
// in autogenerated code as well.
|
||||
|
||||
// Convert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(in *config.NodeControllerConfiguration, out *NodeControllerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(in *NodeControllerConfiguration, out *config.NodeControllerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(in, out, s)
|
||||
}
|
23
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/defaults.go
generated
vendored
Normal file
23
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/defaults.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
func RecommendedDefaultNodeControllerConfiguration(obj *NodeControllerConfiguration) {
|
||||
if obj.ConcurrentNodeSyncs == 0 {
|
||||
obj.ConcurrentNodeSyncs = 1
|
||||
}
|
||||
}
|
21
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/doc.go
generated
vendored
Normal file
21
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/controllers/node/config
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/controllers/node/config/v1alpha1
|
||||
|
||||
package v1alpha1 // import "k8s.io/cloud-provider/controllers/node/config/v1alpha1"
|
31
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/register.go
generated
vendored
Normal file
31
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeBuilder is the scheme builder with scheme init functions to run for this API package
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
|
||||
// defaulting and conversion init funcs are registered as well.
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
// AddToScheme is a global function that registers this API group & version to a scheme
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
24
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go
generated
vendored
Normal file
24
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// NodeControllerConfiguration contains elements describing NodeController.
|
||||
type NodeControllerConfiguration struct {
|
||||
// ConcurrentNodeSyncs is the number of workers
|
||||
// concurrently synchronizing nodes
|
||||
ConcurrentNodeSyncs int32
|
||||
}
|
58
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
58
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
config "k8s.io/cloud-provider/controllers/node/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddConversionFunc((*config.NodeControllerConfiguration)(nil), (*NodeControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(a.(*config.NodeControllerConfiguration), b.(*NodeControllerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*NodeControllerConfiguration)(nil), (*config.NodeControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(a.(*NodeControllerConfiguration), b.(*config.NodeControllerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(in *NodeControllerConfiguration, out *config.NodeControllerConfiguration, s conversion.Scope) error {
|
||||
out.ConcurrentNodeSyncs = in.ConcurrentNodeSyncs
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(in *config.NodeControllerConfiguration, out *NodeControllerConfiguration, s conversion.Scope) error {
|
||||
out.ConcurrentNodeSyncs = in.ConcurrentNodeSyncs
|
||||
return nil
|
||||
}
|
38
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
38
vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NodeControllerConfiguration) DeepCopyInto(out *NodeControllerConfiguration) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeControllerConfiguration.
|
||||
func (in *NodeControllerConfiguration) DeepCopy() *NodeControllerConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NodeControllerConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
62
vendor/k8s.io/cloud-provider/options/nodecontroller.go
generated
vendored
Normal file
62
vendor/k8s.io/cloud-provider/options/nodecontroller.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
nodeconfig "k8s.io/cloud-provider/controllers/node/config"
|
||||
)
|
||||
|
||||
// NodeControllerOptions holds the ServiceController options.
|
||||
type NodeControllerOptions struct {
|
||||
*nodeconfig.NodeControllerConfiguration
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ServiceController for controller manager to the specified FlagSet.
|
||||
func (o *NodeControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentNodeSyncs, "concurrent-node-syncs", o.ConcurrentNodeSyncs, "Number of workers concurrently synchronizing nodes.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ServiceController config with options.
|
||||
func (o *NodeControllerOptions) ApplyTo(cfg *nodeconfig.NodeControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentNodeSyncs = o.ConcurrentNodeSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of NodeControllerOptions.
|
||||
func (o *NodeControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
var errors []error
|
||||
if o.ConcurrentNodeSyncs <= 0 {
|
||||
errors = append(errors, fmt.Errorf("concurrent-node-syncs must be a positive number"))
|
||||
}
|
||||
return errors
|
||||
}
|
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
|
||||
|
206
vendor/k8s.io/cloud-provider/options/webhook.go
generated
vendored
Normal file
206
vendor/k8s.io/cloud-provider/options/webhook.go
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apiserver/pkg/server"
|
||||
"k8s.io/apiserver/pkg/server/dynamiccertificates"
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
"k8s.io/cloud-provider/config"
|
||||
netutils "k8s.io/utils/net"
|
||||
)
|
||||
|
||||
const (
|
||||
CloudControllerManagerWebhookPort = 10260
|
||||
)
|
||||
|
||||
type WebhookOptions struct {
|
||||
// Webhooks is the list of webhook names that should be enabled or disabled
|
||||
Webhooks []string
|
||||
}
|
||||
|
||||
func NewWebhookOptions() *WebhookOptions {
|
||||
o := &WebhookOptions{}
|
||||
return o
|
||||
}
|
||||
|
||||
func (o *WebhookOptions) AddFlags(fs *pflag.FlagSet, allWebhooks, disabledByDefaultWebhooks []string) {
|
||||
fs.StringSliceVar(&o.Webhooks, "webhooks", o.Webhooks, fmt.Sprintf(""+
|
||||
"A list of webhooks to enable. '*' enables all on-by-default webhooks, 'foo' enables the webhook "+
|
||||
"named 'foo', '-foo' disables the webhook named 'foo'.\nAll webhooks: %s\nDisabled-by-default webhooks: %s",
|
||||
strings.Join(allWebhooks, ", "), strings.Join(disabledByDefaultWebhooks, ", ")))
|
||||
}
|
||||
|
||||
func (o *WebhookOptions) Validate(allWebhooks, disabledByDefaultWebhooks []string) []error {
|
||||
allErrors := []error{}
|
||||
|
||||
allWebhooksSet := sets.NewString(allWebhooks...)
|
||||
toValidate := sets.NewString(o.Webhooks...)
|
||||
toValidate.Insert(disabledByDefaultWebhooks...)
|
||||
for _, webhook := range toValidate.List() {
|
||||
if webhook == "*" {
|
||||
continue
|
||||
}
|
||||
webhook = strings.TrimPrefix(webhook, "-")
|
||||
if !allWebhooksSet.Has(webhook) {
|
||||
allErrors = append(allErrors, fmt.Errorf("%q is not in the list of known webhooks", webhook))
|
||||
}
|
||||
}
|
||||
|
||||
return allErrors
|
||||
}
|
||||
|
||||
func (o *WebhookOptions) ApplyTo(cfg *config.WebhookConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.Webhooks = o.Webhooks
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type WebhookServingOptions struct {
|
||||
*apiserveroptions.SecureServingOptions
|
||||
}
|
||||
|
||||
func NewWebhookServingOptions(defaults ProviderDefaults) *WebhookServingOptions {
|
||||
var (
|
||||
bindAddress net.IP
|
||||
bindPort int
|
||||
)
|
||||
|
||||
if defaults.WebhookBindAddress != nil {
|
||||
bindAddress = *defaults.WebhookBindAddress
|
||||
} else {
|
||||
bindAddress = netutils.ParseIPSloppy("0.0.0.0")
|
||||
}
|
||||
|
||||
if defaults.WebhookBindPort != nil {
|
||||
bindPort = *defaults.WebhookBindPort
|
||||
} else {
|
||||
bindPort = CloudControllerManagerWebhookPort
|
||||
}
|
||||
|
||||
return &WebhookServingOptions{
|
||||
SecureServingOptions: &apiserveroptions.SecureServingOptions{
|
||||
BindAddress: bindAddress,
|
||||
BindPort: bindPort,
|
||||
ServerCert: apiserveroptions.GeneratableKeyCert{
|
||||
CertDirectory: "",
|
||||
PairName: "cloud-controller-manager-webhook",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (o *WebhookServingOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.IPVar(&o.BindAddress, "webhook-bind-address", o.BindAddress, ""+
|
||||
"The IP address on which to listen for the --webhook-secure-port port. The "+
|
||||
"associated interface(s) must be reachable by the rest of the cluster, and by CLI/web "+
|
||||
fmt.Sprintf("clients. If set to an unspecified address (0.0.0.0 or ::), all interfaces will be used. If unset, defaults to %v.", o.BindAddress))
|
||||
|
||||
fs.IntVar(&o.BindPort, "webhook-secure-port", o.BindPort, fmt.Sprintf("Secure port to serve cloud provider webhooks. If unset, defaults to %d.", o.BindPort))
|
||||
|
||||
fs.StringVar(&o.ServerCert.CertDirectory, "webhook-cert-dir", o.ServerCert.CertDirectory, ""+
|
||||
"The directory where the TLS certs are located. "+
|
||||
"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.")
|
||||
|
||||
fs.StringVar(&o.ServerCert.CertKey.CertFile, "webhook-tls-cert-file", o.ServerCert.CertKey.CertFile, ""+
|
||||
"File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated "+
|
||||
"after server cert). If HTTPS serving is enabled, and --tls-cert-file and "+
|
||||
"--tls-private-key-file are not provided, a self-signed certificate and key "+
|
||||
"are generated for the public address and saved to the directory specified by --cert-dir.")
|
||||
|
||||
fs.StringVar(&o.ServerCert.CertKey.KeyFile, "webhook-tls-private-key-file", o.ServerCert.CertKey.KeyFile,
|
||||
"File containing the default x509 private key matching --tls-cert-file.")
|
||||
}
|
||||
|
||||
func (o *WebhookServingOptions) Validate() []error {
|
||||
allErrors := []error{}
|
||||
if o.BindPort < 0 || o.BindPort > 65535 {
|
||||
allErrors = append(allErrors, fmt.Errorf("--webhook-secure-port %v must be between 0 and 65535, inclusive. A value of 0 disables the webhook endpoint entirely.", o.BindPort))
|
||||
}
|
||||
|
||||
if (len(o.ServerCert.CertKey.CertFile) != 0 || len(o.ServerCert.CertKey.KeyFile) != 0) && o.ServerCert.GeneratedCert != nil {
|
||||
allErrors = append(allErrors, fmt.Errorf("cert/key file and in-memory certificate cannot both be set"))
|
||||
}
|
||||
|
||||
return allErrors
|
||||
}
|
||||
|
||||
func (o *WebhookServingOptions) ApplyTo(cfg **server.SecureServingInfo) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if o.BindPort <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
var listener net.Listener
|
||||
addr := net.JoinHostPort(o.BindAddress.String(), strconv.Itoa(o.BindPort))
|
||||
|
||||
l := net.ListenConfig{}
|
||||
|
||||
listener, o.BindPort, err = createListener(addr, l)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create listener: %v", err)
|
||||
}
|
||||
|
||||
*cfg = &server.SecureServingInfo{
|
||||
Listener: listener,
|
||||
}
|
||||
|
||||
serverCertFile, serverKeyFile := o.ServerCert.CertKey.CertFile, o.ServerCert.CertKey.KeyFile
|
||||
if len(serverCertFile) != 0 || len(serverKeyFile) != 0 {
|
||||
var err error
|
||||
(*cfg).Cert, err = dynamiccertificates.NewDynamicServingContentFromFiles("serving-cert", serverCertFile, serverKeyFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if o.ServerCert.GeneratedCert != nil {
|
||||
(*cfg).Cert = o.ServerCert.GeneratedCert
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func createListener(addr string, config net.ListenConfig) (net.Listener, int, error) {
|
||||
ln, err := config.Listen(context.TODO(), "tcp", addr)
|
||||
if err != nil {
|
||||
return nil, 0, fmt.Errorf("failed to listen on %v: %v", addr, err)
|
||||
}
|
||||
|
||||
// get port
|
||||
tcpAddr, ok := ln.Addr().(*net.TCPAddr)
|
||||
if !ok {
|
||||
ln.Close()
|
||||
return nil, 0, fmt.Errorf("invalid listen address: %q", ln.Addr().String())
|
||||
}
|
||||
|
||||
return ln, tcpAddr.Port, nil
|
||||
}
|
1
vendor/k8s.io/cloud-provider/plugins.go
generated
vendored
1
vendor/k8s.io/cloud-provider/plugins.go
generated
vendored
@ -40,7 +40,6 @@ var (
|
||||
external bool
|
||||
detail string
|
||||
}{
|
||||
{"aws", false, "The AWS provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-aws"},
|
||||
{"azure", false, "The Azure provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes-sigs/cloud-provider-azure"},
|
||||
{"gce", false, "The GCE provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-gcp"},
|
||||
{"vsphere", false, "The vSphere provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-vsphere"},
|
||||
|
Reference in New Issue
Block a user