From f5f4b112f7b8a5d97127b91b859277fab99a6a59 Mon Sep 17 00:00:00 2001 From: "Alex, Lee" Date: Tue, 7 Jan 2025 07:00:18 +0900 Subject: [PATCH 1/3] feat(provider/google): Added new disks type for gce in clouddriver (#5914) Added new disks type for gce in clouddriver. currently, only can be used pd-standard and pd-ssd. Co-authored-by: Jason --- .../spinnaker/clouddriver/google/model/GoogleDiskType.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/model/GoogleDiskType.groovy b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/model/GoogleDiskType.groovy index 33e8292ffe..3aae196e36 100644 --- a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/model/GoogleDiskType.groovy +++ b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/model/GoogleDiskType.groovy @@ -18,6 +18,8 @@ package com.netflix.spinnaker.clouddriver.google.model public enum GoogleDiskType { PD_STANDARD("pd-standard", true), + PD_EXTREME("pd-extreme", true), + PD_BALANCED("pd-balanced", true), PD_SSD("pd-ssd", true), LOCAL_SSD("local-ssd", false), HYPERDISK_BALANCED("hyperdisk-balanced", true) From c0d1fe764e40e6112cf7f57d7b6594c3ebf48136 Mon Sep 17 00:00:00 2001 From: spinnakerbot Date: Thu, 9 Jan 2025 14:15:03 -0500 Subject: [PATCH 2/3] chore(dependencies): Autobump korkVersion (#6332) Co-authored-by: root --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c711270635..a7347fb617 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -korkVersion=7.247.0 +korkVersion=7.248.0 fiatVersion=1.53.0 org.gradle.parallel=true spinnakerGradleVersion=8.32.1 From fcc539444103a567400eed1b1466164a08bb910d Mon Sep 17 00:00:00 2001 From: Edgar Garcia <63310723+edgarulg@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:22:16 -0600 Subject: [PATCH 3/3] fix(google): Add partner metadata on instanceTemplate properties (#6334) * fix(google): include partnerMetadata in InstanceTemplates * fix(google): remove default view and add tests * fix(google): format comment * fix(google): remove unused imports * fix(google): make FULL the default view in instanceTemplate client --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../google/compute/InstanceTemplates.java | 8 ++- .../google/compute/InstanceTemplatesTest.java | 64 +++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/clouddriver-google/src/main/java/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplates.java b/clouddriver-google/src/main/java/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplates.java index c1f3c26593..518e2bb3fd 100644 --- a/clouddriver-google/src/main/java/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplates.java +++ b/clouddriver-google/src/main/java/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplates.java @@ -29,6 +29,8 @@ public class InstanceTemplates { private final Compute.InstanceTemplates computeApi; private final GoogleNamedAccountCredentials credentials; private final GlobalGoogleComputeRequestFactory requestFactory; + private static final String defaultView = + "FULL"; // https://cloud.google.com/sdk/gcloud/reference/beta/compute/instance-templates/list InstanceTemplates( GoogleNamedAccountCredentials credentials, @@ -65,7 +67,11 @@ public PaginatedComputeRequest return new PaginatedComputeRequestImpl<>( pageToken -> requestFactory.wrapRequest( - computeApi.list(credentials.getProject()).setPageToken(pageToken), "list"), + computeApi + .list(credentials.getProject()) + .setPageToken(pageToken) + .setView(defaultView), + "list"), InstanceTemplateList::getNextPageToken, InstanceTemplateList::getItems); } diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplatesTest.java b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplatesTest.java index 1f1550737e..372b680b5f 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplatesTest.java +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/compute/InstanceTemplatesTest.java @@ -25,6 +25,7 @@ import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.services.compute.Compute; import com.google.api.services.compute.model.InstanceTemplate; +import com.google.common.collect.ImmutableList; import com.netflix.spectator.api.BasicTag; import com.netflix.spectator.api.DefaultRegistry; import com.netflix.spectator.api.NoopRegistry; @@ -190,6 +191,69 @@ public void get_errorMetrics() { assertThat(timer.totalTime()).isEqualTo(CLOCK_STEP_TIME_NS); } + @Test + public void list_success() throws IOException { + + MockHttpTransport transport = + new MockHttpTransport.Builder() + .setLowLevelHttpResponse( + new MockLowLevelHttpResponse() + .setStatusCode(200) + .addHeader("Content-Type", "application/json") + .setContent( + "{\"items\": [{\"name\": \"template1\"}, {\"name\": \"template2\"}], \"nextPageToken\": \"\"}")) + .build(); + + InstanceTemplates instanceTemplates = createInstanceTemplates(transport); + + PaginatedComputeRequest request = + instanceTemplates.list(); + + ImmutableList response = request.execute(); + assertThat(response).hasSize(2); + assertThat(response.get(0).getName()).isEqualTo("template1"); + assertThat(response.get(1).getName()).isEqualTo("template2"); + } + + @Test + public void list_noResults() throws IOException { + + MockHttpTransport transport = + new MockHttpTransport.Builder() + .setLowLevelHttpResponse( + new MockLowLevelHttpResponse() + .setStatusCode(200) + .setContent("{\"items\": [], \"nextPageToken\": \"\"}")) + .build(); + + InstanceTemplates instanceTemplates = createInstanceTemplates(transport); + + PaginatedComputeRequest request = + instanceTemplates.list(); + + ImmutableList response = request.execute(); + assertThat(response).isEmpty(); + } + + @Test + public void list_errorResponse() { + + MockHttpTransport transport = + new MockHttpTransport.Builder() + .setLowLevelHttpResponse( + new MockLowLevelHttpResponse() + .setStatusCode(500) + .setContent("{\"error\": \"Internal Server Error\"}")) + .build(); + + InstanceTemplates instanceTemplates = createInstanceTemplates(transport); + + PaginatedComputeRequest request = + instanceTemplates.list(); + + assertThatIOException().isThrownBy(() -> request.execute()); + } + private static InstanceTemplates createInstanceTemplates(HttpTransport transport) { return createInstanceTemplates(transport, new NoopRegistry()); }