Skip to content

Commit 7d21e0a

Browse files
mgmt aks, support beginCreateAgentPool (Azure#30646)
* draft, support beginCreateAgentPool * update comments * fix session records * fix changelog * add AgentPoolDataImpl * make AgentPoolDataImpl package private, fix checkstyle Co-authored-by: Weidong Xu <[email protected]>
1 parent a3fa84c commit 7d21e0a

File tree

9 files changed

+1459
-1
lines changed

9 files changed

+1459
-1
lines changed

sdk/resourcemanager/azure-resourcemanager-containerservice/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 2.18.0-beta.1 (Unreleased)
44

5+
### Features Added
6+
7+
- Supported `beginCreateAgentPool` in `KubernetesCluster`.
8+
59
### Other Changes
610

711
- Deprecated method `KubernetesClusters.listKubernetesVersions`. Use `KubernetesClusters.listOrchestrators`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.resourcemanager.containerservice.implementation;
5+
6+
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
7+
import com.azure.resourcemanager.containerservice.models.AgentPoolData;
8+
9+
/**
10+
* AgentPool implementation that exposes AgentPoolInner as constructor arguments.
11+
*/
12+
class AgentPoolDataImpl extends AgentPoolData {
13+
/**
14+
* Creates an instance of agent pool data.
15+
*
16+
* @param innerModel the inner model of agent pool.
17+
*/
18+
AgentPoolDataImpl(AgentPoolInner innerModel) {
19+
super(innerModel);
20+
}
21+
}

sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/KubernetesClusterImpl.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
import com.azure.core.http.rest.Response;
99
import com.azure.core.http.rest.SimpleResponse;
1010
import com.azure.core.management.serializer.SerializerFactory;
11+
import com.azure.core.util.Context;
1112
import com.azure.core.util.CoreUtils;
1213
import com.azure.core.util.logging.ClientLogger;
1314
import com.azure.core.util.serializer.SerializerAdapter;
1415
import com.azure.core.util.serializer.SerializerEncoding;
1516
import com.azure.resourcemanager.containerservice.ContainerServiceManager;
17+
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
1618
import com.azure.resourcemanager.containerservice.fluent.models.ManagedClusterInner;
1719
import com.azure.resourcemanager.containerservice.fluent.models.PrivateEndpointConnectionInner;
1820
import com.azure.resourcemanager.containerservice.fluent.models.PrivateLinkResourceInner;
21+
import com.azure.resourcemanager.containerservice.models.AgentPool;
22+
import com.azure.resourcemanager.containerservice.models.AgentPoolData;
1923
import com.azure.resourcemanager.containerservice.models.ContainerServiceLinuxProfile;
2024
import com.azure.resourcemanager.containerservice.models.ContainerServiceNetworkProfile;
2125
import com.azure.resourcemanager.containerservice.models.ContainerServiceSshConfiguration;
@@ -39,6 +43,8 @@
3943
import com.azure.resourcemanager.resources.fluentcore.arm.models.PrivateEndpointConnectionProvisioningState;
4044
import com.azure.resourcemanager.resources.fluentcore.arm.models.PrivateLinkResource;
4145
import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.GroupableResourceImpl;
46+
import com.azure.resourcemanager.resources.fluentcore.model.Accepted;
47+
import com.azure.resourcemanager.resources.fluentcore.model.implementation.AcceptedImpl;
4248
import com.azure.resourcemanager.resources.fluentcore.utils.PagedConverter;
4349
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
4450
import reactor.core.publisher.Mono;
@@ -297,6 +303,21 @@ public Mono<Void> stopAsync() {
297303
return manager().kubernetesClusters().stopAsync(this.resourceGroupName(), this.name());
298304
}
299305

306+
@Override
307+
public Accepted<AgentPool> beginCreateAgentPool(String agentPoolName, AgentPoolData agentPool) {
308+
return AcceptedImpl.newAccepted(
309+
logger,
310+
this.manager().serviceClient().getHttpPipeline(),
311+
this.manager().serviceClient().getDefaultPollInterval(),
312+
() -> this.manager().serviceClient().getAgentPools()
313+
.createOrUpdateWithResponseAsync(resourceGroupName(), name(), agentPoolName, agentPool.innerModel())
314+
.block(),
315+
AgentPoolDataImpl::new,
316+
AgentPoolInner.class,
317+
null,
318+
Context.NONE);
319+
}
320+
300321
@Override
301322
protected Mono<ManagedClusterInner> getInnerAsync() {
302323
return this
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.resourcemanager.containerservice.models;
5+
6+
import com.azure.resourcemanager.resources.fluentcore.arm.models.HasName;
7+
8+
import java.util.List;
9+
import java.util.Map;
10+
11+
/**
12+
* A client-side representation for an agent pool.
13+
*/
14+
public interface AgentPool extends HasName {
15+
16+
/** @return the provisioning state of the agent pool */
17+
String provisioningState();
18+
19+
/** @return the number of agents (virtual machines) to host docker containers */
20+
int count();
21+
22+
/** @return size of each agent virtual machine in the agent pool */
23+
ContainerServiceVMSizeTypes vmSize();
24+
25+
/** @return OS disk size in GB set for each virtual machine in the agent pool */
26+
int osDiskSizeInGB();
27+
28+
/** @return OS of each virtual machine in the agent pool */
29+
OSType osType();
30+
31+
/** @return agent pool type */
32+
AgentPoolType type();
33+
34+
/** @return agent pool mode */
35+
AgentPoolMode mode();
36+
37+
/** @return the name of the subnet used by each virtual machine in the agent pool */
38+
String subnetName();
39+
40+
/** @return the ID of the virtual network used by each virtual machine in the agent pool */
41+
String networkId();
42+
43+
/** @return the list of availability zones */
44+
List<String> availabilityZones();
45+
46+
/** @return the map of node labels */
47+
Map<String, String> nodeLabels();
48+
49+
/** @return the list of node taints */
50+
List<String> nodeTaints();
51+
52+
/** @return the power state, Running or Stopped */
53+
PowerState powerState();
54+
55+
/** @return the number of agents (VMs) to host docker containers */
56+
int nodeSize();
57+
58+
/** @return the maximum number of pods per node */
59+
int maximumPodsPerNode();
60+
61+
/** @return whether auto-scaling is enabled */
62+
boolean isAutoScalingEnabled();
63+
64+
/** @return the minimum number of nodes for auto-scaling */
65+
int minimumNodeSize();
66+
67+
/** @return the maximum number of nodes for auto-scaling */
68+
int maximumNodeSize();
69+
70+
/** @return the priority of each virtual machines in the agent pool */
71+
ScaleSetPriority virtualMachinePriority();
72+
73+
/** @return the eviction policy of each virtual machines in the agent pool */
74+
ScaleSetEvictionPolicy virtualMachineEvictionPolicy();
75+
76+
/** @return the maximum price of each spot virtual machines in the agent pool, -1 means pay-as-you-go prices */
77+
Double virtualMachineMaximumPrice();
78+
79+
/**
80+
* @return the OS disk type to be used for machines in the agent pool
81+
*/
82+
OSDiskType osDiskType();
83+
84+
/**
85+
* @return the disk type for the placement of emptyDir volumes, container runtime data root,
86+
* and Kubelet ephemeral storage
87+
*/
88+
KubeletDiskType kubeletDiskType();
89+
90+
/**
91+
* @return the tags of the agents.
92+
*/
93+
Map<String, String> tags();
94+
}

0 commit comments

Comments
 (0)