summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/kubernetes/pkg/cloudprovider
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 18:26:55 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 18:09:12 +0000
commitaf64e10400f8533a0c48ecdf5ab9b7fbf329e14e (patch)
tree59160e3841b440dd35189c724bbb4375a7be173b /vendor/k8s.io/kubernetes/pkg/cloudprovider
parent26d7e3c7b85e28c4e42998c90fdcc14079f13eef (diff)
downloadpodman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.gz
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.bz2
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.zip
Vendor in lots of kubernetes stuff to shrink image size
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #554 Approved by: mheon
Diffstat (limited to 'vendor/k8s.io/kubernetes/pkg/cloudprovider')
-rw-r--r--vendor/k8s.io/kubernetes/pkg/cloudprovider/README.md4
-rw-r--r--vendor/k8s.io/kubernetes/pkg/cloudprovider/cloud.go75
-rw-r--r--vendor/k8s.io/kubernetes/pkg/cloudprovider/plugins.go14
3 files changed, 55 insertions, 38 deletions
diff --git a/vendor/k8s.io/kubernetes/pkg/cloudprovider/README.md b/vendor/k8s.io/kubernetes/pkg/cloudprovider/README.md
index ada366620..b59eba409 100644
--- a/vendor/k8s.io/kubernetes/pkg/cloudprovider/README.md
+++ b/vendor/k8s.io/kubernetes/pkg/cloudprovider/README.md
@@ -4,7 +4,7 @@
The mechanism for supporting cloud providers is currently in transition: the original method of implementing cloud provider-specific functionality within the main kubernetes tree (here) is no longer advised; however, the proposed solution is still in development.
#### Guidance for potential cloud providers:
-* Support for cloud providers is currently in a state of flux. Background information on motivation and the proposal for improving is in the github [proposal](https://git.k8s.io/community/contributors/design-proposals/cloud-provider-refactoring.md).
+* Support for cloud providers is currently in a state of flux. Background information on motivation and the proposal for improving is in the github [proposal](https://git.k8s.io/community/contributors/design-proposals/cloud-provider/cloud-provider-refactoring.md).
* In support of this plan, a new cloud-controller-manager binary was added in 1.6. This was the first of several steps (see the proposal for more information).
* Attempts to contribute new cloud providers or (to a lesser extent) persistent volumes to the core repo will likely meet with some pushback from reviewers/approvers.
* It is understood that this is an unfortunate situation in which 'the old way is no longer supported but the new way is not ready yet', but the initial path is unsustainable, and contributors are encouraged to participate in the implementation of the proposed long-term solution, as there is risk that PRs for new cloud providers here will not be approved.
@@ -13,4 +13,4 @@ The mechanism for supporting cloud providers is currently in transition: the or
#### Some additional context on status / direction:
* 1.6 added a new cloud-controller-manager binary that may be used for testing the new out-of-core cloudprovider flow.
* Setting cloud-provider=external allows for creation of a separate controller-manager binary
-* 1.7 adds [extensible admission control](https://git.k8s.io/community/contributors/design-proposals/admission_control_extension.md), further enabling topology customization.
+* 1.7 adds [extensible admission control](https://git.k8s.io/community/contributors/design-proposals/api-machinery/admission_control_extension.md), further enabling topology customization.
diff --git a/vendor/k8s.io/kubernetes/pkg/cloudprovider/cloud.go b/vendor/k8s.io/kubernetes/pkg/cloudprovider/cloud.go
index 2fb837b71..9ca91ebf3 100644
--- a/vendor/k8s.io/kubernetes/pkg/cloudprovider/cloud.go
+++ b/vendor/k8s.io/kubernetes/pkg/cloudprovider/cloud.go
@@ -17,12 +17,14 @@ limitations under the License.
package cloudprovider
import (
+ "context"
"errors"
"fmt"
"strings"
+ "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/kubernetes/pkg/api/v1"
+ "k8s.io/client-go/informers"
"k8s.io/kubernetes/pkg/controller"
)
@@ -43,16 +45,21 @@ type Interface interface {
Routes() (Routes, bool)
// ProviderName returns the cloud provider ID.
ProviderName() string
- // ScrubDNS provides an opportunity for cloud-provider-specific code to process DNS settings for pods.
- ScrubDNS(nameservers, searches []string) (nsOut, srchOut []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() ([]string, error)
+ 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(clusterName string) (string, error)
+ Master(ctx context.Context, clusterName string) (string, error)
}
// TODO(#6812): Use a shorter name that's less likely to be longer than cloud
@@ -69,12 +76,12 @@ func GetLoadBalancerName(service *v1.Service) string {
}
// GetInstanceProviderID builds a ProviderID for a node in a cloud.
-func GetInstanceProviderID(cloud Interface, nodeName types.NodeName) (string, error) {
+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(nodeName)
+ instanceID, err := instances.InstanceID(ctx, nodeName)
if err != nil {
return "", fmt.Errorf("failed to get instance ID from cloud provider: %v", err)
}
@@ -88,17 +95,17 @@ type LoadBalancer interface {
// 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
- GetLoadBalancer(clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
+ GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
// 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
- EnsureLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
+ 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(clusterName string, service *v1.Service, nodes []*v1.Node) error
+ 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.
@@ -107,7 +114,7 @@ type LoadBalancer interface {
// 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(clusterName string, service *v1.Service) error
+ EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
}
// Instances is an abstract, pluggable interface for sets of instances.
@@ -116,28 +123,31 @@ type Instances interface {
// TODO(roberthbailey): This currently is only used in such a way that it
// returns the address of the calling instance. We should do a rename to
// make this clearer.
- NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error)
+ 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(providerId string) ([]v1.NodeAddress, error)
+ NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
// ExternalID returns the cloud provider ID of the node with the specified NodeName.
// Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)
- ExternalID(nodeName types.NodeName) (string, error)
+ ExternalID(ctx context.Context, nodeName types.NodeName) (string, error)
// InstanceID returns the cloud provider ID of the node with the specified NodeName.
- InstanceID(nodeName types.NodeName) (string, error)
+ InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
// InstanceType returns the type of the specified instance.
- InstanceType(name types.NodeName) (string, error)
+ InstanceType(ctx context.Context, name types.NodeName) (string, error)
// InstanceTypeByProviderID returns the type of the specified instance.
- InstanceTypeByProviderID(providerID string) (string, error)
+ 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(user string, keyData []byte) error
+ 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(hostname string) (types.NodeName, error)
+ CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
+ // InstanceExistsByProviderID returns true if the instance for the given provider id still is running.
+ // If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
+ InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
}
// Route is a representation of an advanced routing rule.
@@ -158,19 +168,20 @@ type Route struct {
// 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(clusterName string) ([]*Route, error)
+ 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(clusterName string, nameHint string, route *Route) error
+ 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(clusterName string, route *Route) error
+ DeleteRoute(ctx context.Context, clusterName string, route *Route) error
}
var (
InstanceNotFound = errors.New("instance not found")
DiskNotFound = errors.New("disk is not found")
+ NotImplemented = errors.New("unimplemented")
)
// Zone represents the location of a particular machine.
@@ -182,5 +193,23 @@ type Zone struct {
// Zones is an abstract, pluggable interface for zone enumeration.
type Zones interface {
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in
- GetZone() (Zone, error)
+ // 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 down
+ // 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 down
+ // outside the kubelets.
+ GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (Zone, error)
+}
+
+// PVLabeler is an abstract, pluggable interface for fetching labels for volumes
+type PVLabeler interface {
+ GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error)
}
diff --git a/vendor/k8s.io/kubernetes/pkg/cloudprovider/plugins.go b/vendor/k8s.io/kubernetes/pkg/cloudprovider/plugins.go
index 0fc41f5ea..739c09613 100644
--- a/vendor/k8s.io/kubernetes/pkg/cloudprovider/plugins.go
+++ b/vendor/k8s.io/kubernetes/pkg/cloudprovider/plugins.go
@@ -60,23 +60,11 @@ func IsCloudProvider(name string) bool {
return found
}
-// CloudProviders returns the name of all registered cloud providers in a
-// string slice
-func CloudProviders() []string {
- names := []string{}
- providersMutex.Lock()
- defer providersMutex.Unlock()
- for name := range providers {
- names = append(names, name)
- }
- return names
-}
-
// 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 configuation.
+// for no configuration.
func GetCloudProvider(name string, config io.Reader) (Interface, error) {
providersMutex.Lock()
defer providersMutex.Unlock()