Skip to content

Commit 19e7cb6

Browse files
committed
fix: MaxPods is an optional AzureManagedMachinePool configuration
1 parent a20197f commit 19e7cb6

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

exp/api/v1beta1/azuremanagedmachinepool_webhook.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ func (r *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client)
193193
}
194194

195195
func (r *AzureManagedMachinePool) validateMaxPods() error {
196-
if to.Int32(r.Spec.MaxPods) < 10 || to.Int32(r.Spec.MaxPods) > 250 {
197-
return errors.New("MaxPods must be between 10 and 250")
196+
if r.Spec.MaxPods != nil {
197+
if to.Int32(r.Spec.MaxPods) < 10 || to.Int32(r.Spec.MaxPods) > 250 {
198+
return errors.New("MaxPods must be between 10 and 250")
199+
}
198200
}
199201

200202
return nil

exp/api/v1beta1/azuremanagedmachinepool_webhook_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) {
257257
},
258258
wantErr: false,
259259
},
260+
{
261+
name: "valid - optional configuration not present",
262+
ammp: &AzureManagedMachinePool{
263+
Spec: AzureManagedMachinePoolSpec{},
264+
},
265+
wantErr: false,
266+
},
260267
{
261268
name: "too many MaxPods",
262269
ammp: &AzureManagedMachinePool{

templates/test/ci/cluster-template-prow-aks-multi-tenancy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ metadata:
101101
name: agentpool1
102102
namespace: default
103103
spec:
104-
maxPods: 24
105104
mode: User
106105
osDiskSizeGB: 1024
107106
sku: ${AZURE_NODE_MACHINE_TYPE}

templates/test/ci/prow-aks-multi-tenancy/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ resources:
66
patchesStrategicMerge:
77
- ../patches/tags-aks.yaml
88
- patches/maxpods-aks-agentpool0.yaml
9-
- patches/maxpods-aks-agentpool1.yaml

templates/test/ci/prow-aks-multi-tenancy/patches/maxpods-aks-agentpool1.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)