Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat: added a flag to enable/disable gvnic on a node pool #577

Merged
merged 2 commits into from Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -446,7 +446,9 @@ public static List<String> getDefaultServiceScopes() {

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}

/** Returns a builder for the default ChannelProvider for this service. */
Expand Down
Expand Up @@ -596,8 +596,12 @@ public final UnaryCallable<UpdateClusterRequest, Operation> updateClusterCallabl
* .setWorkloadMetadataConfig(WorkloadMetadataConfig.newBuilder().build())
* .setName("name3373707")
* .setUpgradeSettings(NodePool.UpgradeSettings.newBuilder().build())
* .setTags(NetworkTags.newBuilder().build())
* .setTaints(NodeTaints.newBuilder().build())
* .setLabels(NodeLabels.newBuilder().build())
* .setLinuxNodeConfig(LinuxNodeConfig.newBuilder().build())
* .setKubeletConfig(NodeKubeletConfig.newBuilder().build())
* .setGvnic(VirtualNIC.newBuilder().build())
* .build();
* Operation response = clusterManagerClient.updateNodePool(request);
* }
Expand Down Expand Up @@ -630,8 +634,12 @@ public final Operation updateNodePool(UpdateNodePoolRequest request) {
* .setWorkloadMetadataConfig(WorkloadMetadataConfig.newBuilder().build())
* .setName("name3373707")
* .setUpgradeSettings(NodePool.UpgradeSettings.newBuilder().build())
* .setTags(NetworkTags.newBuilder().build())
* .setTaints(NodeTaints.newBuilder().build())
* .setLabels(NodeLabels.newBuilder().build())
* .setLinuxNodeConfig(LinuxNodeConfig.newBuilder().build())
* .setKubeletConfig(NodeKubeletConfig.newBuilder().build())
* .setGvnic(VirtualNIC.newBuilder().build())
* .build();
* ApiFuture<Operation> future =
* clusterManagerClient.updateNodePoolCallable().futureCall(request);
Expand Down Expand Up @@ -2703,7 +2711,9 @@ public final UnaryCallable<CompleteIPRotationRequest, Operation> completeIPRotat

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all
* replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2731,7 +2741,9 @@ public final Operation setNodePoolSize(SetNodePoolSizeRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all
* replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
*
* <p>Sample code:
*
Expand Down
Expand Up @@ -456,7 +456,9 @@ public static List<String> getDefaultServiceScopes() {

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}

/** Returns a builder for the default ChannelProvider for this service. */
Expand Down
Expand Up @@ -28,6 +28,7 @@
import com.google.common.collect.Lists;
import com.google.container.v1beta1.AddonsConfig;
import com.google.container.v1beta1.AuthenticatorGroupsConfig;
import com.google.container.v1beta1.Autopilot;
import com.google.container.v1beta1.BinaryAuthorization;
import com.google.container.v1beta1.CancelOperationRequest;
import com.google.container.v1beta1.Cluster;
Expand All @@ -48,6 +49,7 @@
import com.google.container.v1beta1.GetOperationRequest;
import com.google.container.v1beta1.GetServerConfigRequest;
import com.google.container.v1beta1.IPAllocationPolicy;
import com.google.container.v1beta1.IdentityServiceConfig;
import com.google.container.v1beta1.Jwk;
import com.google.container.v1beta1.LegacyAbac;
import com.google.container.v1beta1.LinuxNodeConfig;
Expand All @@ -62,18 +64,25 @@
import com.google.container.v1beta1.ListUsableSubnetworksRequest;
import com.google.container.v1beta1.ListUsableSubnetworksResponse;
import com.google.container.v1beta1.Location;
import com.google.container.v1beta1.LoggingConfig;
import com.google.container.v1beta1.MaintenancePolicy;
import com.google.container.v1beta1.Master;
import com.google.container.v1beta1.MasterAuth;
import com.google.container.v1beta1.MasterAuthorizedNetworksConfig;
import com.google.container.v1beta1.MaxPodsConstraint;
import com.google.container.v1beta1.MonitoringConfig;
import com.google.container.v1beta1.NetworkConfig;
import com.google.container.v1beta1.NetworkPolicy;
import com.google.container.v1beta1.NetworkTags;
import com.google.container.v1beta1.NodeConfig;
import com.google.container.v1beta1.NodeKubeletConfig;
import com.google.container.v1beta1.NodeLabels;
import com.google.container.v1beta1.NodeManagement;
import com.google.container.v1beta1.NodeNetworkConfig;
import com.google.container.v1beta1.NodePool;
import com.google.container.v1beta1.NodePoolAutoscaling;
import com.google.container.v1beta1.NodePoolDefaults;
import com.google.container.v1beta1.NodeTaints;
import com.google.container.v1beta1.NotificationConfig;
import com.google.container.v1beta1.Operation;
import com.google.container.v1beta1.OperationProgress;
Expand Down Expand Up @@ -104,6 +113,9 @@
import com.google.container.v1beta1.UpdateNodePoolRequest;
import com.google.container.v1beta1.UsableSubnetwork;
import com.google.container.v1beta1.VerticalPodAutoscaling;
import com.google.container.v1beta1.VirtualNIC;
import com.google.container.v1beta1.WindowsVersions;
import com.google.container.v1beta1.WorkloadCertificates;
import com.google.container.v1beta1.WorkloadIdentityConfig;
import com.google.container.v1beta1.WorkloadMetadataConfig;
import com.google.protobuf.AbstractMessage;
Expand Down Expand Up @@ -244,10 +256,12 @@ public void getClusterTest() throws Exception {
.setShieldedNodes(ShieldedNodes.newBuilder().build())
.setReleaseChannel(ReleaseChannel.newBuilder().build())
.setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build())
.setWorkloadCertificates(WorkloadCertificates.newBuilder().build())
.setClusterTelemetry(ClusterTelemetry.newBuilder().build())
.setTpuConfig(TpuConfig.newBuilder().build())
.setNotificationConfig(NotificationConfig.newBuilder().build())
.setConfidentialNodes(ConfidentialNodes.newBuilder().build())
.setIdentityServiceConfig(IdentityServiceConfig.newBuilder().build())
.setSelfLink("selfLink1191800166")
.setZone("zone3744684")
.setEndpoint("endpoint1741102485")
Expand All @@ -267,6 +281,11 @@ public void getClusterTest() throws Exception {
.setDatabaseEncryption(DatabaseEncryption.newBuilder().build())
.addAllConditions(new ArrayList<StatusCondition>())
.setMaster(Master.newBuilder().build())
.setAutopilot(Autopilot.newBuilder().build())
.setId("id3355")
.setNodePoolDefaults(NodePoolDefaults.newBuilder().build())
.setLoggingConfig(LoggingConfig.newBuilder().build())
.setMonitoringConfig(MonitoringConfig.newBuilder().build())
.build();
mockClusterManager.addResponse(expectedResponse);

Expand Down Expand Up @@ -453,8 +472,12 @@ public void updateNodePoolTest() throws Exception {
.setWorkloadMetadataConfig(WorkloadMetadataConfig.newBuilder().build())
.setName("name3373707")
.setUpgradeSettings(NodePool.UpgradeSettings.newBuilder().build())
.setTags(NetworkTags.newBuilder().build())
.setTaints(NodeTaints.newBuilder().build())
.setLabels(NodeLabels.newBuilder().build())
.setLinuxNodeConfig(LinuxNodeConfig.newBuilder().build())
.setKubeletConfig(NodeKubeletConfig.newBuilder().build())
.setGvnic(VirtualNIC.newBuilder().build())
.build();

Operation actualResponse = client.updateNodePool(request);
Expand All @@ -475,8 +498,12 @@ public void updateNodePoolTest() throws Exception {
request.getWorkloadMetadataConfig(), actualRequest.getWorkloadMetadataConfig());
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertEquals(request.getUpgradeSettings(), actualRequest.getUpgradeSettings());
Assert.assertEquals(request.getTags(), actualRequest.getTags());
Assert.assertEquals(request.getTaints(), actualRequest.getTaints());
Assert.assertEquals(request.getLabels(), actualRequest.getLabels());
Assert.assertEquals(request.getLinuxNodeConfig(), actualRequest.getLinuxNodeConfig());
Assert.assertEquals(request.getKubeletConfig(), actualRequest.getKubeletConfig());
Assert.assertEquals(request.getGvnic(), actualRequest.getGvnic());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -501,8 +528,12 @@ public void updateNodePoolExceptionTest() throws Exception {
.setWorkloadMetadataConfig(WorkloadMetadataConfig.newBuilder().build())
.setName("name3373707")
.setUpgradeSettings(NodePool.UpgradeSettings.newBuilder().build())
.setTags(NetworkTags.newBuilder().build())
.setTaints(NodeTaints.newBuilder().build())
.setLabels(NodeLabels.newBuilder().build())
.setLinuxNodeConfig(LinuxNodeConfig.newBuilder().build())
.setKubeletConfig(NodeKubeletConfig.newBuilder().build())
.setGvnic(VirtualNIC.newBuilder().build())
.build();
client.updateNodePool(request);
Assert.fail("No exception raised");
Expand Down Expand Up @@ -1153,6 +1184,7 @@ public void getServerConfigTest() throws Exception {
.addAllValidImageTypes(new ArrayList<String>())
.addAllValidMasterVersions(new ArrayList<String>())
.addAllChannels(new ArrayList<ServerConfig.ReleaseChannelConfig>())
.putAllWindowsVersionMaps(new HashMap<String, WindowsVersions>())
.build();
mockClusterManager.addResponse(expectedResponse);

Expand Down Expand Up @@ -1277,6 +1309,7 @@ public void getNodePoolTest() throws Exception {
.setConfig(NodeConfig.newBuilder().build())
.setInitialNodeCount(1682564205)
.addAllLocations(new ArrayList<String>())
.setNetworkConfig(NodeNetworkConfig.newBuilder().build())
.setSelfLink("selfLink1191800166")
.setVersion("version351608024")
.addAllInstanceGroupUrls(new ArrayList<String>())
Expand Down
Expand Up @@ -2019,7 +2019,9 @@ public void completeIPRotation(
*
*
* <pre>
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be
* used for all replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
* </pre>
*/
public void setNodePoolSize(
Expand Down Expand Up @@ -2800,7 +2802,9 @@ public void completeIPRotation(
*
*
* <pre>
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be
* used for all replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
* </pre>
*/
public void setNodePoolSize(
Expand Down Expand Up @@ -3293,7 +3297,9 @@ public com.google.container.v1beta1.Operation completeIPRotation(
*
*
* <pre>
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be
* used for all replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
* </pre>
*/
public com.google.container.v1beta1.Operation setNodePoolSize(
Expand Down Expand Up @@ -3795,7 +3801,9 @@ protected ClusterManagerFutureStub build(
*
*
* <pre>
* Sets the size for a specific node pool.
* SetNodePoolSizeRequest sets the size of a node pool. The new size will be
* used for all replicas, including future replicas created by modifying
* [NodePool.locations][google.container.v1beta1.NodePool.locations].
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<
Expand Down