From cdebf96b0e3a04ad9abb240de36a15a34a77f9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Louren=C3=A7o?= Date: Fri, 11 Oct 2024 09:33:23 +0200 Subject: [PATCH] fingerprint gce: collect preemptibility --- .changelog/24169.txt | 3 +++ client/fingerprint/env_gce.go | 1 + client/fingerprint/env_gce_test.go | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 .changelog/24169.txt diff --git a/.changelog/24169.txt b/.changelog/24169.txt new file mode 100644 index 00000000000..3f43a4a3d83 --- /dev/null +++ b/.changelog/24169.txt @@ -0,0 +1,3 @@ +```release-note:improvement +fingerprint gce: fingerprint preemptibility +``` diff --git a/client/fingerprint/env_gce.go b/client/fingerprint/env_gce.go index 108fbde9365..7d773c6bb5e 100644 --- a/client/fingerprint/env_gce.go +++ b/client/fingerprint/env_gce.go @@ -160,6 +160,7 @@ func (f *EnvGCEFingerprint) Fingerprint(req *FingerprintRequest, resp *Fingerpri "cpu-platform": false, "scheduling/automatic-restart": false, "scheduling/on-host-maintenance": false, + "scheduling/preemptible": false, } for k, unique := range keys { diff --git a/client/fingerprint/env_gce_test.go b/client/fingerprint/env_gce_test.go index 7277ad0b46c..b04169bd5c7 100644 --- a/client/fingerprint/env_gce_test.go +++ b/client/fingerprint/env_gce_test.go @@ -148,6 +148,7 @@ func testFingerprint_GCE(t *testing.T, withExternalIp bool) { assertNodeAttributeEquals(t, response.Attributes, "platform.gce.scheduling.automatic-restart", "TRUE") assertNodeAttributeEquals(t, response.Attributes, "platform.gce.scheduling.on-host-maintenance", "MIGRATE") + assertNodeAttributeEquals(t, response.Attributes, "platform.gce.scheduling.preemptible", "FALSE") assertNodeAttributeEquals(t, response.Attributes, "platform.gce.cpu-platform", "Intel Ivy Bridge") assertNodeAttributeEquals(t, response.Attributes, "platform.gce.tag.abc", "true") assertNodeAttributeEquals(t, response.Attributes, "platform.gce.tag.def", "true") @@ -200,6 +201,11 @@ const GCE_routes = ` "content-type": "text/plain", "body": "MIGRATE" }, + { + "uri": "/computeMetadata/v1/instance/scheduling/preemptible", + "content-type": "text/plain", + "body": "FALSE" + }, { "uri": "/computeMetadata/v1/instance/cpu-platform", "content-type": "text/plain",