From 49a1b5ac794a03fcb62e91e39189bb440d16d229 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 5 Sep 2017 09:53:44 -0700 Subject: [PATCH] k8s 1.8 --- .../providers/rancher/rancher.go | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/rancher/rancher.go b/pkg/cloudprovider/providers/rancher/rancher.go index b8d722651e18a..fe201884dd981 100644 --- a/pkg/cloudprovider/providers/rancher/rancher.go +++ b/pkg/cloudprovider/providers/rancher/rancher.go @@ -18,9 +18,9 @@ import ( "github.com/golang/glog" "github.com/rancher/go-rancher/v2" + api "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/cache" - api "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/controller" ) @@ -75,16 +75,41 @@ func (r *CloudProvider) Zones() (cloudprovider.Zones, bool) { return r, true } +// GetZoneByNodeName implements Zones.GetZoneByNodeName +// This is particularly useful in external cloud providers where the kubelet +// does not initialize node data. +func (r *CloudProvider) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error) { + return cloudprovider.Zone{}, errors.New("GetZoneByNodeName not imeplemented") +} + +// GetZoneByProviderID implements Zones.GetZoneByProviderID +// This is particularly useful in external cloud providers where the kubelet +// does not initialize node data. +func (r *CloudProvider) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error) { + return cloudprovider.Zone{}, errors.New("GetZoneByProviderID not implemented") +} + // Instances returns an implementation of Instances for Rancher func (r *CloudProvider) Instances() (cloudprovider.Instances, bool) { return r, true } +// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. +// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. +func (c *CloudProvider) InstanceExistsByProviderID(providerID string) (bool, error) { + return false, errors.New("InstanceExistsByProviderID not imeplemented") +} + // Clusters not supported func (r *CloudProvider) Clusters() (cloudprovider.Clusters, bool) { return nil, false } +// HasClusterID returns true if the cluster has a clusterID +func (r *CloudProvider) HasClusterID() bool { + return true +} + // Routes not supported func (r *CloudProvider) Routes() (cloudprovider.Routes, bool) { return nil, false