diff --git a/pkg/cloudprovider/providers/gce/gce.go b/pkg/cloudprovider/providers/gce/gce.go index fc6f584aaed..9c5da0cfec4 100644 --- a/pkg/cloudprovider/providers/gce/gce.go +++ b/pkg/cloudprovider/providers/gce/gce.go @@ -303,7 +303,11 @@ func generateCloudConfig(configFile *ConfigFile) (cloudConfig *CloudConfig, err // If no tokenSource is specified, uses oauth2.DefaultTokenSource. // If managedZones is nil / empty all zones in the region will be managed. func CreateGCECloud(config *CloudConfig) (*GCECloud, error) { + // Remove any pre-release version and build metadata from the semver, leaving only the MAJOR.MINOR.PATCH portion. + // See http://semver.org/. version := strings.Split(strings.Split(version.Get().GitVersion, "-")[0], "+")[0] + + // Create a user-agent header append string to supply to the Google API clients, to identify Kubernetes as the origin of the GCP API calls. userAgent := fmt.Sprintf("(%s %s) Kubernetes/%s", runtime.GOOS, runtime.GOARCH, version) client, err := newOauthClient(config.TokenSource)