mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Merge pull request #12438 from derekparker/handle-fqdn-gce
Handle full hostname when computing host tag on GCE
This commit is contained in:
commit
1f3c322ded
@ -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
|
// This is kind of hacky, but the managed instance group adds 4 random chars and a hyphen
|
||||||
// to the base name.
|
// to the base name.
|
||||||
func (gce *GCECloud) computeHostTag(host string) string {
|
func (gce *GCECloud) computeHostTag(host string) string {
|
||||||
|
host = strings.SplitN(host, ".", 2)[0]
|
||||||
return host[:len(host)-5]
|
return host[:len(host)-5]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,10 @@ func TestGetHostTag(t *testing.T) {
|
|||||||
host: "gke-test-ea6e8c80-node-8ytk",
|
host: "gke-test-ea6e8c80-node-8ytk",
|
||||||
expected: "gke-test-ea6e8c80-node",
|
expected: "gke-test-ea6e8c80-node",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
host: "kubernetes-minion-559o.c.PROJECT_NAME.internal",
|
||||||
|
expected: "kubernetes-minion",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gce := &GCECloud{}
|
gce := &GCECloud{}
|
||||||
|
Loading…
Reference in New Issue
Block a user