Skip to content

Commit

Permalink
preserve user-supplied ASO spec values
Browse files Browse the repository at this point in the history
  • Loading branch information
nojnhuh committed Oct 11, 2023
1 parent d2abb44 commit 051b4e5
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 99 deletions.
67 changes: 33 additions & 34 deletions azure/services/agentpools/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,36 +171,35 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing *asocontainerse
agentPool = &asocontainerservicev1.ManagedClustersAgentPool{}
}

agentPool.Spec = asocontainerservicev1.ManagedClusters_AgentPool_Spec{
AzureName: s.AzureName,
Owner: &genruntime.KnownResourceReference{
Name: s.Cluster,
},
AvailabilityZones: s.AvailabilityZones,
Count: &s.Replicas,
EnableAutoScaling: ptr.To(s.EnableAutoScaling),
EnableUltraSSD: s.EnableUltraSSD,
KubeletDiskType: azure.AliasOrNil[asocontainerservicev1.KubeletDiskType]((*string)(s.KubeletDiskType)),
MaxCount: s.MaxCount,
MaxPods: s.MaxPods,
MinCount: s.MinCount,
Mode: ptr.To(asocontainerservicev1.AgentPoolMode(s.Mode)),
NodeLabels: s.NodeLabels,
NodeTaints: s.NodeTaints,
OrchestratorVersion: s.Version,
OsDiskSizeGB: ptr.To(asocontainerservicev1.ContainerServiceOSDisk(s.OSDiskSizeGB)),
OsDiskType: azure.AliasOrNil[asocontainerservicev1.OSDiskType](s.OsDiskType),
OsType: azure.AliasOrNil[asocontainerservicev1.OSType](s.OSType),
ScaleSetPriority: azure.AliasOrNil[asocontainerservicev1.ScaleSetPriority](s.ScaleSetPriority),
ScaleDownMode: azure.AliasOrNil[asocontainerservicev1.ScaleDownMode](s.ScaleDownMode),
Type: ptr.To(asocontainerservicev1.AgentPoolType_VirtualMachineScaleSets),
EnableNodePublicIP: s.EnableNodePublicIP,
Tags: s.AdditionalTags,
EnableFIPS: s.EnableFIPS,
spec := &agentPool.Spec
spec.AzureName = s.AzureName
spec.Owner = &genruntime.KnownResourceReference{
Name: s.Cluster,
}
spec.AvailabilityZones = s.AvailabilityZones
spec.Count = &s.Replicas
spec.EnableAutoScaling = ptr.To(s.EnableAutoScaling)
spec.EnableUltraSSD = s.EnableUltraSSD
spec.KubeletDiskType = azure.AliasOrNil[asocontainerservicev1.KubeletDiskType]((*string)(s.KubeletDiskType))
spec.MaxCount = s.MaxCount
spec.MaxPods = s.MaxPods
spec.MinCount = s.MinCount
spec.Mode = ptr.To(asocontainerservicev1.AgentPoolMode(s.Mode))
spec.NodeLabels = s.NodeLabels
spec.NodeTaints = s.NodeTaints
spec.OrchestratorVersion = s.Version
spec.OsDiskSizeGB = ptr.To(asocontainerservicev1.ContainerServiceOSDisk(s.OSDiskSizeGB))
spec.OsDiskType = azure.AliasOrNil[asocontainerservicev1.OSDiskType](s.OsDiskType)
spec.OsType = azure.AliasOrNil[asocontainerservicev1.OSType](s.OSType)
spec.ScaleSetPriority = azure.AliasOrNil[asocontainerservicev1.ScaleSetPriority](s.ScaleSetPriority)
spec.ScaleDownMode = azure.AliasOrNil[asocontainerservicev1.ScaleDownMode](s.ScaleDownMode)
spec.Type = ptr.To(asocontainerservicev1.AgentPoolType_VirtualMachineScaleSets)
spec.EnableNodePublicIP = s.EnableNodePublicIP
spec.Tags = s.AdditionalTags
spec.EnableFIPS = s.EnableFIPS

if s.KubeletConfig != nil {
agentPool.Spec.KubeletConfig = &asocontainerservicev1.KubeletConfig{
spec.KubeletConfig = &asocontainerservicev1.KubeletConfig{
CpuManagerPolicy: s.KubeletConfig.CPUManagerPolicy,
CpuCfsQuota: s.KubeletConfig.CPUCfsQuota,
CpuCfsQuotaPeriod: s.KubeletConfig.CPUCfsQuotaPeriod,

Check warning on line 205 in azure/services/agentpools/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/agentpools/spec.go#L202-L205

Added lines #L202 - L205 were not covered by tests
Expand All @@ -216,33 +215,33 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing *asocontainerse
}

Check warning on line 215 in azure/services/agentpools/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/agentpools/spec.go#L213-L215

Added lines #L213 - L215 were not covered by tests

if s.SKU != "" {
agentPool.Spec.VmSize = &s.SKU
spec.VmSize = &s.SKU
}

if s.SpotMaxPrice != nil {
agentPool.Spec.SpotMaxPrice = ptr.To(s.SpotMaxPrice.AsApproximateFloat64())
spec.SpotMaxPrice = ptr.To(s.SpotMaxPrice.AsApproximateFloat64())
}

if s.VnetSubnetID != "" {
agentPool.Spec.VnetSubnetReference = &genruntime.ResourceReference{
spec.VnetSubnetReference = &genruntime.ResourceReference{
ARMID: s.VnetSubnetID,
}
}

if s.NodePublicIPPrefixID != "" {
agentPool.Spec.NodePublicIPPrefixReference = &genruntime.ResourceReference{
spec.NodePublicIPPrefixReference = &genruntime.ResourceReference{
ARMID: s.NodePublicIPPrefixID,

Check warning on line 233 in azure/services/agentpools/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/agentpools/spec.go#L232-L233

Added lines #L232 - L233 were not covered by tests
}
}

if s.LinuxOSConfig != nil {
agentPool.Spec.LinuxOSConfig = &asocontainerservicev1.LinuxOSConfig{
spec.LinuxOSConfig = &asocontainerservicev1.LinuxOSConfig{

Check warning on line 238 in azure/services/agentpools/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/agentpools/spec.go#L238

Added line #L238 was not covered by tests
SwapFileSizeMB: s.LinuxOSConfig.SwapFileSizeMB,
TransparentHugePageEnabled: (*string)(s.LinuxOSConfig.TransparentHugePageEnabled),
TransparentHugePageDefrag: (*string)(s.LinuxOSConfig.TransparentHugePageDefrag),
}
if s.LinuxOSConfig.Sysctls != nil {
agentPool.Spec.LinuxOSConfig.Sysctls = &asocontainerservicev1.SysctlConfig{
spec.LinuxOSConfig.Sysctls = &asocontainerservicev1.SysctlConfig{

Check warning on line 244 in azure/services/agentpools/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/agentpools/spec.go#L244

Added line #L244 was not covered by tests
FsAioMaxNr: s.LinuxOSConfig.Sysctls.FsAioMaxNr,
FsFileMax: s.LinuxOSConfig.Sysctls.FsFileMax,
FsInotifyMaxUserWatches: s.LinuxOSConfig.Sysctls.FsInotifyMaxUserWatches,
Expand Down Expand Up @@ -279,7 +278,7 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing *asocontainerse
// count present in MachinePool or AzureManagedMachinePool, hence we should not make an update API call based
// on difference in count.
if s.EnableAutoScaling && agentPool.Status.Count != nil {
agentPool.Spec.Count = agentPool.Status.Count
spec.Count = agentPool.Status.Count
}

return agentPool, nil
Expand Down
28 changes: 19 additions & 9 deletions azure/services/agentpools/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,6 @@ func TestParameters(t *testing.T) {
expected: sdkFakeAgentPool(),
expectedError: nil,
},
{
name: "parameters with an existing agent pool and update needed on spot max price",
spec: fakeAgentPool(),
existing: sdkFakeAgentPool(
sdkWithSpotMaxPrice(123.456),
),
expected: sdkFakeAgentPool(),
expectedError: nil,
},
{
name: "parameters with an existing agent pool and update needed on spot max price",
spec: fakeAgentPool(
Expand Down Expand Up @@ -307,6 +298,25 @@ func TestParameters(t *testing.T) {
expectNoChange: true,
expectedError: nil,
},
{
name: "user-supplied spec values persist",
spec: fakeAgentPool(),
existing: sdkFakeAgentPool(
func(pool *asocontainerservicev1.ManagedClustersAgentPool) {
pool.Spec.PowerState = &asocontainerservicev1.PowerState{
Code: ptr.To[asocontainerservicev1.PowerState_Code]("some value"),
}
},
),
expected: sdkFakeAgentPool(
func(pool *asocontainerservicev1.ManagedClustersAgentPool) {
pool.Spec.PowerState = &asocontainerservicev1.PowerState{
Code: ptr.To[asocontainerservicev1.PowerState_Code]("some value"),
}
},
),
expectedError: nil,
},
}
for _, tc := range testcases {
tc := tc
Expand Down
114 changes: 58 additions & 56 deletions azure/services/managedclusters/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,44 +296,46 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai

managedCluster := existing
if managedCluster == nil {
managedCluster = &asocontainerservicev1.ManagedCluster{}
managedCluster = &asocontainerservicev1.ManagedCluster{
Spec: asocontainerservicev1.ManagedCluster_Spec{
Tags: infrav1.Build(infrav1.BuildParams{
Lifecycle: infrav1.ResourceLifecycleOwned,
ClusterName: s.ClusterName,
Name: ptr.To(s.Name),
Role: ptr.To(infrav1.CommonRole),
// Additional tags managed separately
}),
},
}
}

managedCluster.Spec = asocontainerservicev1.ManagedCluster_Spec{
AzureName: s.Name,
Owner: &genruntime.KnownResourceReference{
Name: s.ResourceGroup,
},
Identity: &asocontainerservicev1.ManagedClusterIdentity{
Type: ptr.To(asocontainerservicev1.ManagedClusterIdentity_Type_SystemAssigned),
},
Location: &s.Location,
Tags: infrav1.Build(infrav1.BuildParams{
Lifecycle: infrav1.ResourceLifecycleOwned,
ClusterName: s.ClusterName,
Name: ptr.To(s.Name),
Role: ptr.To(infrav1.CommonRole),
// Additional tags managed separately
}),
NodeResourceGroup: &s.NodeResourceGroup,
EnableRBAC: ptr.To(true),
DnsPrefix: s.DNSPrefix,
KubernetesVersion: &s.Version,
ServicePrincipalProfile: &asocontainerservicev1.ManagedClusterServicePrincipalProfile{
ClientId: ptr.To("msi"),
},
NetworkProfile: &asocontainerservicev1.ContainerServiceNetworkProfile{
NetworkPlugin: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPlugin](&s.NetworkPlugin),
LoadBalancerSku: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_LoadBalancerSku](&s.LoadBalancerSKU),
NetworkPolicy: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPolicy](&s.NetworkPolicy),
},
AutoScalerProfile: buildAutoScalerProfile(s.AutoScalerProfile),
OperatorSpec: &asocontainerservicev1.ManagedClusterOperatorSpec{
Secrets: &asocontainerservicev1.ManagedClusterOperatorSecrets{
AdminCredentials: &genruntime.SecretDestination{
Name: secret.Name(s.ClusterName, secret.Kubeconfig),
Key: secret.KubeconfigDataName,
},
spec := &managedCluster.Spec
spec.AzureName = s.Name
spec.Owner = &genruntime.KnownResourceReference{
Name: s.ResourceGroup,
}
spec.Identity = &asocontainerservicev1.ManagedClusterIdentity{
Type: ptr.To(asocontainerservicev1.ManagedClusterIdentity_Type_SystemAssigned),
}
spec.Location = &s.Location
spec.NodeResourceGroup = &s.NodeResourceGroup
spec.EnableRBAC = ptr.To(true)
spec.DnsPrefix = s.DNSPrefix
spec.KubernetesVersion = &s.Version
spec.ServicePrincipalProfile = &asocontainerservicev1.ManagedClusterServicePrincipalProfile{
ClientId: ptr.To("msi"),
}
spec.NetworkProfile = &asocontainerservicev1.ContainerServiceNetworkProfile{
NetworkPlugin: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPlugin](&s.NetworkPlugin),
LoadBalancerSku: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_LoadBalancerSku](&s.LoadBalancerSKU),
NetworkPolicy: azure.AliasOrNil[asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPolicy](&s.NetworkPolicy),
}
spec.AutoScalerProfile = buildAutoScalerProfile(s.AutoScalerProfile)
spec.OperatorSpec = &asocontainerservicev1.ManagedClusterOperatorSpec{
Secrets: &asocontainerservicev1.ManagedClusterOperatorSecrets{
AdminCredentials: &genruntime.SecretDestination{
Name: secret.Name(s.ClusterName, secret.Kubeconfig),
Key: secret.KubeconfigDataName,
},
},
}
Expand All @@ -346,7 +348,7 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai
}

Check warning on line 348 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L347-L348

Added lines #L347 - L348 were not covered by tests
}
if decodedSSHPublicKey != nil {
managedCluster.Spec.LinuxProfile = &asocontainerservicev1.ContainerServiceLinuxProfile{
spec.LinuxProfile = &asocontainerservicev1.ContainerServiceLinuxProfile{
AdminUsername: ptr.To(azure.DefaultAKSUserName),
Ssh: &asocontainerservicev1.ContainerServiceSshConfiguration{
PublicKeys: []asocontainerservicev1.ContainerServiceSshPublicKey{
Expand All @@ -359,16 +361,16 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai
}

if s.NetworkPluginMode != nil {
managedCluster.Spec.NetworkProfile.NetworkPluginMode = ptr.To(asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPluginMode(*s.NetworkPluginMode))
spec.NetworkProfile.NetworkPluginMode = ptr.To(asocontainerservicev1.ContainerServiceNetworkProfile_NetworkPluginMode(*s.NetworkPluginMode))
}

if s.PodCIDR != "" {
managedCluster.Spec.NetworkProfile.PodCidr = &s.PodCIDR
spec.NetworkProfile.PodCidr = &s.PodCIDR

Check warning on line 368 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L368

Added line #L368 was not covered by tests
}

if s.ServiceCIDR != "" {
if s.DNSServiceIP == nil {
managedCluster.Spec.NetworkProfile.ServiceCidr = &s.ServiceCIDR
spec.NetworkProfile.ServiceCidr = &s.ServiceCIDR

Check warning on line 373 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L373

Added line #L373 was not covered by tests
ip, _, err := net.ParseCIDR(s.ServiceCIDR)
if err != nil {
return nil, fmt.Errorf("failed to parse service cidr: %w", err)
Expand All @@ -379,23 +381,23 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai
// https://golang.org/src/net/ip.go#L48
ip[15] = byte(10)
dnsIP := ip.String()
managedCluster.Spec.NetworkProfile.DnsServiceIP = &dnsIP
spec.NetworkProfile.DnsServiceIP = &dnsIP

Check warning on line 384 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L384

Added line #L384 was not covered by tests
} else {
managedCluster.Spec.NetworkProfile.DnsServiceIP = s.DNSServiceIP
spec.NetworkProfile.DnsServiceIP = s.DNSServiceIP

Check warning on line 386 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L386

Added line #L386 was not covered by tests
}
}

if s.AADProfile != nil {
managedCluster.Spec.AadProfile = &asocontainerservicev1.ManagedClusterAADProfile{
spec.AadProfile = &asocontainerservicev1.ManagedClusterAADProfile{

Check warning on line 391 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L391

Added line #L391 was not covered by tests
Managed: &s.AADProfile.Managed,
EnableAzureRBAC: &s.AADProfile.EnableAzureRBAC,
AdminGroupObjectIDs: s.AADProfile.AdminGroupObjectIDs,

Check warning on line 394 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L394

Added line #L394 was not covered by tests
}
}

for i := range s.AddonProfiles {
if managedCluster.Spec.AddonProfiles == nil {
managedCluster.Spec.AddonProfiles = map[string]asocontainerservicev1.ManagedClusterAddonProfile{}
if spec.AddonProfiles == nil {
spec.AddonProfiles = map[string]asocontainerservicev1.ManagedClusterAddonProfile{}

Check warning on line 400 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L399-L400

Added lines #L399 - L400 were not covered by tests
}
item := s.AddonProfiles[i]
addonProfile := asocontainerservicev1.ManagedClusterAddonProfile{

Check warning on line 403 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L403

Added line #L403 was not covered by tests
Expand All @@ -404,46 +406,46 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai
if item.Config != nil {
addonProfile.Config = item.Config

Check warning on line 407 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L407

Added line #L407 was not covered by tests
}
managedCluster.Spec.AddonProfiles[item.Name] = addonProfile
spec.AddonProfiles[item.Name] = addonProfile

Check warning on line 409 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L409

Added line #L409 was not covered by tests
}

if s.SKU != nil {
tierName := asocontainerservicev1.ManagedClusterSKU_Tier(s.SKU.Tier)
managedCluster.Spec.Sku = &asocontainerservicev1.ManagedClusterSKU{
spec.Sku = &asocontainerservicev1.ManagedClusterSKU{
Name: ptr.To(asocontainerservicev1.ManagedClusterSKU_Name("Base")),

Check warning on line 415 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L413-L415

Added lines #L413 - L415 were not covered by tests
Tier: ptr.To(tierName),
}
}

if s.LoadBalancerProfile != nil {
managedCluster.Spec.NetworkProfile.LoadBalancerProfile = s.GetLoadBalancerProfile()
spec.NetworkProfile.LoadBalancerProfile = s.GetLoadBalancerProfile()

Check warning on line 421 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L421

Added line #L421 was not covered by tests
}

if s.APIServerAccessProfile != nil {
managedCluster.Spec.ApiServerAccessProfile = &asocontainerservicev1.ManagedClusterAPIServerAccessProfile{
spec.ApiServerAccessProfile = &asocontainerservicev1.ManagedClusterAPIServerAccessProfile{
EnablePrivateCluster: s.APIServerAccessProfile.EnablePrivateCluster,
PrivateDNSZone: s.APIServerAccessProfile.PrivateDNSZone,
EnablePrivateClusterPublicFQDN: s.APIServerAccessProfile.EnablePrivateClusterPublicFQDN,
}

if s.APIServerAccessProfile.AuthorizedIPRanges != nil {
managedCluster.Spec.ApiServerAccessProfile.AuthorizedIPRanges = s.APIServerAccessProfile.AuthorizedIPRanges
spec.ApiServerAccessProfile.AuthorizedIPRanges = s.APIServerAccessProfile.AuthorizedIPRanges
}
}

if s.OutboundType != nil {
managedCluster.Spec.NetworkProfile.OutboundType = ptr.To(asocontainerservicev1.ContainerServiceNetworkProfile_OutboundType(*s.OutboundType))
spec.NetworkProfile.OutboundType = ptr.To(asocontainerservicev1.ContainerServiceNetworkProfile_OutboundType(*s.OutboundType))

Check warning on line 437 in azure/services/managedclusters/spec.go

View check run for this annotation

Codecov / codecov/patch

azure/services/managedclusters/spec.go#L437

Added line #L437 was not covered by tests
}

if s.Identity != nil {
managedCluster.Spec.Identity, err = getIdentity(s.Identity)
spec.Identity, err = getIdentity(s.Identity)
if err != nil {
return nil, errors.Wrapf(err, "Identity is not valid: %s", err)
}
}

if s.KubeletUserAssignedIdentity != "" {
managedCluster.Spec.IdentityProfile = map[string]asocontainerservicev1.UserAssignedIdentity{
spec.IdentityProfile = map[string]asocontainerservicev1.UserAssignedIdentity{
kubeletIdentityKey: {
ResourceReference: &genruntime.ResourceReference{
ARMID: s.KubeletUserAssignedIdentity,
Expand All @@ -453,19 +455,19 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing *asocontai
}

if s.HTTPProxyConfig != nil {
managedCluster.Spec.HttpProxyConfig = &asocontainerservicev1.ManagedClusterHTTPProxyConfig{
spec.HttpProxyConfig = &asocontainerservicev1.ManagedClusterHTTPProxyConfig{
HttpProxy: s.HTTPProxyConfig.HTTPProxy,
HttpsProxy: s.HTTPProxyConfig.HTTPSProxy,
TrustedCa: s.HTTPProxyConfig.TrustedCA,
}

if s.HTTPProxyConfig.NoProxy != nil {
managedCluster.Spec.HttpProxyConfig.NoProxy = s.HTTPProxyConfig.NoProxy
spec.HttpProxyConfig.NoProxy = s.HTTPProxyConfig.NoProxy
}
}

if s.OIDCIssuerProfile != nil {
managedCluster.Spec.OidcIssuerProfile = &asocontainerservicev1.ManagedClusterOIDCIssuerProfile{
spec.OidcIssuerProfile = &asocontainerservicev1.ManagedClusterOIDCIssuerProfile{
Enabled: s.OIDCIssuerProfile.Enabled,
}
}
Expand Down
3 changes: 3 additions & 0 deletions azure/services/managedclusters/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ func getExistingCluster() *asocontainerservicev1.ManagedCluster {
mc.Spec.Tags[infrav1.ClusterTagKey("")] = mc.Spec.Tags[infrav1.ClusterTagKey("test-cluster")]
delete(mc.Spec.Tags, infrav1.ClusterTagKey("test-cluster"))

// field that CAPZ does not manage, simulating user-supplied value
mc.Spec.EnablePodSecurityPolicy = ptr.To(true)

mc.Spec.AgentPoolProfiles = nil
// only nil vs. non-nil matters here
mc.Status.AgentPoolProfiles = []asocontainerservicev1.ManagedClusterAgentPoolProfile_STATUS{}
Expand Down

0 comments on commit 051b4e5

Please sign in to comment.