diff --git a/api/v1beta1/azuremachine_validation.go b/api/v1beta1/azuremachine_validation.go index 3197935f66f..9dd9d347a05 100644 --- a/api/v1beta1/azuremachine_validation.go +++ b/api/v1beta1/azuremachine_validation.go @@ -482,7 +482,7 @@ func ValidateVMExtensions(disableExtensionOperations *bool, vmExtensions []VMExt allErrs := field.ErrorList{} if ptr.Deref(disableExtensionOperations, false) && len(vmExtensions) > 0 { - allErrs = append(allErrs, field.Forbidden(field.NewPath("azureMachineTemplate", "spec", "template", "spec", "vmExtensions"), "VMExtensions must be empty when DisableExtensionOperations is true")) + allErrs = append(allErrs, field.Forbidden(field.NewPath("AzureMachineTemplate", "spec", "template", "spec", "vmExtensions"), "VMExtensions must be empty when DisableExtensionOperations is true")) } return allErrs diff --git a/api/v1beta1/azuremachinetemplate_webhook.go b/api/v1beta1/azuremachinetemplate_webhook.go index 9d6ca2907ad..9130f92ac19 100644 --- a/api/v1beta1/azuremachinetemplate_webhook.go +++ b/api/v1beta1/azuremachinetemplate_webhook.go @@ -123,7 +123,7 @@ func (r *AzureMachineTemplate) ValidateUpdate(ctx context.Context, oldRaw runtim if err := r.Default(ctx, old); err != nil { allErrs = append(allErrs, - field.Invalid(field.NewPath("azureMachineTemplate"), r, fmt.Sprintf("Unable to apply defaults: %v", err)), + field.Invalid(field.NewPath("AzureMachineTemplate"), r, fmt.Sprintf("Unable to apply defaults: %v", err)), ) } diff --git a/api/v1beta1/azuremanagedcontrolplane_webhook.go b/api/v1beta1/azuremanagedcontrolplane_webhook.go index 67967890907..a0190288ae6 100644 --- a/api/v1beta1/azuremanagedcontrolplane_webhook.go +++ b/api/v1beta1/azuremanagedcontrolplane_webhook.go @@ -709,7 +709,7 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage if old.Spec.VirtualNetwork.Name != m.Spec.VirtualNetwork.Name { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "virtualNetwork.name"), + field.NewPath("spec", "virtualNetwork", "name"), m.Spec.VirtualNetwork.Name, "Virtual Network Name is immutable")) } @@ -717,7 +717,7 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage if old.Spec.VirtualNetwork.CIDRBlock != m.Spec.VirtualNetwork.CIDRBlock { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "virtualNetwork.cidrBlock"), + field.NewPath("spec", "virtualNetwork", "cidrBlock"), m.Spec.VirtualNetwork.CIDRBlock, "Virtual Network CIDRBlock is immutable")) } @@ -725,7 +725,7 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage if old.Spec.VirtualNetwork.Subnet.Name != m.Spec.VirtualNetwork.Subnet.Name { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "virtualNetwork.subnet.name"), + field.NewPath("spec", "virtualNetwork", "subnet", "name"), m.Spec.VirtualNetwork.Subnet.Name, "Subnet Name is immutable")) } @@ -737,7 +737,7 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage if old.Spec.VirtualNetwork.Subnet.CIDRBlock != m.Spec.VirtualNetwork.Subnet.CIDRBlock { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "virtualNetwork.subnet.cidrBlock"), + field.NewPath("spec", "virtualNetwork", "subnet", "cidrBlock"), m.Spec.VirtualNetwork.Subnet.CIDRBlock, "Subnet CIDRBlock is immutable")) } @@ -745,7 +745,7 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage if old.Spec.VirtualNetwork.ResourceGroup != m.Spec.VirtualNetwork.ResourceGroup { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "virtualNetwork.resourceGroup"), + field.NewPath("spec", "virtualNetwork", "resourceGroup"), m.Spec.VirtualNetwork.ResourceGroup, "Virtual Network Resource Group is immutable")) } @@ -779,14 +779,14 @@ func (m *AzureManagedControlPlane) validateAADProfileUpdateAndLocalAccounts(old if !m.Spec.AADProfile.Managed && old.Spec.AADProfile.Managed { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "aadProfile.managed"), + field.NewPath("spec", "aadProfile", "managed"), m.Spec.AADProfile.Managed, "cannot set AADProfile.Managed to false")) } if len(m.Spec.AADProfile.AdminGroupObjectIDs) == 0 { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "aadProfile.AdminGroupObjectIDs"), + field.NewPath("spec", "aadProfile", "adminGroupObjectIDs"), m.Spec.AADProfile.AdminGroupObjectIDs, "length of AADProfile.AdminGroupObjectIDs cannot be zero")) } diff --git a/api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go b/api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go index 30a2a96a1d6..f2b25b36743 100644 --- a/api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go +++ b/api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go @@ -148,14 +148,14 @@ func (mcpw *azureManagedControlPlaneTemplateWebhook) ValidateUpdate(ctx context. if !mcp.Spec.Template.Spec.AADProfile.Managed && old.Spec.Template.Spec.AADProfile.Managed { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "template", "spec", "aadProfile.Managed"), + field.NewPath("spec", "template", "spec", "aadProfile", "managed"), mcp.Spec.Template.Spec.AADProfile.Managed, "cannot set AADProfile.Managed to false")) } if len(mcp.Spec.Template.Spec.AADProfile.AdminGroupObjectIDs) == 0 { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "template", "spec", "aadProfile.AdminGroupObjectIDs"), + field.NewPath("spec", "template", "spec", "aadProfile", "adminGroupObjectIDs"), mcp.Spec.Template.Spec.AADProfile.AdminGroupObjectIDs, "length of AADProfile.AdminGroupObjectIDs cannot be zero")) } @@ -256,7 +256,7 @@ func (mcp *AzureManagedControlPlaneTemplate) validateVirtualNetworkTemplateUpdat if old.Spec.Template.Spec.VirtualNetwork.CIDRBlock != mcp.Spec.Template.Spec.VirtualNetwork.CIDRBlock { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "template", "spec", "virtualNetwork.CIDRBlock"), + field.NewPath("spec", "template", "spec", "virtualNetwork", "cidrBlock"), mcp.Spec.Template.Spec.VirtualNetwork.CIDRBlock, "Virtual Network CIDRBlock is immutable")) } @@ -264,7 +264,7 @@ func (mcp *AzureManagedControlPlaneTemplate) validateVirtualNetworkTemplateUpdat if old.Spec.Template.Spec.VirtualNetwork.Subnet.Name != mcp.Spec.Template.Spec.VirtualNetwork.Subnet.Name { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "template", "spec", "virtualNetwork.Subnet.Name"), + field.NewPath("spec", "template", "spec", "virtualNetwork", "subnet", "name"), mcp.Spec.Template.Spec.VirtualNetwork.Subnet.Name, "Subnet Name is immutable")) } @@ -276,7 +276,7 @@ func (mcp *AzureManagedControlPlaneTemplate) validateVirtualNetworkTemplateUpdat if old.Spec.Template.Spec.VirtualNetwork.Subnet.CIDRBlock != mcp.Spec.Template.Spec.VirtualNetwork.Subnet.CIDRBlock { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec", "template", "spec", "virtualNetwork.Subnet.CIDRBlock"), + field.NewPath("spec", "template", "spec", "virtualNetwork", "subnet", "cidrBlock"), mcp.Spec.Template.Spec.VirtualNetwork.Subnet.CIDRBlock, "Subnet CIDRBlock is immutable")) } diff --git a/api/v1beta1/azuremanagedmachinepooltemplate_webhook.go b/api/v1beta1/azuremanagedmachinepooltemplate_webhook.go index a476eba9a4c..9a85c5e1107 100644 --- a/api/v1beta1/azuremanagedmachinepooltemplate_webhook.go +++ b/api/v1beta1/azuremanagedmachinepooltemplate_webhook.go @@ -89,7 +89,7 @@ func (mpw *azureManagedMachinePoolTemplateWebhook) ValidateCreate(ctx context.Co errs = append(errs, validateMaxPods( mp.Spec.Template.Spec.MaxPods, - field.NewPath("spec", "template", "spec", "MaxPods"))) + field.NewPath("spec", "template", "spec", "maxPods"))) errs = append(errs, validateOSType( mp.Spec.Template.Spec.Mode,