Skip to content

Commit e3d7f13

Browse files
authored
Merge pull request #2083 from k8s-infra-cherrypick-robot/cherry-pick-1945-to-release-1.1
[release-1.1] Set max pods for the first time creation of ManagedControlplane (AKS) cluster
2 parents 666b798 + 89f8f34 commit e3d7f13

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

azure/scope/managedcontrolplane.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ func (s *ManagedControlPlaneScope) GetAgentPoolSpecs(ctx context.Context) ([]azu
499499
Replicas: 1,
500500
OSDiskSizeGB: 0,
501501
Mode: pool.Spec.Mode,
502+
MaxPods: pool.Spec.MaxPods,
502503
AvailabilityZones: pool.Spec.AvailabilityZones,
503504
}
504505

@@ -548,6 +549,7 @@ func (s *ManagedControlPlaneScope) AgentPoolSpec() azure.AgentPoolSpec {
548549
s.ControlPlane.Spec.VirtualNetwork.Subnet.Name,
549550
),
550551
Mode: s.InfraMachinePool.Spec.Mode,
552+
MaxPods: s.InfraMachinePool.Spec.MaxPods,
551553
AvailabilityZones: s.InfraMachinePool.Spec.AvailabilityZones,
552554
}
553555

@@ -561,10 +563,6 @@ func (s *ManagedControlPlaneScope) AgentPoolSpec() azure.AgentPoolSpec {
561563
agentPoolSpec.MinCount = s.InfraMachinePool.Spec.Scaling.MinSize
562564
}
563565

564-
if s.InfraMachinePool.Spec.MaxPods != nil {
565-
agentPoolSpec.MaxPods = s.InfraMachinePool.Spec.MaxPods
566-
}
567-
568566
return agentPoolSpec
569567
}
570568

azure/scope/managedcontrolplane_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func TestManagedControlPlaneScope_MaxPods(t *testing.T) {
202202
Expected: azure.AgentPoolSpec{
203203
Name: "pool1",
204204
SKU: "Standard_D2s_v3",
205-
Mode: "User",
205+
Mode: "System",
206206
Cluster: "cluster1",
207207
Replicas: 1,
208208
MaxPods: to.Int32Ptr(12),
@@ -221,6 +221,9 @@ func TestManagedControlPlaneScope_MaxPods(t *testing.T) {
221221
g.Expect(err).To(Succeed())
222222
agentPool := s.AgentPoolSpec()
223223
g.Expect(agentPool).To(Equal(c.Expected))
224+
agentPools, err := s.GetAgentPoolSpecs(context.TODO())
225+
g.Expect(err).To(Succeed())
226+
g.Expect(agentPools[0].MaxPods).To(Equal(c.Expected.MaxPods))
224227
})
225228
}
226229
}
@@ -259,7 +262,7 @@ func getAzureMachinePoolWithScaling(name string, min, max int32) *infrav1.AzureM
259262
}
260263

261264
func getAzureMachinePoolWithMaxPods(name string, maxPods int32) *infrav1.AzureManagedMachinePool {
262-
managedPool := getAzureMachinePool(name, infrav1.NodePoolModeUser)
265+
managedPool := getAzureMachinePool(name, infrav1.NodePoolModeSystem)
263266
managedPool.Spec.MaxPods = to.Int32Ptr(maxPods)
264267
return managedPool
265268
}

0 commit comments

Comments
 (0)