mirror of https://github.com/k3s-io/k3s
Merge pull request #58078 from dims/better-check-for-gce-vm
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Better check for GCE VM **What this PR does / why we need it**: we should do what is being done in GoogleCloudPlatform/google-cloud-go: https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/compute/metadata/metadata.go#L259-L267 Looks like folks are reusing appliances which end up with ``` $ cat /sys/class/dmi/id/product_name Google Search Appliance ``` **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #57760 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/6/head
commit
fdfa5e47f4
|
@ -39,7 +39,6 @@ const (
|
||||||
metadataEmail = metadataUrl + "instance/service-accounts/default/email"
|
metadataEmail = metadataUrl + "instance/service-accounts/default/email"
|
||||||
storageScopePrefix = "https://www.googleapis.com/auth/devstorage"
|
storageScopePrefix = "https://www.googleapis.com/auth/devstorage"
|
||||||
cloudPlatformScopePrefix = "https://www.googleapis.com/auth/cloud-platform"
|
cloudPlatformScopePrefix = "https://www.googleapis.com/auth/cloud-platform"
|
||||||
googleProductName = "Google"
|
|
||||||
defaultServiceAccount = "default/"
|
defaultServiceAccount = "default/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -121,7 +120,8 @@ func onGCEVM() bool {
|
||||||
glog.V(2).Infof("Error while reading product_name: %v", err)
|
glog.V(2).Infof("Error while reading product_name: %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return strings.Contains(string(data), googleProductName)
|
name := strings.TrimSpace(string(data))
|
||||||
|
return name == "Google" || name == "Google Compute Engine"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enabled implements DockerConfigProvider for all of the Google implementations.
|
// Enabled implements DockerConfigProvider for all of the Google implementations.
|
||||||
|
|
Loading…
Reference in New Issue