@@ -27,6 +27,7 @@ import (
2727 "github.com/google/go-cmp/cmp"
2828 . "github.com/onsi/gomega"
2929 "github.com/pkg/errors"
30+ "k8s.io/utils/pointer"
3031 infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
3132 "sigs.k8s.io/cluster-api-provider-azure/azure"
3233)
@@ -113,12 +114,13 @@ var (
113114 MinCount : to .Int32Ptr (1 ), // updates if changed
114115 Mode : containerservice .AgentPoolMode ("fake-mode" ), // updates if changed
115116 NodeLabels : map [string ]* string {"fake-label" : to .StringPtr ("fake-value" )}, // updates if changed
116- NodeTaints : & []string {"fake-taint" },
117- OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
117+ NodeTaints : & []string {"fake-taint" }, // updates if changed
118+ OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
118119 OsDiskSizeGB : to .Int32Ptr (2 ),
119120 OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
120121 OsType : containerservice .OSType ("fake-os-type" ),
121122 ProvisioningState : to .StringPtr ("Succeeded" ),
123+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
122124 Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
123125 VMSize : to .StringPtr ("fake-sku" ),
124126 VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
@@ -136,12 +138,13 @@ var (
136138 MinCount : to .Int32Ptr (1 ), // updates if changed
137139 Mode : containerservice .AgentPoolMode ("fake-mode" ), // updates if changed
138140 NodeLabels : map [string ]* string {"fake-label" : to .StringPtr ("fake-value" )}, // updates if changed
139- NodeTaints : & []string {"fake-taint" },
140- OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
141+ NodeTaints : & []string {"fake-taint" }, // updates if changed
142+ OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
141143 OsDiskSizeGB : to .Int32Ptr (2 ),
142144 OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
143145 OsType : containerservice .OSType ("fake-os-type" ),
144146 ProvisioningState : to .StringPtr ("Succeeded" ),
147+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
145148 Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
146149 VMSize : to .StringPtr ("fake-sku" ),
147150 VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
@@ -159,12 +162,13 @@ var (
159162 MinCount : to .Int32Ptr (3 ), // updates if changed
160163 Mode : containerservice .AgentPoolMode ("fake-mode" ), // updates if changed
161164 NodeLabels : map [string ]* string {"fake-label" : to .StringPtr ("fake-value" )}, // updates if changed
162- NodeTaints : & []string {"fake-taint" },
163- OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
165+ NodeTaints : & []string {"fake-taint" }, // updates if changed
166+ OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
164167 OsDiskSizeGB : to .Int32Ptr (2 ),
165168 OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
166169 OsType : containerservice .OSType ("fake-os-type" ),
167170 ProvisioningState : to .StringPtr ("Succeeded" ),
171+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
168172 Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
169173 VMSize : to .StringPtr ("fake-sku" ),
170174 VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
@@ -179,15 +183,16 @@ var (
179183 EnableUltraSSD : to .BoolPtr (true ),
180184 MaxCount : to .Int32Ptr (5 ), // updates if changed
181185 MaxPods : to .Int32Ptr (10 ),
182- MinCount : to .Int32Ptr (3 ), // updates if changed
186+ MinCount : to .Int32Ptr (1 ), // updates if changed
183187 Mode : containerservice .AgentPoolMode ("fake-old-mode" ), // updates if changed
184188 NodeLabels : map [string ]* string {"fake-label" : to .StringPtr ("fake-value" )}, // updates if changed
185- NodeTaints : & []string {"fake-taint" },
186- OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
189+ NodeTaints : & []string {"fake-taint" }, // updates if changed
190+ OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
187191 OsDiskSizeGB : to .Int32Ptr (2 ),
188192 OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
189193 OsType : containerservice .OSType ("fake-os-type" ),
190194 ProvisioningState : to .StringPtr ("Succeeded" ),
195+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
191196 Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
192197 VMSize : to .StringPtr ("fake-sku" ),
193198 VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
@@ -202,17 +207,42 @@ var (
202207 EnableUltraSSD : to .BoolPtr (true ),
203208 MaxCount : to .Int32Ptr (5 ), // updates if changed
204209 MaxPods : to .Int32Ptr (10 ),
205- MinCount : to .Int32Ptr (3 ), // updates if changed
210+ MinCount : to .Int32Ptr (1 ), // updates if changed
206211 Mode : containerservice .AgentPoolMode ("fake-old-mode" ), // updates if changed
207212 NodeLabels : map [string ]* string {
208213 "fake-label" : to .StringPtr ("fake-value" ),
209214 "fake-old-label" : to .StringPtr ("fake-old-value" )}, // updates if changed
210- NodeTaints : & []string {"fake-taint" },
215+ NodeTaints : & []string {"fake-taint" }, // updates if changed
211216 OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
212217 OsDiskSizeGB : to .Int32Ptr (2 ),
213218 OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
214219 OsType : containerservice .OSType ("fake-os-type" ),
215220 ProvisioningState : to .StringPtr ("Succeeded" ),
221+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
222+ Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
223+ VMSize : to .StringPtr ("fake-sku" ),
224+ VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
225+ },
226+ }
227+
228+ fakeAgentPoolNodeTaintsOutOfDate = containerservice.AgentPool {
229+ ManagedClusterAgentPoolProfileProperties : & containerservice.ManagedClusterAgentPoolProfileProperties {
230+ AvailabilityZones : & []string {"fake-zone" },
231+ Count : to .Int32Ptr (1 ), // updates if changed
232+ EnableAutoScaling : to .BoolPtr (true ), // updates if changed
233+ EnableUltraSSD : to .BoolPtr (true ),
234+ MaxCount : to .Int32Ptr (5 ), // updates if changed
235+ MaxPods : to .Int32Ptr (10 ),
236+ MinCount : to .Int32Ptr (1 ), // updates if changed
237+ Mode : containerservice .AgentPoolMode ("fake-mode" ), // updates if changed
238+ NodeLabels : map [string ]* string {"fake-label" : to .StringPtr ("fake-value" )}, // updates if changed
239+ NodeTaints : & []string {"fake-old-taint" }, // updates if changed
240+ OrchestratorVersion : to .StringPtr ("fake-version" ), // updates if changed
241+ OsDiskSizeGB : to .Int32Ptr (2 ),
242+ OsDiskType : containerservice .OSDiskType ("fake-os-disk-type" ),
243+ OsType : containerservice .OSType ("fake-os-type" ),
244+ ProvisioningState : to .StringPtr ("Succeeded" ),
245+ Tags : map [string ]* string {"fake" : pointer .String ("tag" )},
216246 Type : containerservice .AgentPoolTypeVirtualMachineScaleSets ,
217247 VMSize : to .StringPtr ("fake-sku" ),
218248 VnetSubnetID : to .StringPtr ("fake-vnet-subnet-id" ),
@@ -386,6 +416,13 @@ func TestParameters(t *testing.T) {
386416 expected : fakeAgentPoolWithProvisioningState ("" ),
387417 expectedError : nil ,
388418 },
419+ {
420+ name : "parameters with an existing agent pool and update needed on node taints" ,
421+ spec : fakeAgentPoolSpecWithAutoscaling ,
422+ existing : fakeAgentPoolNodeTaintsOutOfDate ,
423+ expected : fakeAgentPoolWithProvisioningState ("" ),
424+ expectedError : nil ,
425+ },
389426 {
390427 name : "scale to zero" ,
391428 spec : fakeAgentPoolSpecWithZeroReplicas ,
0 commit comments