Merge pull request #13121 from a-robinson/tags
Be more lenient when deriving the node tag from a node name on GCE
This commit is contained in:
		@@ -442,10 +442,15 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(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.
 | 
			
		||||
// to the base name. Older naming schemes put a hyphen and an incrementing index after
 | 
			
		||||
// the base name. Thus we pull off the characters after the final dash to support both.
 | 
			
		||||
func (gce *GCECloud) computeHostTag(host string) string {
 | 
			
		||||
	host = strings.SplitN(host, ".", 2)[0]
 | 
			
		||||
	return host[:len(host)-5]
 | 
			
		||||
	lastHyphen := strings.LastIndex(host, "-")
 | 
			
		||||
	if lastHyphen == -1 {
 | 
			
		||||
		return host
 | 
			
		||||
	}
 | 
			
		||||
	return host[:lastHyphen]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateTCPLoadBalancer is an implementation of TCPLoadBalancer.UpdateTCPLoadBalancer.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user