Skip to content

Commit fa0ec4c

Browse files
committed
add nodePublicIPPrefixID to AzureManagedMachinePool
1 parent 85fbf6c commit fa0ec4c

15 files changed

+340
-66
lines changed

azure/converters/managedagentpool.go

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,26 @@ import (
2424
func AgentPoolToManagedClusterAgentPoolProfile(pool containerservice.AgentPool) containerservice.ManagedClusterAgentPoolProfile {
2525
properties := pool.ManagedClusterAgentPoolProfileProperties
2626
return containerservice.ManagedClusterAgentPoolProfile{
27-
Name: pool.Name, // Note: if converting from agentPoolSpec.Parameters(), this field will not be set
28-
VMSize: properties.VMSize,
29-
OsType: properties.OsType,
30-
OsDiskSizeGB: properties.OsDiskSizeGB,
31-
Count: properties.Count,
32-
Type: properties.Type,
33-
OrchestratorVersion: properties.OrchestratorVersion,
34-
VnetSubnetID: properties.VnetSubnetID,
35-
Mode: properties.Mode,
36-
EnableAutoScaling: properties.EnableAutoScaling,
37-
MaxCount: properties.MaxCount,
38-
MinCount: properties.MinCount,
39-
NodeTaints: properties.NodeTaints,
40-
AvailabilityZones: properties.AvailabilityZones,
41-
MaxPods: properties.MaxPods,
42-
OsDiskType: properties.OsDiskType,
43-
NodeLabels: properties.NodeLabels,
44-
EnableUltraSSD: properties.EnableUltraSSD,
45-
EnableNodePublicIP: properties.EnableNodePublicIP,
46-
ScaleSetPriority: properties.ScaleSetPriority,
27+
Name: pool.Name, // Note: if converting from agentPoolSpec.Parameters(), this field will not be set
28+
VMSize: properties.VMSize,
29+
OsType: properties.OsType,
30+
OsDiskSizeGB: properties.OsDiskSizeGB,
31+
Count: properties.Count,
32+
Type: properties.Type,
33+
OrchestratorVersion: properties.OrchestratorVersion,
34+
VnetSubnetID: properties.VnetSubnetID,
35+
Mode: properties.Mode,
36+
EnableAutoScaling: properties.EnableAutoScaling,
37+
MaxCount: properties.MaxCount,
38+
MinCount: properties.MinCount,
39+
NodeTaints: properties.NodeTaints,
40+
AvailabilityZones: properties.AvailabilityZones,
41+
MaxPods: properties.MaxPods,
42+
OsDiskType: properties.OsDiskType,
43+
NodeLabels: properties.NodeLabels,
44+
EnableUltraSSD: properties.EnableUltraSSD,
45+
EnableNodePublicIP: properties.EnableNodePublicIP,
46+
NodePublicIPPrefixID: properties.NodePublicIPPrefixID,
47+
ScaleSetPriority: properties.ScaleSetPriority,
4748
}
4849
}

azure/scope/managedmachinepool.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,15 @@ func buildAgentPoolSpec(managedControlPlane *infrav1exp.AzureManagedControlPlane
169169
managedControlPlane.Spec.VirtualNetwork.Name,
170170
managedControlPlane.Spec.VirtualNetwork.Subnet.Name,
171171
),
172-
Mode: managedMachinePool.Spec.Mode,
173-
MaxPods: managedMachinePool.Spec.MaxPods,
174-
AvailabilityZones: managedMachinePool.Spec.AvailabilityZones,
175-
OsDiskType: managedMachinePool.Spec.OsDiskType,
176-
EnableUltraSSD: managedMachinePool.Spec.EnableUltraSSD,
177-
Headers: maps.FilterByKeyPrefix(agentPoolAnnotations, azure.CustomHeaderPrefix),
178-
EnableNodePublicIP: managedMachinePool.Spec.EnableNodePublicIP,
179-
ScaleSetPriority: managedMachinePool.Spec.ScaleSetPriority,
172+
Mode: managedMachinePool.Spec.Mode,
173+
MaxPods: managedMachinePool.Spec.MaxPods,
174+
AvailabilityZones: managedMachinePool.Spec.AvailabilityZones,
175+
OsDiskType: managedMachinePool.Spec.OsDiskType,
176+
EnableUltraSSD: managedMachinePool.Spec.EnableUltraSSD,
177+
Headers: maps.FilterByKeyPrefix(agentPoolAnnotations, azure.CustomHeaderPrefix),
178+
EnableNodePublicIP: managedMachinePool.Spec.EnableNodePublicIP,
179+
NodePublicIPPrefixID: managedMachinePool.Spec.NodePublicIPPrefixID,
180+
ScaleSetPriority: managedMachinePool.Spec.ScaleSetPriority,
180181
}
181182

