Change:
Is this a BUG REPORT or FEATURE REQUEST?: As part of the initiative for external cloud providers (), we GetZoneByProviderID and GetZoneByNodeName. See for more details. The previous PR did not actually implement those methods for existing cloud providers in . These methods should be implemented by all cloud providers in the future. cc
Could someone add the label and the label for this issue please?
/sig cluster-lifecycle
/area cloudprovider
/assign wlan0
cc We need the following label - help-wanted and add it to the 1.8(?) milestone cc to implement it for their respective clouds.
I'll try to have a look by the end of the week.
Ok, I will take care of the Rackspace and OpenStack.
Thank you !
- Is there any listing where to see the already implemented cloud provider ?
No providers have this yet. Current PRs: Openstack: Rackspace: Please contribute if you have something ready :)
Sorry for the delay guys :)
Have you implemented them for gce?
Intending to work on it tonight, but if you have something I can work on azure
Yes, I have prepared for GCE.
Azure .
Cool, than you all! Any other providers we should implement this for in time for v1.8?
I'll take a look tomorrow to see if there's something left
Let's see which providers are left before closing this...
- I guess this one should be closed ?
If you say that all providers have this now, thanks, great!

Discussion:
computealpha "google.golang.org/api/compute/v0.alpha" computebeta "google.golang.org/api/compute/v0.beta" computev1 "google.golang.org/api/compute/v1" <ins> "k8s.io/kubernetes/pkg/cloudprovider" </ins> ) func TestReadConfigFile(t *testing.T) {

for _, test := range providers { project, zone, instance, err := splitProviderID(test.providerID) if (err != nil) != test.fail { <del> t.Errorf("Expected to failt=%t, with pattern %v", test.fail, test) </del> <ins> t.Errorf("Expected to fail=%t, with pattern %v", test.fail, test) </ins> } if test.fail {

} } <ins> func TestGetZoneByProviderID(t *testing.T) { tests := []struct { providerID string expectedZone cloudprovider.Zone fail        bool description string }{ { providerID:   ProviderName + "://project-example-164317/us-central1-f/kubernetes-node-fhx1", expectedZone: cloudprovider.Zone{FailureDomain: "us-central1-f", Region: "us-central1"}, fail:         false, description:  "standard gce providerID", }, { providerID:   ProviderName + "://project-example-164317/us-central1-f/kubernetes-node-fhx1/", expectedZone: cloudprovider.Zone{}, fail:         true, description:  "too many slashes('/') trailing", }, { providerID:   ProviderName + "://project-example.164317//kubernetes-node-fhx1", expectedZone: cloudprovider.Zone{}, fail:         true, description:  "too many slashes('/') embedded", }, { providerID:   ProviderName + "://project-example-164317/uscentral1f/kubernetes-node-fhx1", expectedZone: cloudprovider.Zone{}, fail:         true, description:  "invalid name of the GCE zone", }, } gce := &GCECloud{ localZone: "us-central1-f", region:    "us-central1", } for _, test := range tests { zone, err := gce.GetZoneByProviderID(test.providerID) if (err != nil) != test.fail { t.Errorf("Expected to fail=%t, provider ID %v, tests %s", test.fail, test, test.description) } if test.fail { continue } if zone != test.expectedZone { t.Errorf("Expected %v, but got %v", test.expectedZone, zone) } } } </ins> func TestGenerateCloudConfigs(t *testing.T) { configBoilerplate := ConfigGlobal{ TokenURL:           "",

package gce import ( <del> "errors" </del> "fmt" "strings"

// This is particularly useful in external cloud providers where the kubelet // does not initialize node data. func (gce *GCECloud) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error) { <del> return cloudprovider.Zone{}, errors.New("GetZoneByProviderID not implemented") </del> <ins> _, zone, _, err := splitProviderID(providerID) if err != nil { return cloudprovider.Zone{}, err } region, err := GetGCERegion(zone) if err != nil { return cloudprovider.Zone{}, err } return cloudprovider.Zone{FailureDomain: zone, Region: region}, nil </ins> } // GetZoneByNodeName implements Zones.GetZoneByNodeName // This is particularly useful in external cloud providers where the kubelet // does not initialize node data. func (gce *GCECloud) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error) { <del> return cloudprovider.Zone{}, errors.New("GetZoneByNodeName not imeplemented") </del> <ins> instanceName := mapNodeNameToInstanceName(nodeName) instance, err := gce.getInstanceByName(instanceName) if err != nil { return cloudprovider.Zone{}, err } region, err := GetGCERegion(instance.Zone) if err != nil { return cloudprovider.Zone{}, err } return cloudprovider.Zone{FailureDomain: instance.Zone, Region: region}, nil </ins> } // ListZonesInRegion returns all zones in a GCP region