Skip to content

Commit

Permalink
Merge pull request #2 from mihaiandreiratoiu/feature/fips-enable
Browse files Browse the repository at this point in the history
Ops: Add FIPS option for azure machine
  • Loading branch information
mihaiandreiratoiu authored Jul 27, 2023
2 parents 4d95f09 + 80faefb commit 0d0d717
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/v1beta1/azuremanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ type AzureManagedMachinePoolSpec struct {
// +optional
EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"`

// EnableFIPS allows the ability to use FIPS enabled virtual machines.
// Immutable.
// +optional
EnableFIPS *bool `json:"enableFIPS,omitempty"`

// NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from.
// Immutable.
// +optional
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/azuremanagedmachinepool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ func (mw *azureManagedMachinePoolWebhook) ValidateUpdate(ctx context.Context, ol
m.Spec.EnableNodePublicIP); err != nil {
allErrs = append(allErrs, err)
}
if err := webhookutils.ValidateImmutable(
field.NewPath("Spec", "EnableFIPS"),
old.Spec.EnableFIPS,
m.Spec.EnableFIPS); err != nil {
allErrs = append(allErrs, err)
}
if err := webhookutils.ValidateImmutable(
field.NewPath("Spec", "NodePublicIPPrefixID"),
old.Spec.NodePublicIPPrefixID,
Expand Down
28 changes: 28 additions & 0 deletions api/v1beta1/azuremanagedmachinepool_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,34 @@ func TestAzureManagedMachinePoolUpdatingWebhook(t *testing.T) {
},
wantErr: true,
},
{
name: "Unexpected error, value EnableFIPS is unchanged",
new: &AzureManagedMachinePool{
Spec: AzureManagedMachinePoolSpec{
EnableFIPS: pointer.Bool(true),
},
},
old: &AzureManagedMachinePool{
Spec: AzureManagedMachinePoolSpec{
EnableFIPS: pointer.Bool(true),
},
},
wantErr: false,
},
{
name: "EnableFIPS feature is immutable and currently enabled on this agentpool",
new: &AzureManagedMachinePool{
Spec: AzureManagedMachinePoolSpec{
EnableFIPS: pointer.Bool(false),
},
},
old: &AzureManagedMachinePool{
Spec: AzureManagedMachinePoolSpec{
EnableFIPS: pointer.Bool(true),
},
},
wantErr: true,
},
{
name: "NodeTaints are mutable",
new: &AzureManagedMachinePool{
Expand Down
7 changes: 6 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions azure/converters/managedagentpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func AgentPoolToManagedClusterAgentPoolProfile(pool containerservice.AgentPool)
NodeLabels: properties.NodeLabels,
EnableUltraSSD: properties.EnableUltraSSD,
EnableNodePublicIP: properties.EnableNodePublicIP,
EnableFIPS: properties.EnableFIPS,
NodePublicIPPrefixID: properties.NodePublicIPPrefixID,
ScaleSetPriority: properties.ScaleSetPriority,
ScaleDownMode: properties.ScaleDownMode,
Expand Down
1 change: 1 addition & 0 deletions azure/scope/managedmachinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func buildAgentPoolSpec(managedControlPlane *infrav1.AzureManagedControlPlane,
EnableUltraSSD: managedMachinePool.Spec.EnableUltraSSD,
Headers: maps.FilterByKeyPrefix(agentPoolAnnotations, infrav1.CustomHeaderPrefix),
EnableNodePublicIP: managedMachinePool.Spec.EnableNodePublicIP,
EnableFIPS: managedMachinePool.Spec.EnableFIPS,
NodePublicIPPrefixID: managedMachinePool.Spec.NodePublicIPPrefixID,
ScaleSetPriority: managedMachinePool.Spec.ScaleSetPriority,
ScaleDownMode: managedMachinePool.Spec.ScaleDownMode,
Expand Down
3 changes: 3 additions & 0 deletions azure/services/agentpools/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ type AgentPoolSpec struct {
// EnableNodePublicIP controls whether or not nodes in the agent pool each have a public IP address.
EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"`

// EnableFIPS allows the ability to use FIPS enabled virtual machines.
EnableFIPS *bool `json:"EnableFIPS,omitempty"`

// NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from.
NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ spec:
description: EnableNodePublicIP controls whether or not nodes in the
pool each have a public IP address. Immutable.
type: boolean
enableFIPS:
description: allows the ability to use FIPS enabled virtual machines.
Immutable.
type: boolean
enableUltraSSD:
description: EnableUltraSSD enables the storage type UltraSSD_LRS
for the agent pool. Immutable.
Expand Down
2 changes: 2 additions & 0 deletions templates/test/ci/cluster-template-prow-aks.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d0d717

Please sign in to comment.