182183
if managedMachinePool.Spec.OSDiskSizeGB != nil {

azure/services/agentpools/spec.go

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ type AgentPoolSpec struct {
9494
// EnableNodePublicIP controls whether or not nodes in the agent pool each have a public IP address.
9595
EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"`
9696

97+
// NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from.
98+
NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"`
99+
97100
// ScaleSetPriority specifies the ScaleSetPriority for the node pool. Allowed values are 'Spot' and 'Regular'
98101
ScaleSetPriority *string `json:"scaleSetPriority,omitempty"`
99102
}
@@ -205,25 +208,26 @@ func (s *AgentPoolSpec) Parameters(existing interface{}) (params interface{}, er
205208

206209
return containerservice.AgentPool{
207210
ManagedClusterAgentPoolProfileProperties: &containerservice.ManagedClusterAgentPoolProfileProperties{
208-
AvailabilityZones: availabilityZones,
209-
Count: replicas,
210-
EnableAutoScaling: s.EnableAutoScaling,
211-
EnableUltraSSD: s.EnableUltraSSD,
212-
MaxCount: s.MaxCount,
213-
MaxPods: s.MaxPods,
214-
MinCount: s.MinCount,
215-
Mode: containerservice.AgentPoolMode(s.Mode),
216-
NodeLabels: nodeLabels,
217-
NodeTaints: nodeTaints,
218-
OrchestratorVersion: s.Version,
219-
OsDiskSizeGB: &s.OSDiskSizeGB,
220-
OsDiskType: containerservice.OSDiskType(to.String(s.OsDiskType)),
221-
OsType: containerservice.OSType(to.String(s.OSType)),
222-
ScaleSetPriority: containerservice.ScaleSetPriority(to.String(s.ScaleSetPriority)),
223-
Type: containerservice.AgentPoolTypeVirtualMachineScaleSets,
224-
VMSize: sku,
225-
VnetSubnetID: vnetSubnetID,
226-
EnableNodePublicIP: s.EnableNodePublicIP,
211+
AvailabilityZones: availabilityZones,
212+
Count: replicas,
213+
EnableAutoScaling: s.EnableAutoScaling,
214+
EnableUltraSSD: s.EnableUltraSSD,
215+
MaxCount: s.MaxCount,
216+
MaxPods: s.MaxPods,
217+
MinCount: s.MinCount,
218+
Mode: containerservice.AgentPoolMode(s.Mode),
219+
NodeLabels: nodeLabels,
220+
NodeTaints: nodeTaints,
221+
OrchestratorVersion: s.Version,
222+
OsDiskSizeGB: &s.OSDiskSizeGB,
223+
OsDiskType: containerservice.OSDiskType(to.String(s.OsDiskType)),
224+
OsType: containerservice.OSType(to.String(s.OSType)),
225+
ScaleSetPriority: containerservice.ScaleSetPriority(to.String(s.ScaleSetPriority)),
226+
Type: containerservice.AgentPoolTypeVirtualMachineScaleSets,
227+
VMSize: sku,
228+
VnetSubnetID: vnetSubnetID,
229+
EnableNodePublicIP: s.EnableNodePublicIP,
230+
NodePublicIPPrefixID: s.NodePublicIPPrefixID,
227231
},
228232
}, nil
229233
}

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedmachinepools.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ spec:
235235
description: Node labels - labels for all of the nodes present in
236236
node pool
237237
type: object
238+
nodePublicIPPrefixID:
239+
description: NodePublicIPPrefixID specifies the public IP prefix resource
240+
ID which VM nodes should use IPs from.
241+
type: string
238242
osDiskSizeGB:
239243
description: OSDiskSizeGB is the disk size for every machine in this
240244
agent pool. If you specify 0, it will apply the default osDisk size

docs/book/src/topics/managedcluster.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ Following is the list of immutable fields for managed clusters:
457457
| AzureManagedMachinePool | .spec.availabilityZones | |
458458
| AzureManagedMachinePool | .spec.maxPods | |
459459
| AzureManagedMachinePool | .spec.osType | |
460+
| AzureManagedMachinePool | .spec.enableNodePublicIP | |
461+
| AzureManagedMachinePool | .spec.nodePublicIPPrefixID | |
460462
461463
## Features
462464

exp/api/v1alpha3/azuremanagedmachinepool_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.NodeLabels = restored.Spec.NodeLabels
4747
dst.Spec.EnableUltraSSD = restored.Spec.EnableUltraSSD
4848
dst.Spec.EnableNodePublicIP = restored.Spec.EnableNodePublicIP
49+
dst.Spec.NodePublicIPPrefixID = restored.Spec.NodePublicIPPrefixID
4950
dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority
5051

5152
dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates

exp/api/v1alpha3/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exp/api/v1alpha4/azuremanagedmachinepool_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
4646
dst.Spec.NodeLabels = restored.Spec.NodeLabels
4747
dst.Spec.EnableUltraSSD = restored.Spec.EnableUltraSSD
4848
dst.Spec.EnableNodePublicIP = restored.Spec.EnableNodePublicIP
49+
dst.Spec.NodePublicIPPrefixID = restored.Spec.NodePublicIPPrefixID
4950
dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority
5051

5152
dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates

exp/api/v1alpha4/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exp/api/v1beta1/azuremanagedmachinepool_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ type AzureManagedMachinePoolSpec struct {
103103
// +optional
104104
EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"`
105105

106+
// NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from.
107+
// +optional
108+
NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"`
109+
106110
// ScaleSetPriority specifies the ScaleSetPriority value. Default to Regular. Possible values include: 'Regular', 'Spot'
107111
// +kubebuilder:validation:Enum=Regular;Spot
108112
// +optional

0 commit comments

Comments
 (0)