Change:
This is required to make Cloud Controller Manager operational on the various clouds that Kubernetes runs on. We have already PRs for the following clouds: GCE - AWS - Azure - OpenStack - The following clouds still need to be addresses: CloudStack Mesos OVirt Photon Rackspace vSphere If anyone is interested in contributing to this effort, please ping me directly (on kubernetes slack or through email)
There are no sig labels on this issue. Please by:<br(1) mentioning a sig: <br(2) specifying the label manually: <br<brNote: method (1) will trigger a notification to the team. You can find the team list and label list
/sig cluster-lifecycle
cc:
I will take care of the vSphere and Photon.
I will take care of the Rackspace.
Merging for OpenStack
Reposting I am trying to use my custom out-of-tree cloud provider with Kubernetes. But I noticed that kubelet calls apis like with empty for cloud provider. Digging in the code for 1.7 branch, I see that is null for cloud-providers. As a result returns empty string. As a result, ByID() methods don't work for cloud providers since is not set.
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. Prevent issues from auto-closing with an comment. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
Stale issues rot after 30d of inactivity. Mark the issue as fresh with . Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle rotten /remove-lifecycle stale
Rotten issues close after 30d of inactivity. Reopen the issue with . Mark the issue as fresh with . Send feedback to sig-testing, kubernetes/test-infra and/or . /close

Discussion:
package azure import ( <del> "errors" </del> "fmt" "k8s.io/kubernetes/pkg/api/v1"

// This method will not be called from the node that is requesting this ID. i.e. metadata service // and other local methods cannot be used here func (az *Cloud) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error) { <del> return []v1.NodeAddress{}, errors.New("unimplemented") </del> <ins> name, err := splitProviderID(providerID) if err != nil { return nil, err } return az.NodeAddresses(name) </ins> } // ExternalID returns the cloud provider ID of the specified instance (deprecated).

// This method will not be called from the node that is requesting this ID. i.e. metadata service // and other local methods cannot be used here func (az *Cloud) InstanceTypeByProviderID(providerID string) (string, error) { <del> return "", errors.New("unimplemented") </del> <ins> name, err := splitProviderID(providerID) if err != nil { return "", err } return az.InstanceID(name) </ins> } // InstanceType returns the type of the specified instance.

t.Error("got incorrect fault domain") } } <ins> func TestSplitProviderID(t *testing.T) { providers := []struct { providerID string name       types.NodeName fail bool }{ { providerID: CloudProviderName + ":///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/k8s-agent-AAAAAAAA-0", name:       "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/k8s-agent-AAAAAAAA-0", fail:       false, }, { providerID: CloudProviderName + ":/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/k8s-agent-AAAAAAAA-0", name:       "", fail:       true, }, { providerID: CloudProviderName + "://", name:       "", fail:       true, }, { providerID: ":///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/k8s-agent-AAAAAAAA-0", name:       "", fail:       true, }, { providerID: "aws:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/k8s-agent-AAAAAAAA-0", name:       "", fail:       true, }, } for _, test := range providers { name, err := splitProviderID(test.providerID) if (err != nil) != test.fail { t.Errorf("Expected to failt=%t, with pattern %v", test.fail, test) } if test.fail { continue } if name != test.name { t.Errorf("Expected %v, but got %v", test.name, name) } } } </ins>

package azure import ( <ins> "errors" </ins> "fmt" <ins> "regexp" </ins> "strings" "k8s.io/kubernetes/pkg/api/v1"

securityRuleIDTemplate      = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s/securityRules/%s" ) <ins> var providerIDRE = regexp.MustCompile(`^` + CloudProviderName + `://(.+)$`) </ins> // returns the full identifier of a machine func (az *Cloud) getMachineID(machineName string) string { return fmt.Sprintf(

targetIP := *ipConfig.PrivateIPAddress return targetIP, nil } <ins> // splitProviderID converts a providerID to a NodeName. func splitProviderID(providerID string) (types.NodeName, error) { matches := providerIDRE.FindStringSubmatch(providerID) if len(matches) != 2 { return "", errors.New("error splitting providerID") } return types.NodeName(matches[1]), nil } </ins>