diff --git a/pkg/cloudprovider/gce/gce.go b/pkg/cloudprovider/gce/gce.go index 1dff071b082..e4d7f5fa707 100644 --- a/pkg/cloudprovider/gce/gce.go +++ b/pkg/cloudprovider/gce/gce.go @@ -456,6 +456,7 @@ func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, externalIP net.I // This is kind of hacky, but the managed instance group adds 4 random chars and a hyphen // to the base name. func (gce *GCECloud) computeHostTag(host string) string { + host = strings.SplitN(host, ".", 2)[0] return host[:len(host)-5] } diff --git a/pkg/cloudprovider/gce/gce_test.go b/pkg/cloudprovider/gce/gce_test.go index bc2ae1a4a5c..3f916848135 100644 --- a/pkg/cloudprovider/gce/gce_test.go +++ b/pkg/cloudprovider/gce/gce_test.go @@ -50,6 +50,10 @@ func TestGetHostTag(t *testing.T) { host: "gke-test-ea6e8c80-node-8ytk", expected: "gke-test-ea6e8c80-node", }, + { + host: "kubernetes-minion-559o.c.PROJECT_NAME.internal", + expected: "kubernetes-minion", + }, } gce := &GCECloud{}