mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
build: move e2e dependencies into e2e/go.mod
Several packages are only used while running the e2e suite. These packages are less important to update, as the they can not influence the final executable that is part of the Ceph-CSI container-image. By moving these dependencies out of the main Ceph-CSI go.mod, it is easier to identify if a reported CVE affects Ceph-CSI, or only the testing (like most of the Kubernetes CVEs). Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
15da101b1b
commit
bec6090996
9
e2e/vendor/k8s.io/cloud-provider/CONTRIBUTING.md
generated
vendored
Normal file
9
e2e/vendor/k8s.io/cloud-provider/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Contributing guidelines
|
||||
|
||||
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md).
|
||||
|
||||
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes. Changes to this repo should be discussed with [sig cloud-provider](https://github.com/kubernetes/community/tree/master/sig-cloud-provider).
|
||||
|
||||
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/cloud-provider](https://git.k8s.io/kubernetes/staging/src/k8s.io/cloud-provider) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
|
||||
|
||||
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information
|
201
e2e/vendor/k8s.io/cloud-provider/LICENSE
generated
vendored
Normal file
201
e2e/vendor/k8s.io/cloud-provider/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
30
e2e/vendor/k8s.io/cloud-provider/OWNERS
generated
vendored
Normal file
30
e2e/vendor/k8s.io/cloud-provider/OWNERS
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- mikedanese
|
||||
- dims
|
||||
- wlan0
|
||||
- andrewsykim
|
||||
- cheftako
|
||||
reviewers:
|
||||
- aojea
|
||||
- wojtek-t
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
- mikedanese
|
||||
- liggitt
|
||||
- sttts
|
||||
- dchen1107
|
||||
- saad-ali
|
||||
- luxas
|
||||
- justinsb
|
||||
- jsafrane
|
||||
- dims
|
||||
- freehan
|
||||
- jingxu97
|
||||
- wlan0
|
||||
- cheftako
|
||||
- andrewsykim
|
||||
labels:
|
||||
- sig/cloud-provider
|
||||
- area/cloudprovider
|
33
e2e/vendor/k8s.io/cloud-provider/README.md
generated
vendored
Normal file
33
e2e/vendor/k8s.io/cloud-provider/README.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# cloud-provider
|
||||
|
||||
This repository defines the cloud-provider interface and mechanism to initialize
|
||||
a cloud-provider implementation into Kubernetes. Currently multiple processes
|
||||
use this code although the intent is that it will eventually only be cloud
|
||||
controller manager.
|
||||
|
||||
**Note:** go-get or vendor this package as `k8s.io/cloud-provider`.
|
||||
|
||||
## Purpose
|
||||
|
||||
This library is a shared dependency for processes which need to be able to
|
||||
integrate with cloud-provider specific functionality.
|
||||
|
||||
## Compatibility
|
||||
|
||||
Cloud Providers are expected to keep the HEAD of their implementations in sync
|
||||
with the HEAD of this repository.
|
||||
|
||||
## Where does it come from?
|
||||
|
||||
`cloud-provider` is synced from
|
||||
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/cloud-provider.
|
||||
Code changes are made in that location, merged into k8s.io/kubernetes and
|
||||
later synced here.
|
||||
|
||||
## Things you should NOT do
|
||||
|
||||
1. Add an cloud provider specific code to this repo.
|
||||
2. Directly modify anything under vendor/k8s.io/cloud-provider in this repo. Those are driven from `k8s.io/kubernetes/staging/src/k8s.io/cloud-provider`.
|
||||
3. Make interface changes without first discussing them with
|
||||
sig-cloudprovider.
|
||||
|
20
e2e/vendor/k8s.io/cloud-provider/SECURITY_CONTACTS
generated
vendored
Normal file
20
e2e/vendor/k8s.io/cloud-provider/SECURITY_CONTACTS
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Committee to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy)
|
||||
# and will be removed and replaced if they violate that agreement.
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
cheftako
|
||||
andrewsykim
|
||||
dims
|
||||
cjcullen
|
||||
joelsmith
|
||||
liggitt
|
||||
philips
|
||||
tallclair
|
83
e2e/vendor/k8s.io/cloud-provider/app/config/config.go
generated
vendored
Normal file
83
e2e/vendor/k8s.io/cloud-provider/app/config/config.go
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright 2018 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
|
||||
|
||||
import (
|
||||
apiserver "k8s.io/apiserver/pkg/server"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/cloud-provider/config"
|
||||
)
|
||||
|
||||
// Config is the main context object for the cloud controller manager.
|
||||
type Config struct {
|
||||
ComponentConfig config.CloudControllerManagerConfiguration
|
||||
|
||||
SecureServing *apiserver.SecureServingInfo
|
||||
// LoopbackClientConfig is a config for a privileged loopback connection
|
||||
LoopbackClientConfig *restclient.Config
|
||||
|
||||
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
|
||||
|
||||
// the rest config for the master
|
||||
Kubeconfig *restclient.Config
|
||||
|
||||
// EventBroadcaster is broadcaster events to all sinks.
|
||||
EventBroadcaster record.EventBroadcaster
|
||||
|
||||
// EventRecord is a sink for events.
|
||||
EventRecorder record.EventRecorder
|
||||
|
||||
// ClientBuilder will provide a client for this controller to use
|
||||
ClientBuilder cloudprovider.ControllerClientBuilder
|
||||
|
||||
// VersionedClient will provide a client for informers
|
||||
VersionedClient clientset.Interface
|
||||
|
||||
// SharedInformers gives access to informers for the controller.
|
||||
SharedInformers informers.SharedInformerFactory
|
||||
}
|
||||
|
||||
type completedConfig struct {
|
||||
*Config
|
||||
}
|
||||
|
||||
// CompletedConfig same as Config, just to swap private object.
|
||||
type CompletedConfig struct {
|
||||
// Embed a private pointer that cannot be instantiated outside of this package.
|
||||
*completedConfig
|
||||
}
|
||||
|
||||
// Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
|
||||
func (c *Config) Complete() *CompletedConfig {
|
||||
cc := completedConfig{c}
|
||||
|
||||
apiserver.AuthorizeClientBearerToken(c.LoopbackClientConfig, &c.Authentication, &c.Authorization)
|
||||
|
||||
return &CompletedConfig{&cc}
|
||||
}
|
335
e2e/vendor/k8s.io/cloud-provider/cloud.go
generated
vendored
Normal file
335
e2e/vendor/k8s.io/cloud-provider/cloud.go
generated
vendored
Normal file
@ -0,0 +1,335 @@
|
||||
/*
|
||||
Copyright 2014 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 cloudprovider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ControllerClientBuilder allows you to get clients and configs for controllers
|
||||
// Please note a copy also exists in pkg/controller/client_builder.go
|
||||
// TODO: Make this depend on the separate controller utilities repo (issues/68947)
|
||||
type ControllerClientBuilder interface {
|
||||
Config(name string) (*restclient.Config, error)
|
||||
ConfigOrDie(name string) *restclient.Config
|
||||
Client(name string) (clientset.Interface, error)
|
||||
ClientOrDie(name string) clientset.Interface
|
||||
}
|
||||
|
||||
// Interface is an abstract, pluggable interface for cloud providers.
|
||||
type Interface interface {
|
||||
// Initialize provides the cloud with a kubernetes client builder and may spawn goroutines
|
||||
// to perform housekeeping or run custom controllers specific to the cloud provider.
|
||||
// Any tasks started here should be cleaned up when the stop channel closes.
|
||||
Initialize(clientBuilder ControllerClientBuilder, stop <-chan struct{})
|
||||
// LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
|
||||
LoadBalancer() (LoadBalancer, bool)
|
||||
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
|
||||
Instances() (Instances, bool)
|
||||
// InstancesV2 is an implementation for instances and should only be implemented by external cloud providers.
|
||||
// Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce
|
||||
// API calls to the cloud provider when registering and syncing nodes. Implementation of this interface will
|
||||
// disable calls to the Zones interface. Also returns true if the interface is supported, false otherwise.
|
||||
InstancesV2() (InstancesV2, bool)
|
||||
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
|
||||
// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2.
|
||||
// This interface will not be called if InstancesV2 is enabled.
|
||||
Zones() (Zones, bool)
|
||||
// Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
|
||||
Clusters() (Clusters, bool)
|
||||
// Routes returns a routes interface along with whether the interface is supported.
|
||||
Routes() (Routes, bool)
|
||||
// ProviderName returns the cloud provider ID.
|
||||
ProviderName() string
|
||||
// HasClusterID returns true if a ClusterID is required and set
|
||||
HasClusterID() bool
|
||||
}
|
||||
|
||||
type InformerUser interface {
|
||||
// SetInformers sets the informer on the cloud object.
|
||||
SetInformers(informerFactory informers.SharedInformerFactory)
|
||||
}
|
||||
|
||||
// Clusters is an abstract, pluggable interface for clusters of containers.
|
||||
type Clusters interface {
|
||||
// ListClusters lists the names of the available clusters.
|
||||
ListClusters(ctx context.Context) ([]string, error)
|
||||
// Master gets back the address (either DNS name or IP address) of the master node for the cluster.
|
||||
Master(ctx context.Context, clusterName string) (string, error)
|
||||
}
|
||||
|
||||
// (DEPRECATED) DefaultLoadBalancerName is the default load balancer name that is called from
|
||||
// LoadBalancer.GetLoadBalancerName. Use this method to maintain backward compatible names for
|
||||
// LoadBalancers that were created prior to Kubernetes v1.12. In the future, each provider should
|
||||
// replace this method call in GetLoadBalancerName with a provider-specific implementation that
|
||||
// is less cryptic than the Service's UUID.
|
||||
func DefaultLoadBalancerName(service *v1.Service) string {
|
||||
//GCE requires that the name of a load balancer starts with a lower case letter.
|
||||
ret := "a" + string(service.UID)
|
||||
ret = strings.Replace(ret, "-", "", -1)
|
||||
//AWS requires that the name of a load balancer is shorter than 32 bytes.
|
||||
if len(ret) > 32 {
|
||||
ret = ret[:32]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetInstanceProviderID builds a ProviderID for a node in a cloud.
|
||||
// Note that if the instance does not exist, we must return ("", cloudprovider.InstanceNotFound)
|
||||
// cloudprovider.InstanceNotFound should NOT be returned for instances that exist but are stopped/sleeping
|
||||
func GetInstanceProviderID(ctx context.Context, cloud Interface, nodeName types.NodeName) (string, error) {
|
||||
instances, ok := cloud.Instances()
|
||||
if !ok {
|
||||
return "", fmt.Errorf("failed to get instances from cloud provider")
|
||||
}
|
||||
instanceID, err := instances.InstanceID(ctx, nodeName)
|
||||
if err != nil {
|
||||
if err == NotImplemented {
|
||||
return "", err
|
||||
}
|
||||
if err == InstanceNotFound {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("failed to get instance ID from cloud provider: %w", err)
|
||||
}
|
||||
return cloud.ProviderName() + "://" + instanceID, nil
|
||||
}
|
||||
|
||||
// LoadBalancer is an abstract, pluggable interface for load balancers.
|
||||
//
|
||||
// Cloud provider may chose to implement the logic for
|
||||
// constructing/destroying specific kinds of load balancers in a
|
||||
// controller separate from the ServiceController. If this is the case,
|
||||
// then {Ensure,Update}LoadBalancer must return the ImplementedElsewhere error.
|
||||
// For the given LB service, the GetLoadBalancer must return "exists=True" if
|
||||
// there exists a LoadBalancer instance created by ServiceController.
|
||||
// In all other cases, GetLoadBalancer must return a NotFound error.
|
||||
// EnsureLoadBalancerDeleted must not return ImplementedElsewhere to ensure
|
||||
// proper teardown of resources that were allocated by the ServiceController.
|
||||
// This can happen if a user changes the type of LB via an update to the resource
|
||||
// or when migrating from ServiceController to alternate implementation.
|
||||
// The finalizer on the service will be added and removed by ServiceController
|
||||
// irrespective of the ImplementedElsewhere error. Additional finalizers for
|
||||
// LB services must be managed in the alternate implementation.
|
||||
type LoadBalancer interface {
|
||||
// GetLoadBalancer returns whether the specified load balancer exists, and
|
||||
// if so, what its status is.
|
||||
// Implementations must treat the *v1.Service parameter as read-only and not modify it.
|
||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.
|
||||
// TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service
|
||||
GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
|
||||
// GetLoadBalancerName returns the name of the load balancer. Implementations must treat the
|
||||
// *v1.Service parameter as read-only and not modify it.
|
||||
GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string
|
||||
// EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer
|
||||
// Implementations must treat the *v1.Service and *v1.Node
|
||||
// parameters as read-only and not modify them.
|
||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.
|
||||
//
|
||||
// Implementations may return a (possibly wrapped) api.RetryError to enforce
|
||||
// backing off at a fixed duration. This can be used for cases like when the
|
||||
// load balancer is not ready yet (e.g., it is still being provisioned) and
|
||||
// polling at a fixed rate is preferred over backing off exponentially in
|
||||
// order to minimize latency.
|
||||
EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
|
||||
// UpdateLoadBalancer updates hosts under the specified load balancer.
|
||||
// Implementations must treat the *v1.Service and *v1.Node
|
||||
// parameters as read-only and not modify them.
|
||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
|
||||
UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error
|
||||
// EnsureLoadBalancerDeleted deletes the specified load balancer if it
|
||||
// exists, returning nil if the load balancer specified either didn't exist or
|
||||
// was successfully deleted.
|
||||
// This construction is useful because many cloud providers' load balancers
|
||||
// have multiple underlying components, meaning a Get could say that the LB
|
||||
// doesn't exist even if some part of it is still laying around.
|
||||
// Implementations must treat the *v1.Service parameter as read-only and not modify it.
|
||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
|
||||
EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
|
||||
}
|
||||
|
||||
// Instances is an abstract, pluggable interface for sets of instances.
|
||||
type Instances interface {
|
||||
// NodeAddresses returns the addresses of the specified instance.
|
||||
NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)
|
||||
// NodeAddressesByProviderID returns the addresses of the specified instance.
|
||||
// The instance is specified using the providerID of the node. The
|
||||
// ProviderID is a unique identifier of the node. This will not be called
|
||||
// from the node whose nodeaddresses are being queried. i.e. local metadata
|
||||
// services cannot be used in this method to obtain nodeaddresses
|
||||
NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
|
||||
// InstanceID returns the cloud provider ID of the node with the specified NodeName.
|
||||
// Note that if the instance does not exist, we must return ("", cloudprovider.InstanceNotFound)
|
||||
// cloudprovider.InstanceNotFound should NOT be returned for instances that exist but are stopped/sleeping
|
||||
InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
|
||||
// InstanceType returns the type of the specified instance.
|
||||
InstanceType(ctx context.Context, name types.NodeName) (string, error)
|
||||
// InstanceTypeByProviderID returns the type of the specified instance.
|
||||
InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
|
||||
// AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances
|
||||
// expected format for the key is standard ssh-keygen format: <protocol> <blob>
|
||||
AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
|
||||
// CurrentNodeName returns the name of the node we are currently running on
|
||||
// On most clouds (e.g. GCE) this is the hostname, so we provide the hostname
|
||||
CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
|
||||
// InstanceExistsByProviderID returns true if the instance for the given provider exists.
|
||||
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
|
||||
// This method should still return true for instances that exist but are stopped/sleeping.
|
||||
InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
|
||||
// InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider
|
||||
InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
|
||||
}
|
||||
|
||||
// InstancesV2 is an abstract, pluggable interface for cloud provider instances.
|
||||
// Unlike the Instances interface, it is designed for external cloud providers and should only be used by them.
|
||||
// Implementation of this interface will disable calls to the Zones interface.
|
||||
type InstancesV2 interface {
|
||||
// InstanceExists returns true if the instance for the given node exists according to the cloud provider.
|
||||
// Use the node.name or node.spec.providerID field to find the node in the cloud provider.
|
||||
InstanceExists(ctx context.Context, node *v1.Node) (bool, error)
|
||||
// InstanceShutdown returns true if the instance is shutdown according to the cloud provider.
|
||||
// Use the node.name or node.spec.providerID field to find the node in the cloud provider.
|
||||
InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error)
|
||||
// InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are
|
||||
// translated into specific fields and labels in the Node object on registration.
|
||||
// Implementations should always check node.spec.providerID first when trying to discover the instance
|
||||
// for a given node. In cases where node.spec.providerID is empty, implementations can use other
|
||||
// properties of the node like its name, labels and annotations.
|
||||
InstanceMetadata(ctx context.Context, node *v1.Node) (*InstanceMetadata, error)
|
||||
}
|
||||
|
||||
// Route is a representation of an advanced routing rule.
|
||||
type Route struct {
|
||||
// Name is the name of the routing rule in the cloud-provider.
|
||||
// It will be ignored in a Create (although nameHint may influence it)
|
||||
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
|
||||
// Blackhole is set to true if this is a blackhole route
|
||||
// The node controller will delete the route if it is in the managed range.
|
||||
Blackhole bool
|
||||
}
|
||||
|
||||
// Routes is an abstract, pluggable interface for advanced routing rules.
|
||||
type Routes interface {
|
||||
// ListRoutes lists all managed routes that belong to the specified clusterName
|
||||
ListRoutes(ctx context.Context, clusterName string) ([]*Route, error)
|
||||
// CreateRoute creates the described managed route
|
||||
// route.Name will be ignored, although the cloud-provider may use nameHint
|
||||
// to create a more user-meaningful name.
|
||||
CreateRoute(ctx context.Context, clusterName string, nameHint string, route *Route) error
|
||||
// DeleteRoute deletes the specified managed route
|
||||
// Route should be as returned by ListRoutes
|
||||
DeleteRoute(ctx context.Context, clusterName string, route *Route) error
|
||||
}
|
||||
|
||||
var (
|
||||
DiskNotFound = errors.New("disk is not found")
|
||||
ImplementedElsewhere = errors.New("implemented by alternate to cloud provider")
|
||||
InstanceNotFound = errors.New("instance not found")
|
||||
NotImplemented = errors.New("unimplemented")
|
||||
)
|
||||
|
||||
// Zone represents the location of a particular machine.
|
||||
type Zone struct {
|
||||
FailureDomain string
|
||||
Region string
|
||||
}
|
||||
|
||||
// Zones is an abstract, pluggable interface for zone enumeration.
|
||||
// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2.
|
||||
// This interface will not be called if InstancesV2 is enabled.
|
||||
type Zones interface {
|
||||
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in
|
||||
// In most cases, this method is called from the kubelet querying a local metadata service to acquire its zone.
|
||||
// For the case of external cloud providers, use GetZoneByProviderID or GetZoneByNodeName since GetZone
|
||||
// can no longer be called from the kubelets.
|
||||
GetZone(ctx context.Context) (Zone, error)
|
||||
|
||||
// GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerID
|
||||
// This method is particularly used in the context of external cloud providers where node initialization must be done
|
||||
// outside the kubelets.
|
||||
GetZoneByProviderID(ctx context.Context, providerID string) (Zone, error)
|
||||
|
||||
// GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name
|
||||
// This method is particularly used in the context of external cloud providers where node initialization must be done
|
||||
// outside the kubelets.
|
||||
GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (Zone, error)
|
||||
}
|
||||
|
||||
// PVLabeler is an abstract, pluggable interface for fetching labels for volumes
|
||||
// DEPRECATED: PVLabeler is deprecated in favor of CSI topology feature.
|
||||
type PVLabeler interface {
|
||||
GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error)
|
||||
}
|
||||
|
||||
// InstanceMetadata contains metadata about a specific instance.
|
||||
// Values returned in InstanceMetadata are translated into specific fields and labels for Node.
|
||||
type InstanceMetadata struct {
|
||||
// ProviderID is a unique ID used to identify an instance on the cloud provider.
|
||||
// The ProviderID set here will be set on the node's spec.providerID field.
|
||||
// The provider ID format can be set by the cloud provider but providers should
|
||||
// ensure the format does not change in any incompatible way.
|
||||
//
|
||||
// The provider ID format used by existing cloud provider has been:
|
||||
// <provider-name>://<instance-id>
|
||||
// Existing providers setting this field should preserve the existing format
|
||||
// currently being set in node.spec.providerID.
|
||||
ProviderID string
|
||||
// InstanceType is the instance's type.
|
||||
// The InstanceType set here will be set using the following labels on the node object:
|
||||
// * node.kubernetes.io/instance-type=<instance-type>
|
||||
// * beta.kubernetes.io/instance-type=<instance-type> (DEPRECATED)
|
||||
InstanceType string
|
||||
// NodeAddress contains information for the instance's address.
|
||||
// The node addresses returned here will be set on the node's status.addresses field.
|
||||
NodeAddresses []v1.NodeAddress
|
||||
|
||||
// Zone is the zone that the instance is in.
|
||||
// The value set here is applied as the following labels on the node:
|
||||
// * topology.kubernetes.io/zone=<zone>
|
||||
// * failure-domain.beta.kubernetes.io/zone=<zone> (DEPRECATED)
|
||||
Zone string
|
||||
// Region is the region that the instance is in.
|
||||
// The value set here is applied as the following labels on the node:
|
||||
// * topology.kubernetes.io/region=<region>
|
||||
// * failure-domain.beta.kubernetes.io/region=<region> (DEPRECATED)
|
||||
Region string
|
||||
|
||||
// AdditionalLabels is a map of additional labels provided by the cloud provider.
|
||||
// When provided, they will be applied to the node and enable cloud providers
|
||||
// to labels nodes with information that may be valuable to that provider.
|
||||
AdditionalLabels map[string]string
|
||||
}
|
3
e2e/vendor/k8s.io/cloud-provider/code-of-conduct.md
generated
vendored
Normal file
3
e2e/vendor/k8s.io/cloud-provider/code-of-conduct.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
20
e2e/vendor/k8s.io/cloud-provider/config/doc.go
generated
vendored
Normal file
20
e2e/vendor/k8s.io/cloud-provider/config/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 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
|
||||
// +groupName=cloudcontrollermanager.config.k8s.io
|
||||
|
||||
package config // import "k8s.io/cloud-provider/config"
|
44
e2e/vendor/k8s.io/cloud-provider/config/install/install.go
generated
vendored
Normal file
44
e2e/vendor/k8s.io/cloud-provider/config/install/install.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2018 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 install
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/cloud-provider/config"
|
||||
"k8s.io/cloud-provider/config/v1alpha1"
|
||||
)
|
||||
|
||||
var (
|
||||
// Scheme defines methods for serializing and deserializing API objects.
|
||||
Scheme = runtime.NewScheme()
|
||||
// Codecs provides methods for retrieving codecs and serializers for specific
|
||||
// versions and content types.
|
||||
Codecs = serializer.NewCodecFactory(Scheme)
|
||||
)
|
||||
|
||||
func init() {
|
||||
Install(Scheme)
|
||||
}
|
||||
|
||||
// Install adds the types of this group into the given scheme.
|
||||
func Install(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(config.AddToScheme(scheme))
|
||||
utilruntime.Must(v1alpha1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
|
||||
}
|
42
e2e/vendor/k8s.io/cloud-provider/config/register.go
generated
vendored
Normal file
42
e2e/vendor/k8s.io/cloud-provider/config/register.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2018 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
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name used in this package
|
||||
const GroupName = "cloudcontrollermanager.config.k8s.io"
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
// SchemeBuilder is the scheme builder with scheme init functions to run for this API package
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme is a global function that registers this API group & version to a scheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// addKnownTypes registers known types to the given scheme
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&CloudControllerManagerConfiguration{},
|
||||
)
|
||||
return nil
|
||||
}
|
103
e2e/vendor/k8s.io/cloud-provider/config/types.go
generated
vendored
Normal file
103
e2e/vendor/k8s.io/cloud-provider/config/types.go
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright 2018 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
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// CloudControllerManagerConfiguration contains elements describing cloud-controller manager.
|
||||
type CloudControllerManagerConfiguration struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
// Generic holds configuration for a generic controller-manager
|
||||
Generic cmconfig.GenericControllerManagerConfiguration
|
||||
// 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 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
|
||||
// and cloud-controller manager, but not genericconfig.
|
||||
type KubeCloudSharedConfiguration struct {
|
||||
// CloudProviderConfiguration holds configuration for CloudProvider related features.
|
||||
CloudProvider CloudProviderConfiguration
|
||||
// externalCloudVolumePlugin specifies the plugin to use when cloudProvider is "external".
|
||||
// It is currently used by the in repo cloud providers to handle node and volume control in the KCM.
|
||||
ExternalCloudVolumePlugin string
|
||||
// useServiceAccountCredentials indicates whether controllers should be run with
|
||||
// individual service account credentials.
|
||||
UseServiceAccountCredentials bool
|
||||
// run with untagged cloud instances
|
||||
AllowUntaggedCloud bool
|
||||
// routeReconciliationPeriod is the period for reconciling routes created for Nodes by cloud provider..
|
||||
RouteReconciliationPeriod metav1.Duration
|
||||
// nodeMonitorPeriod is the period for syncing NodeStatus in CloudNodeLifecycleController.
|
||||
NodeMonitorPeriod metav1.Duration
|
||||
// clusterName is the instance prefix for the cluster.
|
||||
ClusterName string
|
||||
// clusterCIDR is CIDR Range for Pods in cluster.
|
||||
ClusterCIDR string
|
||||
// AllocateNodeCIDRs enables CIDRs for Pods to be allocated and, if
|
||||
// ConfigureCloudRoutes is true, to be set on the cloud provider.
|
||||
AllocateNodeCIDRs bool
|
||||
// CIDRAllocatorType determines what kind of pod CIDR allocator will be used.
|
||||
CIDRAllocatorType string
|
||||
// configureCloudRoutes enables CIDRs allocated with allocateNodeCIDRs
|
||||
// to be configured on the cloud provider.
|
||||
ConfigureCloudRoutes bool
|
||||
// nodeSyncPeriod is the period for syncing nodes from cloudprovider. Longer
|
||||
// periods will result in fewer calls to cloud provider, but may delay addition
|
||||
// of new nodes to cluster.
|
||||
NodeSyncPeriod metav1.Duration
|
||||
}
|
||||
|
||||
// CloudProviderConfiguration contains basically elements about cloud provider.
|
||||
type CloudProviderConfiguration struct {
|
||||
// Name is the provider for cloud services.
|
||||
Name string
|
||||
// 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
|
||||
}
|
49
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/conversion.go
generated
vendored
Normal file
49
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/conversion.go
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
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
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
cpconfig "k8s.io/cloud-provider/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_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(in *KubeCloudSharedConfiguration, out *cpconfig.KubeCloudSharedConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(in *cpconfig.KubeCloudSharedConfiguration, out *KubeCloudSharedConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(in *CloudProviderConfiguration, out *cpconfig.CloudProviderConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(in *cpconfig.CloudProviderConfiguration, out *CloudProviderConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(in, out, s)
|
||||
}
|
71
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/defaults.go
generated
vendored
Normal file
71
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/defaults.go
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright 2018 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 (
|
||||
"time"
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
}
|
||||
|
||||
func SetDefaults_CloudControllerManagerConfiguration(obj *CloudControllerManagerConfiguration) {
|
||||
zero := metav1.Duration{}
|
||||
if obj.NodeStatusUpdateFrequency == zero {
|
||||
obj.NodeStatusUpdateFrequency = metav1.Duration{Duration: 5 * time.Minute}
|
||||
}
|
||||
|
||||
// These defaults override the recommended defaults from the apimachineryconfigv1alpha1 package that are applied automatically
|
||||
// These client-connection defaults are specific to the cloud-controller-manager
|
||||
if obj.Generic.ClientConnection.QPS == 0 {
|
||||
obj.Generic.ClientConnection.QPS = 20
|
||||
}
|
||||
if obj.Generic.ClientConnection.Burst == 0 {
|
||||
obj.Generic.ClientConnection.Burst = 30
|
||||
}
|
||||
|
||||
// Use the default RecommendedDefaultGenericControllerManagerConfiguration options
|
||||
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) {
|
||||
zero := metav1.Duration{}
|
||||
if obj.NodeMonitorPeriod == zero {
|
||||
obj.NodeMonitorPeriod = metav1.Duration{Duration: 5 * time.Second}
|
||||
}
|
||||
if obj.ClusterName == "" {
|
||||
obj.ClusterName = "kubernetes"
|
||||
}
|
||||
if obj.ConfigureCloudRoutes == nil {
|
||||
obj.ConfigureCloudRoutes = utilpointer.BoolPtr(true)
|
||||
}
|
||||
if obj.RouteReconciliationPeriod == zero {
|
||||
obj.RouteReconciliationPeriod = metav1.Duration{Duration: 10 * time.Second}
|
||||
}
|
||||
}
|
32
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/doc.go
generated
vendored
Normal file
32
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
// Note: The referenced generic ComponentConfig packages with conversions
|
||||
// between the types (e.g. the external package) needs to be given as an
|
||||
// input to conversion-gen for it to find the native conversation funcs to
|
||||
// call.
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/component-base/config/v1alpha1
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/config
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/config/v1alpha1
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/controllers/service/config/v1alpha1
|
||||
// +k8s:conversion-gen=k8s.io/controller-manager/config/v1alpha1
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=cloudcontrollermanager.config.k8s.io
|
||||
|
||||
package v1alpha1 // import "k8s.io/cloud-provider/config/v1alpha1"
|
52
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/register.go
generated
vendored
Normal file
52
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2018 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"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "cloudcontrollermanager.config.k8s.io"
|
||||
|
||||
var (
|
||||
// GroupName is the group name use in this package
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
// SchemeBuilder is the scheme builder with scheme init functions to run for this API package
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// localSchemeBuilder ïs a pointer to SchemeBuilder instance. Using localSchemeBuilder
|
||||
// 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
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addDefaultingFuncs)
|
||||
}
|
||||
|
||||
// addKnownTypes registers known types to the given scheme
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&CloudControllerManagerConfiguration{},
|
||||
)
|
||||
return nil
|
||||
}
|
101
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/types.go
generated
vendored
Normal file
101
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright 2018 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 (
|
||||
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"`
|
||||
|
||||
// Generic holds configuration for a generic controller-manager
|
||||
Generic cmconfigv1alpha1.GenericControllerManagerConfiguration
|
||||
// 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
|
||||
// and cloud-controller manager, but not genericconfig.
|
||||
type KubeCloudSharedConfiguration struct {
|
||||
// CloudProviderConfiguration holds configuration for CloudProvider related features.
|
||||
CloudProvider CloudProviderConfiguration
|
||||
// externalCloudVolumePlugin specifies the plugin to use when cloudProvider is "external".
|
||||
// It is currently used by the in repo cloud providers to handle node and volume control in the KCM.
|
||||
ExternalCloudVolumePlugin string
|
||||
// useServiceAccountCredentials indicates whether controllers should be run with
|
||||
// individual service account credentials.
|
||||
UseServiceAccountCredentials bool
|
||||
// run with untagged cloud instances
|
||||
AllowUntaggedCloud bool
|
||||
// routeReconciliationPeriod is the period for reconciling routes created for Nodes by cloud provider..
|
||||
RouteReconciliationPeriod metav1.Duration
|
||||
// nodeMonitorPeriod is the period for syncing NodeStatus in NodeController.
|
||||
NodeMonitorPeriod metav1.Duration
|
||||
// clusterName is the instance prefix for the cluster.
|
||||
ClusterName string
|
||||
// clusterCIDR is CIDR Range for Pods in cluster.
|
||||
ClusterCIDR string
|
||||
// AllocateNodeCIDRs enables CIDRs for Pods to be allocated and, if
|
||||
// ConfigureCloudRoutes is true, to be set on the cloud provider.
|
||||
AllocateNodeCIDRs bool
|
||||
// CIDRAllocatorType determines what kind of pod CIDR allocator will be used.
|
||||
CIDRAllocatorType string
|
||||
// configureCloudRoutes enables CIDRs allocated with allocateNodeCIDRs
|
||||
// to be configured on the cloud provider.
|
||||
ConfigureCloudRoutes *bool
|
||||
// nodeSyncPeriod is the period for syncing nodes from cloudprovider. Longer
|
||||
// periods will result in fewer calls to cloud provider, but may delay addition
|
||||
// of new nodes to cluster.
|
||||
NodeSyncPeriod metav1.Duration
|
||||
}
|
||||
|
||||
// CloudProviderConfiguration contains basically elements about cloud provider.
|
||||
type CloudProviderConfiguration struct {
|
||||
// Name is the provider for cloud services.
|
||||
Name string
|
||||
// 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
|
||||
}
|
206
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
206
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
//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 (
|
||||
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"
|
||||
)
|
||||
|
||||
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.AddGeneratedConversionFunc((*CloudControllerManagerConfiguration)(nil), (*config.CloudControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudControllerManagerConfiguration(a.(*CloudControllerManagerConfiguration), b.(*config.CloudControllerManagerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.CloudControllerManagerConfiguration)(nil), (*CloudControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration(a.(*config.CloudControllerManagerConfiguration), b.(*CloudControllerManagerConfiguration), scope)
|
||||
}); 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 {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*config.KubeCloudSharedConfiguration)(nil), (*KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(a.(*config.KubeCloudSharedConfiguration), b.(*KubeCloudSharedConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*CloudProviderConfiguration)(nil), (*config.CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(a.(*CloudProviderConfiguration), b.(*config.CloudProviderConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*KubeCloudSharedConfiguration)(nil), (*config.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(a.(*KubeCloudSharedConfiguration), b.(*config.KubeCloudSharedConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudControllerManagerConfiguration(in *CloudControllerManagerConfiguration, out *config.CloudControllerManagerConfiguration, s conversion.Scope) error {
|
||||
if err := configv1alpha1.Convert_v1alpha1_GenericControllerManagerConfiguration_To_config_GenericControllerManagerConfiguration(&in.Generic, &out.Generic, s); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudControllerManagerConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudControllerManagerConfiguration(in *CloudControllerManagerConfiguration, out *config.CloudControllerManagerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_CloudControllerManagerConfiguration_To_config_CloudControllerManagerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration(in *config.CloudControllerManagerConfiguration, out *CloudControllerManagerConfiguration, s conversion.Scope) error {
|
||||
if err := configv1alpha1.Convert_config_GenericControllerManagerConfiguration_To_v1alpha1_GenericControllerManagerConfiguration(&in.Generic, &out.Generic, s); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
// Convert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration(in *config.CloudControllerManagerConfiguration, out *CloudControllerManagerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(in *CloudProviderConfiguration, out *config.CloudProviderConfiguration, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.CloudConfigFile = in.CloudConfigFile
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(in *config.CloudProviderConfiguration, out *CloudProviderConfiguration, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.CloudConfigFile = in.CloudConfigFile
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(in *KubeCloudSharedConfiguration, out *config.KubeCloudSharedConfiguration, s conversion.Scope) error {
|
||||
if err := Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(&in.CloudProvider, &out.CloudProvider, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ExternalCloudVolumePlugin = in.ExternalCloudVolumePlugin
|
||||
out.UseServiceAccountCredentials = in.UseServiceAccountCredentials
|
||||
out.AllowUntaggedCloud = in.AllowUntaggedCloud
|
||||
out.RouteReconciliationPeriod = in.RouteReconciliationPeriod
|
||||
out.NodeMonitorPeriod = in.NodeMonitorPeriod
|
||||
out.ClusterName = in.ClusterName
|
||||
out.ClusterCIDR = in.ClusterCIDR
|
||||
out.AllocateNodeCIDRs = in.AllocateNodeCIDRs
|
||||
out.CIDRAllocatorType = in.CIDRAllocatorType
|
||||
if err := v1.Convert_Pointer_bool_To_bool(&in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.NodeSyncPeriod = in.NodeSyncPeriod
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(in *config.KubeCloudSharedConfiguration, out *KubeCloudSharedConfiguration, s conversion.Scope) error {
|
||||
if err := Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(&in.CloudProvider, &out.CloudProvider, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ExternalCloudVolumePlugin = in.ExternalCloudVolumePlugin
|
||||
out.UseServiceAccountCredentials = in.UseServiceAccountCredentials
|
||||
out.AllowUntaggedCloud = in.AllowUntaggedCloud
|
||||
out.RouteReconciliationPeriod = in.RouteReconciliationPeriod
|
||||
out.NodeMonitorPeriod = in.NodeMonitorPeriod
|
||||
out.ClusterName = in.ClusterName
|
||||
out.ClusterCIDR = in.ClusterCIDR
|
||||
out.AllocateNodeCIDRs = in.AllocateNodeCIDRs
|
||||
out.CIDRAllocatorType = in.CIDRAllocatorType
|
||||
if err := v1.Convert_bool_To_Pointer_bool(&in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes, s); err != nil {
|
||||
return err
|
||||
}
|
||||
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)
|
||||
}
|
119
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
119
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
//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
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopyInto(out *CloudControllerManagerConfiguration) {
|
||||
*out = *in
|
||||
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
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudControllerManagerConfiguration.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopy() *CloudControllerManagerConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CloudControllerManagerConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CloudProviderConfiguration) DeepCopyInto(out *CloudProviderConfiguration) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudProviderConfiguration.
|
||||
func (in *CloudProviderConfiguration) DeepCopy() *CloudProviderConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CloudProviderConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubeCloudSharedConfiguration) DeepCopyInto(out *KubeCloudSharedConfiguration) {
|
||||
*out = *in
|
||||
out.CloudProvider = in.CloudProvider
|
||||
out.RouteReconciliationPeriod = in.RouteReconciliationPeriod
|
||||
out.NodeMonitorPeriod = in.NodeMonitorPeriod
|
||||
if in.ConfigureCloudRoutes != nil {
|
||||
in, out := &in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
out.NodeSyncPeriod = in.NodeSyncPeriod
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeCloudSharedConfiguration.
|
||||
func (in *KubeCloudSharedConfiguration) DeepCopy() *KubeCloudSharedConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(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
|
||||
}
|
41
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.defaults.go
generated
vendored
Normal file
41
e2e/vendor/k8s.io/cloud-provider/config/v1alpha1/zz_generated.defaults.go
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
//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 defaulter-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
scheme.AddTypeDefaultingFunc(&CloudControllerManagerConfiguration{}, func(obj interface{}) {
|
||||
SetObjectDefaults_CloudControllerManagerConfiguration(obj.(*CloudControllerManagerConfiguration))
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetObjectDefaults_CloudControllerManagerConfiguration(in *CloudControllerManagerConfiguration) {
|
||||
SetDefaults_CloudControllerManagerConfiguration(in)
|
||||
SetDefaults_KubeCloudSharedConfiguration(&in.KubeCloudShared)
|
||||
}
|
114
e2e/vendor/k8s.io/cloud-provider/config/zz_generated.deepcopy.go
generated
vendored
Normal file
114
e2e/vendor/k8s.io/cloud-provider/config/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
//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 config
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopyInto(out *CloudControllerManagerConfiguration) {
|
||||
*out = *in
|
||||
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
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudControllerManagerConfiguration.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopy() *CloudControllerManagerConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CloudControllerManagerConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CloudControllerManagerConfiguration) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CloudProviderConfiguration) DeepCopyInto(out *CloudProviderConfiguration) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudProviderConfiguration.
|
||||
func (in *CloudProviderConfiguration) DeepCopy() *CloudProviderConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CloudProviderConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubeCloudSharedConfiguration) DeepCopyInto(out *KubeCloudSharedConfiguration) {
|
||||
*out = *in
|
||||
out.CloudProvider = in.CloudProvider
|
||||
out.RouteReconciliationPeriod = in.RouteReconciliationPeriod
|
||||
out.NodeMonitorPeriod = in.NodeMonitorPeriod
|
||||
out.NodeSyncPeriod = in.NodeSyncPeriod
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeCloudSharedConfiguration.
|
||||
func (in *KubeCloudSharedConfiguration) DeepCopy() *KubeCloudSharedConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/types.go
generated
vendored
Normal file
24
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/conversion.go
generated
vendored
Normal file
39
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/defaults.go
generated
vendored
Normal file
23
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/doc.go
generated
vendored
Normal file
21
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/register.go
generated
vendored
Normal file
31
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go
generated
vendored
Normal file
24
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
58
e2e/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
e2e/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
38
e2e/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
|
||||
}
|
14
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/OWNERS
generated
vendored
Normal file
14
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/OWNERS
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
approvers:
|
||||
- api-approvers
|
||||
- deads2k
|
||||
- luxas
|
||||
- mtaufen
|
||||
- sttts
|
||||
reviewers:
|
||||
- api-reviewers
|
||||
- deads2k
|
||||
- luxas
|
||||
- mtaufen
|
||||
- sttts
|
||||
emeritus_approvers:
|
||||
- stewart-yu
|
19
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/doc.go
generated
vendored
Normal file
19
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/doc.go
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
|
||||
package config // import "k8s.io/cloud-provider/controllers/service/config"
|
25
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/types.go
generated
vendored
Normal file
25
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/types.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
// ServiceControllerConfiguration contains elements describing ServiceController.
|
||||
type ServiceControllerConfiguration struct {
|
||||
// concurrentServiceSyncs is the number of services that are
|
||||
// allowed to sync concurrently. Larger number = more responsive service
|
||||
// management, but more CPU (and network) load.
|
||||
ConcurrentServiceSyncs int32
|
||||
}
|
39
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/conversion.go
generated
vendored
Normal file
39
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/conversion.go
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2019 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"
|
||||
serviceconfig "k8s.io/cloud-provider/controllers/service/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_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration(in *ServiceControllerConfiguration, out *serviceconfig.ServiceControllerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration is an autogenerated conversion function.
|
||||
func Convert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration(in *serviceconfig.ServiceControllerConfiguration, out *ServiceControllerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration(in, out, s)
|
||||
}
|
32
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/defaults.go
generated
vendored
Normal file
32
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/defaults.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
// RecommendedDefaultServiceControllerConfiguration defaults a pointer to a
|
||||
// ServiceControllerConfiguration struct. This will set the recommended default
|
||||
// values, but they may be subject to change between API versions. This function
|
||||
// is intentionally not registered in the scheme as a "normal" `SetDefaults_Foo`
|
||||
// function to allow consumers of this type to set whatever defaults for their
|
||||
// embedded configs. Forcing consumers to use these defaults would be problematic
|
||||
// as defaulting in the scheme is done as part of the conversion, and there would
|
||||
// be no easy way to opt-out. Instead, if you want to use this defaulting method
|
||||
// run it in your wrapper struct of this type in its `SetDefaults_` method.
|
||||
func RecommendedDefaultServiceControllerConfiguration(obj *ServiceControllerConfiguration) {
|
||||
if obj.ConcurrentServiceSyncs == 0 {
|
||||
obj.ConcurrentServiceSyncs = 1
|
||||
}
|
||||
}
|
21
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/doc.go
generated
vendored
Normal file
21
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/controllers/service/config
|
||||
// +k8s:conversion-gen=k8s.io/cloud-provider/controllers/service/config/v1alpha1
|
||||
|
||||
package v1alpha1 // import "k8s.io/cloud-provider/controllers/service/config/v1alpha1"
|
31
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/register.go
generated
vendored
Normal file
31
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
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
|
||||
|
||||
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
|
||||
)
|
25
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/types.go
generated
vendored
Normal file
25
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
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
|
||||
|
||||
// ServiceControllerConfiguration contains elements describing ServiceController.
|
||||
type ServiceControllerConfiguration struct {
|
||||
// concurrentServiceSyncs is the number of services that are
|
||||
// allowed to sync concurrently. Larger number = more responsive service
|
||||
// management, but more CPU (and network) load.
|
||||
ConcurrentServiceSyncs int32
|
||||
}
|
58
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/zz_generated.conversion.go
generated
vendored
Normal file
58
e2e/vendor/k8s.io/cloud-provider/controllers/service/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/service/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.ServiceControllerConfiguration)(nil), (*ServiceControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration(a.(*config.ServiceControllerConfiguration), b.(*ServiceControllerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*ServiceControllerConfiguration)(nil), (*config.ServiceControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration(a.(*ServiceControllerConfiguration), b.(*config.ServiceControllerConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ServiceControllerConfiguration_To_config_ServiceControllerConfiguration(in *ServiceControllerConfiguration, out *config.ServiceControllerConfiguration, s conversion.Scope) error {
|
||||
out.ConcurrentServiceSyncs = in.ConcurrentServiceSyncs
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_config_ServiceControllerConfiguration_To_v1alpha1_ServiceControllerConfiguration(in *config.ServiceControllerConfiguration, out *ServiceControllerConfiguration, s conversion.Scope) error {
|
||||
out.ConcurrentServiceSyncs = in.ConcurrentServiceSyncs
|
||||
return nil
|
||||
}
|
38
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
38
e2e/vendor/k8s.io/cloud-provider/controllers/service/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 *ServiceControllerConfiguration) DeepCopyInto(out *ServiceControllerConfiguration) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceControllerConfiguration.
|
||||
func (in *ServiceControllerConfiguration) DeepCopy() *ServiceControllerConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceControllerConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
38
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/zz_generated.deepcopy.go
generated
vendored
Normal file
38
e2e/vendor/k8s.io/cloud-provider/controllers/service/config/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 config
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceControllerConfiguration) DeepCopyInto(out *ServiceControllerConfiguration) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceControllerConfiguration.
|
||||
func (in *ServiceControllerConfiguration) DeepCopy() *ServiceControllerConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceControllerConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
18
e2e/vendor/k8s.io/cloud-provider/doc.go
generated
vendored
Normal file
18
e2e/vendor/k8s.io/cloud-provider/doc.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2014 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 cloudprovider supplies interfaces and implementations for cloud service providers.
|
||||
package cloudprovider // import "k8s.io/cloud-provider"
|
69
e2e/vendor/k8s.io/cloud-provider/names/controller_names.go
generated
vendored
Normal file
69
e2e/vendor/k8s.io/cloud-provider/names/controller_names.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright 2023 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 names
|
||||
|
||||
// Canonical controller names
|
||||
//
|
||||
// NAMING CONVENTIONS
|
||||
// 1. naming should be consistent across the controllers
|
||||
// 2. use of shortcuts should be avoided, unless they are well-known non-Kubernetes shortcuts
|
||||
// 3. Kubernetes' resources should be written together without a hyphen ("-")
|
||||
//
|
||||
// CHANGE POLICY
|
||||
// The controller names should be treated as IDs.
|
||||
// They can only be changed if absolutely necessary. For example if an inappropriate name was chosen in the past, or if the scope of the controller changes.
|
||||
// When a name is changed, the old name should be aliased in CCMControllerAliases, while preserving all old aliases.
|
||||
// This is done to achieve backwards compatibility
|
||||
//
|
||||
// USE CASES
|
||||
// The following places should use the controller name constants, when:
|
||||
// 1. registering a controller in app.DefaultInitFuncConstructors or sample main.controllerInitializers:
|
||||
// 1.1. disabling a controller by default in app.ControllersDisabledByDefault
|
||||
// 1.2. checking if IsControllerEnabled
|
||||
// 1.3. defining an alias in CCMControllerAliases (for backwards compatibility only)
|
||||
// 2. used anywhere inside the controller itself:
|
||||
// 2.1. [TODO] logger component should be configured with the controller name by calling LoggerWithName
|
||||
// 2.2. [TODO] logging should use a canonical controller name when referencing a controller (Eg. Starting X, Shutting down X)
|
||||
// 2.3. [TODO] emitted events should have an EventSource.Component set to the controller name (usually when initializing an EventRecorder)
|
||||
// 2.4. [TODO] registering ControllerManagerMetrics with ControllerStarted and ControllerStopped
|
||||
// 2.5. [TODO] calling WaitForNamedCacheSync
|
||||
// 3. defining controller options for "--help" command or generated documentation
|
||||
// 3.1. controller name should be used to create a pflag.FlagSet when registering controller options (the name is rendered in a controller flag group header)
|
||||
// 3.2. when defined flag's help mentions a controller name
|
||||
// 4. defining a new service account for a new controller (old controllers may have inconsistent service accounts to stay backwards compatible)
|
||||
// 5. anywhere these controllers are used outside of this module (kube-controller-manager, cloud-provider sample)
|
||||
const (
|
||||
CloudNodeController = "cloud-node-controller"
|
||||
ServiceLBController = "service-lb-controller"
|
||||
NodeRouteController = "node-route-controller"
|
||||
CloudNodeLifecycleController = "cloud-node-lifecycle-controller"
|
||||
)
|
||||
|
||||
// CCMControllerAliases returns a mapping of aliases to canonical controller names
|
||||
//
|
||||
// These aliases ensure backwards compatibility and should never be removed!
|
||||
// Only addition of new aliases is allowed, and only when a canonical name is changed (please see CHANGE POLICY of controller names)
|
||||
func CCMControllerAliases() map[string]string {
|
||||
// return a new reference to achieve immutability of the mapping
|
||||
return map[string]string{
|
||||
"cloud-node": CloudNodeController,
|
||||
"service": ServiceLBController,
|
||||
"route": NodeRouteController,
|
||||
"cloud-node-lifecycle": CloudNodeLifecycleController,
|
||||
}
|
||||
|
||||
}
|
54
e2e/vendor/k8s.io/cloud-provider/options/cloudprovider.go
generated
vendored
Normal file
54
e2e/vendor/k8s.io/cloud-provider/options/cloudprovider.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2018 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 (
|
||||
"github.com/spf13/pflag"
|
||||
cpconfig "k8s.io/cloud-provider/config"
|
||||
)
|
||||
|
||||
// CloudProviderOptions holds the cloudprovider options.
|
||||
type CloudProviderOptions struct {
|
||||
*cpconfig.CloudProviderConfiguration
|
||||
}
|
||||
|
||||
// Validate checks validation of cloudprovider options.
|
||||
func (s *CloudProviderOptions) Validate() []error {
|
||||
allErrors := []error{}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to cloudprovider for controller manager to the specified FlagSet.
|
||||
func (s *CloudProviderOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.Name, "cloud-provider", s.Name,
|
||||
"The provider for cloud services. Empty string for no provider.")
|
||||
|
||||
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile,
|
||||
"The path to the cloud provider configuration file. Empty string for no configuration file.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up cloudprovider config with options.
|
||||
func (s *CloudProviderOptions) ApplyTo(cfg *cpconfig.CloudProviderConfiguration) error {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.Name = s.Name
|
||||
cfg.CloudConfigFile = s.CloudConfigFile
|
||||
|
||||
return nil
|
||||
}
|
110
e2e/vendor/k8s.io/cloud-provider/options/kubecloudshared.go
generated
vendored
Normal file
110
e2e/vendor/k8s.io/cloud-provider/options/kubecloudshared.go
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
Copyright 2018 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"
|
||||
|
||||
cpconfig "k8s.io/cloud-provider/config"
|
||||
"k8s.io/cloud-provider/names"
|
||||
)
|
||||
|
||||
// KubeCloudSharedOptions holds the options shared between kube-controller-manager
|
||||
// and cloud-controller-manager.
|
||||
type KubeCloudSharedOptions struct {
|
||||
*cpconfig.KubeCloudSharedConfiguration
|
||||
CloudProvider *CloudProviderOptions
|
||||
}
|
||||
|
||||
// NewKubeCloudSharedOptions returns common/default configuration values for both
|
||||
// the kube-controller-manager and the cloud-contoller-manager. Any common changes should
|
||||
// be made here. Any individual changes should be made in that controller.
|
||||
func NewKubeCloudSharedOptions(cfg *cpconfig.KubeCloudSharedConfiguration) *KubeCloudSharedOptions {
|
||||
o := &KubeCloudSharedOptions{
|
||||
KubeCloudSharedConfiguration: cfg,
|
||||
CloudProvider: &CloudProviderOptions{
|
||||
CloudProviderConfiguration: &cpconfig.CloudProviderConfiguration{},
|
||||
},
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to shared variable for controller manager to the specified FlagSet.
|
||||
func (o *KubeCloudSharedOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
o.CloudProvider.AddFlags(fs)
|
||||
fs.StringVar(&o.ExternalCloudVolumePlugin, "external-cloud-volume-plugin", o.ExternalCloudVolumePlugin, "The plugin to use when cloud provider is set to external. Can be empty, should only be set when cloud-provider is external. Currently used to allow node-ipam-controller, persistentvolume-binder-controller, persistentvolume-expander-controller and attach-detach-controller to work for in tree cloud providers.")
|
||||
fs.BoolVar(&o.UseServiceAccountCredentials, "use-service-account-credentials", o.UseServiceAccountCredentials, "If true, use individual service account credentials for each controller.")
|
||||
fs.BoolVar(&o.AllowUntaggedCloud, "allow-untagged-cloud", false, "Allow the cluster to run without the cluster-id on cloud instances. This is a legacy mode of operation and a cluster-id will be required in the future.")
|
||||
fs.MarkDeprecated("allow-untagged-cloud", "This flag is deprecated and will be removed in a future release. A cluster-id will be required on cloud instances.")
|
||||
fs.DurationVar(&o.RouteReconciliationPeriod.Duration, "route-reconciliation-period", o.RouteReconciliationPeriod.Duration, "The period for reconciling routes created for Nodes by cloud provider.")
|
||||
fs.DurationVar(&o.NodeMonitorPeriod.Duration, "node-monitor-period", o.NodeMonitorPeriod.Duration,
|
||||
fmt.Sprintf("The period for syncing NodeStatus in %s.", names.CloudNodeLifecycleController))
|
||||
fs.StringVar(&o.ClusterName, "cluster-name", o.ClusterName, "The instance prefix for the cluster.")
|
||||
fs.StringVar(&o.ClusterCIDR, "cluster-cidr", o.ClusterCIDR, "CIDR Range for Pods in cluster. Only used when --allocate-node-cidrs=true; if false, this option will be ignored.")
|
||||
fs.BoolVar(&o.AllocateNodeCIDRs, "allocate-node-cidrs", false, "Should CIDRs for Pods be allocated and set on the cloud provider. Requires --cluster-cidr.")
|
||||
fs.StringVar(&o.CIDRAllocatorType, "cidr-allocator-type", "RangeAllocator", "Type of CIDR allocator to use")
|
||||
fs.BoolVar(&o.ConfigureCloudRoutes, "configure-cloud-routes", true, "Should CIDRs allocated by allocate-node-cidrs be configured on the cloud provider.")
|
||||
|
||||
fs.DurationVar(&o.NodeSyncPeriod.Duration, "node-sync-period", 0, ""+
|
||||
"This flag is deprecated and will be removed in future releases. See node-monitor-period for Node health checking or "+
|
||||
"route-reconciliation-period for cloud provider's route configuration settings.")
|
||||
fs.MarkDeprecated("node-sync-period", "This flag is currently no-op and will be deleted.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up KubeCloudShared config with options.
|
||||
func (o *KubeCloudSharedOptions) ApplyTo(cfg *cpconfig.KubeCloudSharedConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := o.CloudProvider.ApplyTo(&cfg.CloudProvider); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cfg.ExternalCloudVolumePlugin = o.ExternalCloudVolumePlugin
|
||||
cfg.UseServiceAccountCredentials = o.UseServiceAccountCredentials
|
||||
cfg.AllowUntaggedCloud = o.AllowUntaggedCloud
|
||||
cfg.RouteReconciliationPeriod = o.RouteReconciliationPeriod
|
||||
cfg.NodeMonitorPeriod = o.NodeMonitorPeriod
|
||||
cfg.ClusterName = o.ClusterName
|
||||
cfg.ClusterCIDR = o.ClusterCIDR
|
||||
cfg.AllocateNodeCIDRs = o.AllocateNodeCIDRs
|
||||
cfg.CIDRAllocatorType = o.CIDRAllocatorType
|
||||
cfg.ConfigureCloudRoutes = o.ConfigureCloudRoutes
|
||||
cfg.NodeSyncPeriod = o.NodeSyncPeriod
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of KubeCloudSharedOptions.
|
||||
func (o *KubeCloudSharedOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
errs = append(errs, o.CloudProvider.Validate()...)
|
||||
|
||||
return errs
|
||||
}
|
62
e2e/vendor/k8s.io/cloud-provider/options/nodecontroller.go
generated
vendored
Normal file
62
e2e/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
|
||||
}
|
308
e2e/vendor/k8s.io/cloud-provider/options/options.go
generated
vendored
Normal file
308
e2e/vendor/k8s.io/cloud-provider/options/options.go
generated
vendored
Normal file
@ -0,0 +1,308 @@
|
||||
/*
|
||||
Copyright 2016 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"
|
||||
"math/rand"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/cloud-provider/app/config"
|
||||
ccmconfig "k8s.io/cloud-provider/config"
|
||||
ccmconfigscheme "k8s.io/cloud-provider/config/install"
|
||||
ccmconfigv1alpha1 "k8s.io/cloud-provider/config/v1alpha1"
|
||||
"k8s.io/cloud-provider/names"
|
||||
cliflag "k8s.io/component-base/cli/flag"
|
||||
cmoptions "k8s.io/controller-manager/options"
|
||||
"k8s.io/controller-manager/pkg/clientbuilder"
|
||||
netutils "k8s.io/utils/net"
|
||||
|
||||
// add the related feature gates
|
||||
_ "k8s.io/controller-manager/pkg/features/register"
|
||||
)
|
||||
|
||||
const (
|
||||
// CloudControllerManagerUserAgent is the userAgent name when starting cloud-controller managers.
|
||||
CloudControllerManagerUserAgent = "cloud-controller-manager"
|
||||
)
|
||||
|
||||
// CloudControllerManagerOptions is the main context object for the controller manager.
|
||||
type CloudControllerManagerOptions struct {
|
||||
Generic *cmoptions.GenericControllerManagerConfigurationOptions
|
||||
KubeCloudShared *KubeCloudSharedOptions
|
||||
ServiceController *ServiceControllerOptions
|
||||
NodeController *NodeControllerOptions
|
||||
|
||||
SecureServing *apiserveroptions.SecureServingOptionsWithLoopback
|
||||
Authentication *apiserveroptions.DelegatingAuthenticationOptions
|
||||
Authorization *apiserveroptions.DelegatingAuthorizationOptions
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
s.Authentication.RemoteKubeConfigFileOptional = true
|
||||
s.Authorization.RemoteKubeConfigFileOptional = true
|
||||
|
||||
// Set the PairName but leave certificate directory blank to generate in-memory by default
|
||||
s.SecureServing.ServerCert.CertDirectory = ""
|
||||
s.SecureServing.ServerCert.PairName = "cloud-controller-manager"
|
||||
s.SecureServing.BindPort = cloudprovider.CloudControllerManagerPort
|
||||
|
||||
s.Generic.LeaderElection.ResourceName = "cloud-controller-manager"
|
||||
s.Generic.LeaderElection.ResourceNamespace = "kube-system"
|
||||
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
// NewDefaultComponentConfig returns cloud-controller manager configuration object.
|
||||
func NewDefaultComponentConfig() (*ccmconfig.CloudControllerManagerConfiguration, error) {
|
||||
versioned := &ccmconfigv1alpha1.CloudControllerManagerConfiguration{}
|
||||
ccmconfigscheme.Scheme.Default(versioned)
|
||||
|
||||
internal := &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 []string, disabledByDefaultControllers []string, controllerAliases map[string]string, allWebhooks, disabledByDefaultWebhooks []string) cliflag.NamedFlagSets {
|
||||
fss := cliflag.NamedFlagSets{}
|
||||
o.Generic.AddFlags(&fss, allControllers, disabledByDefaultControllers, controllerAliases)
|
||||
o.KubeCloudShared.AddFlags(fss.FlagSet("generic"))
|
||||
o.NodeController.AddFlags(fss.FlagSet(names.CloudNodeController))
|
||||
o.ServiceController.AddFlags(fss.FlagSet(names.ServiceLBController))
|
||||
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"))
|
||||
o.Authorization.AddFlags(fss.FlagSet("authorization"))
|
||||
|
||||
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.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
|
||||
}
|
||||
|
||||
// ApplyTo fills up cloud controller manager config with options.
|
||||
func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, allControllers []string, disabledByDefaultControllers []string, controllerAliases map[string]string, userAgent string) error {
|
||||
var err error
|
||||
|
||||
// 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.Generic.ClientConnection.Kubeconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Kubeconfig.DisableCompression = true
|
||||
c.Kubeconfig.ContentConfig.AcceptContentTypes = o.Generic.ClientConnection.AcceptContentTypes
|
||||
c.Kubeconfig.ContentConfig.ContentType = o.Generic.ClientConnection.ContentType
|
||||
c.Kubeconfig.QPS = o.Generic.ClientConnection.QPS
|
||||
c.Kubeconfig.Burst = int(o.Generic.ClientConnection.Burst)
|
||||
|
||||
if err = o.Generic.ApplyTo(&c.ComponentConfig.Generic, allControllers, disabledByDefaultControllers, controllerAliases); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = o.KubeCloudShared.ApplyTo(&c.ComponentConfig.KubeCloudShared); err != nil {
|
||||
return err
|
||||
}
|
||||
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, c.ComponentConfig.Webhook); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = o.SecureServing.ApplyTo(&c.SecureServing, &c.LoopbackClientConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
if o.SecureServing.BindPort != 0 || o.SecureServing.Listener != nil {
|
||||
if err = o.Authentication.ApplyTo(&c.Authentication, c.SecureServing, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = o.Authorization.ApplyTo(&c.Authorization); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
c.Client, err = clientset.NewForConfig(restclient.AddUserAgent(c.Kubeconfig, userAgent))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.EventBroadcaster = record.NewBroadcaster(record.WithContext(context.TODO())) // TODO: move broadcaster construction to a place where there is a proper context.
|
||||
c.EventRecorder = c.EventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: userAgent})
|
||||
|
||||
rootClientBuilder := clientbuilder.SimpleControllerClientBuilder{
|
||||
ClientConfig: c.Kubeconfig,
|
||||
}
|
||||
if c.ComponentConfig.KubeCloudShared.UseServiceAccountCredentials {
|
||||
c.ClientBuilder = clientbuilder.NewDynamicClientBuilder(
|
||||
restclient.AnonymousClientConfig(c.Kubeconfig),
|
||||
c.Client.CoreV1(),
|
||||
metav1.NamespaceSystem)
|
||||
} else {
|
||||
c.ClientBuilder = rootClientBuilder
|
||||
}
|
||||
c.VersionedClient = rootClientBuilder.ClientOrDie("shared-informers")
|
||||
c.SharedInformers = informers.NewSharedInformerFactory(c.VersionedClient, resyncPeriod(c)())
|
||||
|
||||
// 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 []string, disabledByDefaultControllers []string, controllerAliases map[string]string, allWebhooks, disabledByDefaultWebhooks []string) error {
|
||||
errors := []error{}
|
||||
|
||||
errors = append(errors, o.Generic.Validate(allControllers, disabledByDefaultControllers, controllerAliases)...)
|
||||
errors = append(errors, o.KubeCloudShared.Validate()...)
|
||||
errors = append(errors, o.ServiceController.Validate()...)
|
||||
errors = append(errors, o.SecureServing.Validate()...)
|
||||
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 && o.WebhookServing.BindPort != 0 {
|
||||
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"))
|
||||
}
|
||||
|
||||
return utilerrors.NewAggregate(errors)
|
||||
}
|
||||
|
||||
// resyncPeriod computes the time interval a shared informer waits before resyncing with the api server
|
||||
func resyncPeriod(c *config.Config) func() time.Duration {
|
||||
return func() time.Duration {
|
||||
factor := rand.Float64() + 1
|
||||
return time.Duration(float64(c.ComponentConfig.Generic.MinResyncPeriod.Nanoseconds()) * factor)
|
||||
}
|
||||
}
|
||||
|
||||
// Config return a cloud controller manager config objective
|
||||
func (o *CloudControllerManagerOptions) Config(allControllers []string, disabledByDefaultControllers []string, controllerAliases map[string]string, allWebhooks, disabledByDefaultWebhooks []string) (*config.Config, error) {
|
||||
if err := o.Validate(allControllers, disabledByDefaultControllers, controllerAliases, allWebhooks, disabledByDefaultWebhooks); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := o.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{netutils.ParseIPSloppy("127.0.0.1")}); err != nil {
|
||||
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, allControllers, disabledByDefaultControllers, controllerAliases, CloudControllerManagerUserAgent); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
57
e2e/vendor/k8s.io/cloud-provider/options/servicecontroller.go
generated
vendored
Normal file
57
e2e/vendor/k8s.io/cloud-provider/options/servicecontroller.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2018 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 (
|
||||
"github.com/spf13/pflag"
|
||||
serviceconfig "k8s.io/cloud-provider/controllers/service/config"
|
||||
)
|
||||
|
||||
// ServiceControllerOptions holds the ServiceController options.
|
||||
type ServiceControllerOptions struct {
|
||||
*serviceconfig.ServiceControllerConfiguration
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ServiceController for controller manager to the specified FlagSet.
|
||||
func (o *ServiceControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentServiceSyncs, "concurrent-service-syncs", o.ConcurrentServiceSyncs, "The number of services that are allowed to sync concurrently. Larger number = more responsive service management, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ServiceController config with options.
|
||||
func (o *ServiceControllerOptions) ApplyTo(cfg *serviceconfig.ServiceControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentServiceSyncs = o.ConcurrentServiceSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ServiceControllerOptions.
|
||||
func (o *ServiceControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
210
e2e/vendor/k8s.io/cloud-provider/options/webhook.go
generated
vendored
Normal file
210
e2e/vendor/k8s.io/cloud-provider/options/webhook.go
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
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, "Secure port to serve cloud provider webhooks. If 0, don't serve webhooks at all.")
|
||||
|
||||
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, webhookCfg config.WebhookConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if o.BindPort <= 0 {
|
||||
return nil
|
||||
}
|
||||
// no need to bind to the address if there are no webhook enabled.
|
||||
if len(webhookCfg.Webhooks) == 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
|
||||
}
|
136
e2e/vendor/k8s.io/cloud-provider/plugins.go
generated
vendored
Normal file
136
e2e/vendor/k8s.io/cloud-provider/plugins.go
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
Copyright 2014 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 cloudprovider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// Factory is a function that returns a cloudprovider.Interface.
|
||||
// The config parameter provides an io.Reader handler to the factory in
|
||||
// order to load specific configurations. If no configuration is provided
|
||||
// the parameter is nil.
|
||||
type Factory func(config io.Reader) (Interface, error)
|
||||
|
||||
// All registered cloud providers.
|
||||
var (
|
||||
providersMutex sync.Mutex
|
||||
providers = make(map[string]Factory)
|
||||
)
|
||||
|
||||
const externalCloudProvider = "external"
|
||||
|
||||
// RegisterCloudProvider registers a cloudprovider.Factory by name. This
|
||||
// is expected to happen during app startup.
|
||||
func RegisterCloudProvider(name string, cloud Factory) {
|
||||
providersMutex.Lock()
|
||||
defer providersMutex.Unlock()
|
||||
if _, found := providers[name]; found {
|
||||
klog.Fatalf("Cloud provider %q was registered twice", name)
|
||||
}
|
||||
klog.V(1).Infof("Registered cloud provider %q", name)
|
||||
providers[name] = cloud
|
||||
}
|
||||
|
||||
// IsCloudProvider returns true if name corresponds to an already registered
|
||||
// cloud provider.
|
||||
func IsCloudProvider(name string) bool {
|
||||
providersMutex.Lock()
|
||||
defer providersMutex.Unlock()
|
||||
_, found := providers[name]
|
||||
return found
|
||||
}
|
||||
|
||||
// GetCloudProvider creates an instance of the named cloud provider, or nil if
|
||||
// the name is unknown. The error return is only used if the named provider
|
||||
// was known but failed to initialize. The config parameter specifies the
|
||||
// io.Reader handler of the configuration file for the cloud provider, or nil
|
||||
// for no configuration.
|
||||
func GetCloudProvider(name string, config io.Reader) (Interface, error) {
|
||||
providersMutex.Lock()
|
||||
defer providersMutex.Unlock()
|
||||
f, found := providers[name]
|
||||
if !found {
|
||||
return nil, nil
|
||||
}
|
||||
return f(config)
|
||||
}
|
||||
|
||||
// Detects if the string is an external cloud provider
|
||||
func IsExternal(name string) bool {
|
||||
return name == externalCloudProvider
|
||||
}
|
||||
|
||||
// DisableWarningForProvider logs information about disabled cloud provider state
|
||||
func DisableWarningForProvider(providerName string) {
|
||||
if !IsExternal(providerName) {
|
||||
klog.Infof("INFO: Please make sure you are running an external cloud controller manager binary for provider %q."+
|
||||
"In-tree cloud providers are disabled. Refer to https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/cloud-provider/sample "+
|
||||
"for an example implementation.", providerName)
|
||||
klog.Warningf("WARNING: built-in cloud providers are disabled. Please set \"--cloud-provider=external\" and migrate to an external cloud controller manager for provider %q", providerName)
|
||||
}
|
||||
}
|
||||
|
||||
// ErrorForDisabledProvider returns an error formatted with the supplied provider name
|
||||
func ErrorForDisabledProvider(providerName string) error {
|
||||
return fmt.Errorf("cloud provider %q was specified, but built-in cloud providers are disabled. Please set --cloud-provider=external and migrate to an external cloud provider", providerName)
|
||||
}
|
||||
|
||||
// InitCloudProvider creates an instance of the named cloud provider.
|
||||
func InitCloudProvider(name string, configFilePath string) (Interface, error) {
|
||||
var cloud Interface
|
||||
var err error
|
||||
|
||||
if name == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if IsExternal(name) {
|
||||
klog.Info("External cloud provider specified")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if configFilePath != "" {
|
||||
var config *os.File
|
||||
config, err = os.Open(configFilePath)
|
||||
if err != nil {
|
||||
klog.Fatalf("Couldn't open cloud provider configuration %s: %#v",
|
||||
configFilePath, err)
|
||||
}
|
||||
|
||||
defer config.Close()
|
||||
cloud, err = GetCloudProvider(name, config)
|
||||
} else {
|
||||
// Pass explicit nil so plugins can actually check for nil. See
|
||||
// "Why is my nil error value not equal to nil?" in golang.org/doc/faq.
|
||||
cloud, err = GetCloudProvider(name, nil)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not init cloud provider %q: %v", name, err)
|
||||
}
|
||||
if cloud == nil {
|
||||
return nil, fmt.Errorf("unknown cloud provider %q", name)
|
||||
}
|
||||
|
||||
return cloud, nil
|
||||
}
|
23
e2e/vendor/k8s.io/cloud-provider/ports.go
generated
vendored
Normal file
23
e2e/vendor/k8s.io/cloud-provider/ports.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2014 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 cloudprovider
|
||||
|
||||
const (
|
||||
// CloudControllerManagerPort is the default port for the cloud controller manager server.
|
||||
// This value may be overridden by a flag at startup.
|
||||
CloudControllerManagerPort = 10258
|
||||
)
|
26
e2e/vendor/k8s.io/cloud-provider/volume/constants.go
generated
vendored
Normal file
26
e2e/vendor/k8s.io/cloud-provider/volume/constants.go
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2019 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 volume
|
||||
|
||||
const (
|
||||
// ProvisionedVolumeName is the name of a volume in an external cloud
|
||||
// that is being provisioned and thus should be ignored by rest of Kubernetes.
|
||||
ProvisionedVolumeName = "placeholder-for-provisioning"
|
||||
|
||||
// LabelMultiZoneDelimiter separates zones for volumes
|
||||
LabelMultiZoneDelimiter = "__"
|
||||
)
|
165
e2e/vendor/k8s.io/cloud-provider/volume/helpers/rounding.go
generated
vendored
Normal file
165
e2e/vendor/k8s.io/cloud-provider/volume/helpers/rounding.go
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
Copyright 2019 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 helpers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/bits"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
)
|
||||
|
||||
/*
|
||||
The Cloud Provider's volume plugins provision disks for corresponding
|
||||
PersistentVolumeClaims. Cloud Providers use different allocation unit for their
|
||||
disk sizes. AWS allows you to specify the size as an integer amount of GiB,
|
||||
while Portworx expects bytes for example. On AWS, if you want a volume of
|
||||
1500MiB, the actual call to the AWS API should therefore be for a 2GiB disk.
|
||||
This file contains functions that help rounding a storage request based on a
|
||||
Cloud Provider's allocation unit.
|
||||
*/
|
||||
|
||||
const (
|
||||
// GB - GigaByte size
|
||||
GB = 1000 * 1000 * 1000
|
||||
// GiB - GibiByte size
|
||||
GiB = 1024 * 1024 * 1024
|
||||
|
||||
// MB - MegaByte size
|
||||
MB = 1000 * 1000
|
||||
// MiB - MebiByte size
|
||||
MiB = 1024 * 1024
|
||||
|
||||
// KB - KiloByte size
|
||||
KB = 1000
|
||||
// KiB - KibiByte size
|
||||
KiB = 1024
|
||||
)
|
||||
|
||||
// RoundUpToGiB rounds up given quantity upto chunks of GiB
|
||||
func RoundUpToGiB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, GiB)
|
||||
}
|
||||
|
||||
// RoundUpToMB rounds up given quantity to chunks of MB
|
||||
func RoundUpToMB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, MB)
|
||||
}
|
||||
|
||||
// RoundUpToMiB rounds up given quantity upto chunks of MiB
|
||||
func RoundUpToMiB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, MiB)
|
||||
}
|
||||
|
||||
// RoundUpToKB rounds up given quantity to chunks of KB
|
||||
func RoundUpToKB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, KB)
|
||||
}
|
||||
|
||||
// RoundUpToKiB rounds up given quantity to chunks of KiB
|
||||
func RoundUpToKiB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, KiB)
|
||||
}
|
||||
|
||||
// RoundUpToB rounds up given quantity to chunks of bytes
|
||||
func RoundUpToB(size resource.Quantity) (int64, error) {
|
||||
return roundUpSizeInt64(size, 1)
|
||||
}
|
||||
|
||||
// RoundUpToGiBInt rounds up given quantity upto chunks of GiB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToGiBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(size, GiB)
|
||||
}
|
||||
|
||||
// RoundUpToMBInt rounds up given quantity to chunks of MB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToMBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(size, MB)
|
||||
}
|
||||
|
||||
// RoundUpToMiBInt rounds up given quantity upto chunks of MiB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToMiBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(size, MiB)
|
||||
}
|
||||
|
||||
// RoundUpToKBInt rounds up given quantity to chunks of KB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToKBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(size, KB)
|
||||
}
|
||||
|
||||
// RoundUpToKiBInt rounds up given quantity upto chunks of KiB. It returns an
|
||||
// int instead of an int64 and an error if there's overflow
|
||||
func RoundUpToKiBInt(size resource.Quantity) (int, error) {
|
||||
return roundUpSizeInt(size, KiB)
|
||||
}
|
||||
|
||||
// RoundUpToGiBInt32 rounds up given quantity up to chunks of GiB. It returns an
|
||||
// int32 instead of an int64 and an error if there's overflow
|
||||
func RoundUpToGiBInt32(size resource.Quantity) (int32, error) {
|
||||
return roundUpSizeInt32(size, GiB)
|
||||
}
|
||||
|
||||
// roundUpSizeInt calculates how many allocation units are needed to accommodate
|
||||
// a volume of a given size. It returns an int and an error if there's overflow
|
||||
func roundUpSizeInt(size resource.Quantity, allocationUnitBytes int64) (int, error) {
|
||||
if bits.UintSize == 32 {
|
||||
res, err := roundUpSizeInt32(size, allocationUnitBytes)
|
||||
return int(res), err
|
||||
}
|
||||
res, err := roundUpSizeInt64(size, allocationUnitBytes)
|
||||
return int(res), err
|
||||
}
|
||||
|
||||
// roundUpSizeInt32 calculates how many allocation units are needed to accommodate
|
||||
// a volume of a given size. It returns an int32 and an error if there's overflow
|
||||
func roundUpSizeInt32(size resource.Quantity, allocationUnitBytes int64) (int32, error) {
|
||||
roundedUpInt32, err := roundUpSizeInt64(size, allocationUnitBytes)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if roundedUpInt32 > math.MaxInt32 {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int32", size.String())
|
||||
}
|
||||
return int32(roundedUpInt32), nil
|
||||
}
|
||||
|
||||
// roundUpSizeInt64 calculates how many allocation units are needed to accommodate
|
||||
// a volume of a given size. It returns an int64 and an error if there's overflow
|
||||
func roundUpSizeInt64(size resource.Quantity, allocationUnitBytes int64) (int64, error) {
|
||||
// Use CmpInt64() to find out if the value of "size" would overflow an
|
||||
// int64 and therefore have Value() return a wrong result. Then, retrieve
|
||||
// the value as int64 and perform the rounding.
|
||||
// It's not convenient to use AsScale() and related functions as they don't
|
||||
// support BinarySI format, nor can we use AsInt64() directly since it's
|
||||
// only implemented for int64 scaled numbers (int64Amount).
|
||||
|
||||
// CmpInt64() actually returns 0 when comparing an amount bigger than MaxInt64.
|
||||
if size.CmpInt64(math.MaxInt64) >= 0 {
|
||||
return 0, fmt.Errorf("quantity %s is too great, overflows int64", size.String())
|
||||
}
|
||||
volumeSizeBytes := size.Value()
|
||||
|
||||
roundedUp := volumeSizeBytes / allocationUnitBytes
|
||||
if volumeSizeBytes%allocationUnitBytes > 0 {
|
||||
roundedUp++
|
||||
}
|
||||
return roundedUp, nil
|
||||
}
|
313
e2e/vendor/k8s.io/cloud-provider/volume/helpers/zones.go
generated
vendored
Normal file
313
e2e/vendor/k8s.io/cloud-provider/volume/helpers/zones.go
generated
vendored
Normal file
@ -0,0 +1,313 @@
|
||||
/*
|
||||
Copyright 2019 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 helpers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
cloudvolume "k8s.io/cloud-provider/volume"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// LabelZonesToSet converts a PV label value from string containing a delimited list of zones to set
|
||||
func LabelZonesToSet(labelZonesValue string) (sets.String, error) {
|
||||
return stringToSet(labelZonesValue, cloudvolume.LabelMultiZoneDelimiter)
|
||||
}
|
||||
|
||||
// ZonesSetToLabelValue converts zones set to label value
|
||||
func ZonesSetToLabelValue(strSet sets.String) string {
|
||||
return strings.Join(strSet.UnsortedList(), cloudvolume.LabelMultiZoneDelimiter)
|
||||
}
|
||||
|
||||
// ZonesToSet converts a string containing a comma separated list of zones to set
|
||||
func ZonesToSet(zonesString string) (sets.String, error) {
|
||||
zones, err := stringToSet(zonesString, ",")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing zones %s, must be strings separated by commas: %v", zonesString, err)
|
||||
}
|
||||
return zones, nil
|
||||
}
|
||||
|
||||
// StringToSet converts a string containing list separated by specified delimiter to a set
|
||||
func stringToSet(str, delimiter string) (sets.String, error) {
|
||||
zonesSlice := strings.Split(str, delimiter)
|
||||
zonesSet := make(sets.String)
|
||||
for _, zone := range zonesSlice {
|
||||
trimmedZone := strings.TrimSpace(zone)
|
||||
if trimmedZone == "" {
|
||||
return make(sets.String), fmt.Errorf(
|
||||
"%q separated list (%q) must not contain an empty string",
|
||||
delimiter,
|
||||
str)
|
||||
}
|
||||
zonesSet.Insert(trimmedZone)
|
||||
}
|
||||
return zonesSet, nil
|
||||
}
|
||||
|
||||
// LabelZonesToList converts a PV label value from string containing a delimited list of zones to list
|
||||
func LabelZonesToList(labelZonesValue string) ([]string, error) {
|
||||
return stringToList(labelZonesValue, cloudvolume.LabelMultiZoneDelimiter)
|
||||
}
|
||||
|
||||
// StringToList converts a string containing list separated by specified delimiter to a list
|
||||
func stringToList(str, delimiter string) ([]string, error) {
|
||||
zonesSlice := make([]string, 0)
|
||||
for _, zone := range strings.Split(str, delimiter) {
|
||||
trimmedZone := strings.TrimSpace(zone)
|
||||
if trimmedZone == "" {
|
||||
return nil, fmt.Errorf(
|
||||
"%q separated list (%q) must not contain an empty string",
|
||||
delimiter,
|
||||
str)
|
||||
}
|
||||
zonesSlice = append(zonesSlice, trimmedZone)
|
||||
}
|
||||
return zonesSlice, nil
|
||||
}
|
||||
|
||||
// SelectZoneForVolume is a wrapper around SelectZonesForVolume
|
||||
// to select a single zone for a volume based on parameters
|
||||
func SelectZoneForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string) (string, error) {
|
||||
zones, err := SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent, zoneParameter, zonesParameter, zonesWithNodes, node, allowedTopologies, pvcName, 1)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
zone, ok := zones.PopAny()
|
||||
if !ok {
|
||||
return "", fmt.Errorf("could not determine a zone to provision volume in")
|
||||
}
|
||||
return zone, nil
|
||||
}
|
||||
|
||||
// SelectZonesForVolume selects zones for a volume based on several factors:
|
||||
// node.zone, allowedTopologies, zone/zones parameters from storageclass,
|
||||
// zones with active nodes from the cluster. The number of zones = replicas.
|
||||
func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string, numReplicas uint32) (sets.String, error) {
|
||||
if zoneParameterPresent && zonesParameterPresent {
|
||||
return nil, fmt.Errorf("both zone and zones StorageClass parameters must not be used at the same time")
|
||||
}
|
||||
|
||||
var zoneFromNode string
|
||||
// pick one zone from node if present
|
||||
if node != nil {
|
||||
// VolumeScheduling implicit since node is not nil
|
||||
if zoneParameterPresent || zonesParameterPresent {
|
||||
return nil, fmt.Errorf("zone[s] cannot be specified in StorageClass if VolumeBindingMode is set to WaitForFirstConsumer. Please specify allowedTopologies in StorageClass for constraining zones")
|
||||
}
|
||||
|
||||
// pick node's zone for one of the replicas
|
||||
var ok bool
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelTopologyZone]
|
||||
if !ok {
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Either %s or %s Label for node missing", v1.LabelTopologyZone, v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
}
|
||||
// if single replica volume and node with zone found, return immediately
|
||||
if numReplicas == 1 {
|
||||
return sets.NewString(zoneFromNode), nil
|
||||
}
|
||||
}
|
||||
|
||||
// pick zone from allowedZones if specified
|
||||
allowedZones, err := ZonesFromAllowedTopologies(allowedTopologies)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if (len(allowedTopologies) > 0) && (allowedZones.Len() == 0) {
|
||||
return nil, fmt.Errorf("no matchLabelExpressions with %s key found in allowedTopologies. Please specify matchLabelExpressions with %s key", v1.LabelTopologyZone, v1.LabelTopologyZone)
|
||||
}
|
||||
|
||||
if allowedZones.Len() > 0 {
|
||||
// VolumeScheduling implicit since allowedZones present
|
||||
if zoneParameterPresent || zonesParameterPresent {
|
||||
return nil, fmt.Errorf("zone[s] cannot be specified in StorageClass if allowedTopologies specified")
|
||||
}
|
||||
// scheduler will guarantee if node != null above, zoneFromNode is member of allowedZones.
|
||||
// so if zoneFromNode != "", we can safely assume it is part of allowedZones.
|
||||
zones, err := chooseZonesForVolumeIncludingZone(allowedZones, pvcName, zoneFromNode, numReplicas)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot process zones in allowedTopologies: %v", err)
|
||||
}
|
||||
return zones, nil
|
||||
}
|
||||
|
||||
// pick zone from parameters if present
|
||||
if zoneParameterPresent {
|
||||
if numReplicas > 1 {
|
||||
return nil, fmt.Errorf("zone cannot be specified if desired number of replicas for pv is greather than 1. Please specify zones or allowedTopologies to specify desired zones")
|
||||
}
|
||||
return sets.NewString(zoneParameter), nil
|
||||
}
|
||||
|
||||
if zonesParameterPresent {
|
||||
if uint32(zonesParameter.Len()) < numReplicas {
|
||||
return nil, fmt.Errorf("not enough zones found in zones parameter to provision a volume with %d replicas. Found %d zones, need %d zones", numReplicas, zonesParameter.Len(), numReplicas)
|
||||
}
|
||||
// directly choose from zones parameter; no zone from node need to be considered
|
||||
return ChooseZonesForVolume(zonesParameter, pvcName, numReplicas), nil
|
||||
}
|
||||
|
||||
// pick zone from zones with nodes
|
||||
if zonesWithNodes.Len() > 0 {
|
||||
// If node != null (and thus zoneFromNode != ""), zoneFromNode will be member of zonesWithNodes
|
||||
zones, err := chooseZonesForVolumeIncludingZone(zonesWithNodes, pvcName, zoneFromNode, numReplicas)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot process zones where nodes exist in the cluster: %v", err)
|
||||
}
|
||||
return zones, nil
|
||||
}
|
||||
return nil, fmt.Errorf("cannot determine zones to provision volume in")
|
||||
}
|
||||
|
||||
// ZonesFromAllowedTopologies returns a list of zones specified in allowedTopologies
|
||||
func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (sets.String, error) {
|
||||
zones := make(sets.String)
|
||||
for _, term := range allowedTopologies {
|
||||
for _, exp := range term.MatchLabelExpressions {
|
||||
if exp.Key == v1.LabelTopologyZone || exp.Key == v1.LabelFailureDomainBetaZone {
|
||||
for _, value := range exp.Values {
|
||||
zones.Insert(value)
|
||||
}
|
||||
} else {
|
||||
return nil, fmt.Errorf("unsupported key found in matchLabelExpressions: %s", exp.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return zones, nil
|
||||
}
|
||||
|
||||
// chooseZonesForVolumeIncludingZone is a wrapper around ChooseZonesForVolume that ensures zoneToInclude is chosen
|
||||
// zoneToInclude can either be empty in which case it is ignored. If non-empty, zoneToInclude is expected to be member of zones.
|
||||
// numReplicas is expected to be > 0 and <= zones.Len()
|
||||
func chooseZonesForVolumeIncludingZone(zones sets.String, pvcName, zoneToInclude string, numReplicas uint32) (sets.String, error) {
|
||||
if numReplicas == 0 {
|
||||
return nil, fmt.Errorf("invalid number of replicas passed")
|
||||
}
|
||||
if uint32(zones.Len()) < numReplicas {
|
||||
return nil, fmt.Errorf("not enough zones found to provision a volume with %d replicas. Need at least %d distinct zones for a volume with %d replicas", numReplicas, numReplicas, numReplicas)
|
||||
}
|
||||
if zoneToInclude != "" && !zones.Has(zoneToInclude) {
|
||||
return nil, fmt.Errorf("zone to be included: %s needs to be member of set: %v", zoneToInclude, zones)
|
||||
}
|
||||
if uint32(zones.Len()) == numReplicas {
|
||||
return zones, nil
|
||||
}
|
||||
if zoneToInclude != "" {
|
||||
zones.Delete(zoneToInclude)
|
||||
numReplicas = numReplicas - 1
|
||||
}
|
||||
zonesChosen := ChooseZonesForVolume(zones, pvcName, numReplicas)
|
||||
if zoneToInclude != "" {
|
||||
zonesChosen.Insert(zoneToInclude)
|
||||
}
|
||||
return zonesChosen, nil
|
||||
}
|
||||
|
||||
// ChooseZonesForVolume is identical to ChooseZoneForVolume, but selects a multiple zones, for multi-zone disks.
|
||||
func ChooseZonesForVolume(zones sets.String, pvcName string, numZones uint32) sets.String {
|
||||
// No zones available, return empty set.
|
||||
replicaZones := sets.NewString()
|
||||
if zones.Len() == 0 {
|
||||
return replicaZones
|
||||
}
|
||||
|
||||
// We create the volume in a zone determined by the name
|
||||
// Eventually the scheduler will coordinate placement into an available zone
|
||||
hash, index := getPVCNameHashAndIndexOffset(pvcName)
|
||||
|
||||
// Zones.List returns zones in a consistent order (sorted)
|
||||
// We do have a potential failure case where volumes will not be properly spread,
|
||||
// if the set of zones changes during StatefulSet volume creation. However, this is
|
||||
// probably relatively unlikely because we expect the set of zones to be essentially
|
||||
// static for clusters.
|
||||
// Hopefully we can address this problem if/when we do full scheduler integration of
|
||||
// PVC placement (which could also e.g. avoid putting volumes in overloaded or
|
||||
// unhealthy zones)
|
||||
zoneSlice := zones.List()
|
||||
|
||||
startingIndex := index * numZones
|
||||
for index = startingIndex; index < startingIndex+numZones; index++ {
|
||||
zone := zoneSlice[(hash+index)%uint32(len(zoneSlice))]
|
||||
replicaZones.Insert(zone)
|
||||
}
|
||||
|
||||
klog.V(2).Infof("Creating volume for replicated PVC %q; chosen zones=%q from zones=%q",
|
||||
pvcName, replicaZones.UnsortedList(), zoneSlice)
|
||||
return replicaZones
|
||||
}
|
||||
|
||||
func getPVCNameHashAndIndexOffset(pvcName string) (hash uint32, index uint32) {
|
||||
if pvcName == "" {
|
||||
// We should always be called with a name; this shouldn't happen
|
||||
klog.Warningf("No name defined during volume create; choosing random zone")
|
||||
|
||||
hash = rand.Uint32()
|
||||
} else {
|
||||
hashString := pvcName
|
||||
|
||||
// Heuristic to make sure that volumes in a StatefulSet are spread across zones
|
||||
// StatefulSet PVCs are (currently) named ClaimName-StatefulSetName-Id,
|
||||
// where Id is an integer index.
|
||||
// Note though that if a StatefulSet pod has multiple claims, we need them to be
|
||||
// in the same zone, because otherwise the pod will be unable to mount both volumes,
|
||||
// and will be unschedulable. So we hash _only_ the "StatefulSetName" portion when
|
||||
// it looks like `ClaimName-StatefulSetName-Id`.
|
||||
// We continue to round-robin volume names that look like `Name-Id` also; this is a useful
|
||||
// feature for users that are creating statefulset-like functionality without using statefulsets.
|
||||
lastDash := strings.LastIndexByte(pvcName, '-')
|
||||
if lastDash != -1 {
|
||||
statefulsetIDString := pvcName[lastDash+1:]
|
||||
statefulsetID, err := strconv.ParseUint(statefulsetIDString, 10, 32)
|
||||
if err == nil {
|
||||
// Offset by the statefulsetID, so we round-robin across zones
|
||||
index = uint32(statefulsetID)
|
||||
// We still hash the volume name, but only the prefix
|
||||
hashString = pvcName[:lastDash]
|
||||
|
||||
// In the special case where it looks like `ClaimName-StatefulSetName-Id`,
|
||||
// hash only the StatefulSetName, so that different claims on the same StatefulSet
|
||||
// member end up in the same zone.
|
||||
// Note that StatefulSetName (and ClaimName) might themselves both have dashes.
|
||||
// We actually just take the portion after the final - of ClaimName-StatefulSetName.
|
||||
// For our purposes it doesn't much matter (just suboptimal spreading).
|
||||
lastDash := strings.LastIndexByte(hashString, '-')
|
||||
if lastDash != -1 {
|
||||
hashString = hashString[lastDash+1:]
|
||||
}
|
||||
|
||||
klog.V(2).Infof("Detected StatefulSet-style volume name %q; index=%d", pvcName, index)
|
||||
}
|
||||
}
|
||||
|
||||
// We hash the (base) volume name, so we don't bias towards the first N zones
|
||||
h := fnv.New32()
|
||||
h.Write([]byte(hashString))
|
||||
hash = h.Sum32()
|
||||
}
|
||||
|
||||
return hash, index
|
||||
}
|
Reference in New Issue
Block a user