Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
incorporated review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakm-ntnx committed Apr 1, 2024
1 parent 3290426 commit c00bb82
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/nutanix_node_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (NutanixMachineDetails) VariableSchema() clusterv1.VariableSchema {
"image": NutanixResourceIdentifier{}.VariableSchema().OpenAPIV3Schema,
"cluster": NutanixResourceIdentifier{}.VariableSchema().OpenAPIV3Schema,
"subnet": NutanixResourceIdentifiers{}.VariableSchema().OpenAPIV3Schema,
"bootType": NutanixBootType("legacy").VariableSchema().OpenAPIV3Schema,
"bootType": NutanixBootType(NutanixBootTypeLegacy).VariableSchema().OpenAPIV3Schema,
"systemDiskSize": {
Description: "systemDiskSize is size (in Quantity format) of the system disk of the VM eg. 20Gi",
Type: "string",
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,23 @@ func (h *nutanixMachineDetailsControlPlanePatchHandler) Mutate(
)

obj.Spec.Template.Spec.Subnets = make([]capxv1.NutanixResourceIdentifier, 0)
for _, subnetCRE := range nutanixMachineDetailsVar.Subnets {
if subnetCRE.Type == "" {
for _, subnetIdentifier := range nutanixMachineDetailsVar.Subnets {
if subnetIdentifier.Type == "" {
continue
}
subnet := capxv1.NutanixResourceIdentifier{}
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
if subnetIdentifier.Type == v1alpha1.NutanixIdentifierName {
subnet.Type = capxv1.NutanixIdentifierName
if subnetCRE.Name == nil || *subnetCRE.Name == "" {
if subnetIdentifier.Name == nil || *subnetIdentifier.Name == "" {
continue
}
subnet.Name = subnetCRE.Name
subnet.Name = subnetIdentifier.Name
} else {
subnet.Type = capxv1.NutanixIdentifierUUID
if subnetCRE.UUID == nil || *subnetCRE.UUID == "" {
if subnetIdentifier.UUID == nil || *subnetIdentifier.UUID == "" {
continue
}
subnet.UUID = subnetCRE.UUID
subnet.UUID = subnetIdentifier.UUID
}
obj.Spec.Template.Spec.Subnets = append(obj.Spec.Template.Spec.Subnets, subnet)
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/handlers/nutanix/mutation/machinedetails/inject_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,23 @@ func (h *nutanixMachineDetailsWorkerPatchHandler) Mutate(
nutanixMachineDetailsVar.SystemDiskSize,
)
obj.Spec.Template.Spec.Subnets = make([]capxv1.NutanixResourceIdentifier, 0)
for _, subnetCRE := range nutanixMachineDetailsVar.Subnets {
if subnetCRE.Type == "" {
for _, subnetIdentifier := range nutanixMachineDetailsVar.Subnets {
if subnetIdentifier.Type == "" {
continue
}
subnet := capxv1.NutanixResourceIdentifier{}
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
if subnetIdentifier.Type == v1alpha1.NutanixIdentifierName {
subnet.Type = capxv1.NutanixIdentifierName
if subnetCRE.Name == nil || *subnetCRE.Name == "" {
if subnetIdentifier.Name == nil || *subnetIdentifier.Name == "" {
continue
}
subnet.Name = subnetCRE.Name
subnet.Name = subnetIdentifier.Name
} else {
subnet.Type = capxv1.NutanixIdentifierUUID
if subnetCRE.UUID == nil || *subnetCRE.UUID == "" {
if subnetIdentifier.UUID == nil || *subnetIdentifier.UUID == "" {
continue
}
subnet.UUID = subnetCRE.UUID
subnet.UUID = subnetIdentifier.UUID
}
obj.Spec.Template.Spec.Subnets = append(obj.Spec.Template.Spec.Subnets, subnet)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestVariableValidation(t *testing.T) {
ControlPlane: &v1alpha1.NodeConfigSpec{
Nutanix: &v1alpha1.NutanixNodeSpec{
MachineDetails: &v1alpha1.NutanixMachineDetails{
BootType: "legacy",
BootType: v1alpha1.NutanixBootTypeLegacy,
VCPUSockets: 2,
VCPUsPerSocket: 1,
Image: v1alpha1.NutanixResourceIdentifier{
Expand Down
23 changes: 12 additions & 11 deletions pkg/handlers/nutanix/mutation/prismcentralendpoint/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@ func (h *nutanixPrismCentralEndpoint) Mutate(
"patchedObjectName", client.ObjectKeyFromObject(obj),
).Info("setting prismCentralEndpoint in NutanixCluster spec")

obj.Spec.Template.Spec.PrismCentral = &credentials.NutanixPrismEndpoint{}
obj.Spec.Template.Spec.PrismCentral.Address = prismCentralEndpointVar.Host
obj.Spec.Template.Spec.PrismCentral.Port = prismCentralEndpointVar.Port
obj.Spec.Template.Spec.PrismCentral.Insecure = prismCentralEndpointVar.Insecure
obj.Spec.Template.Spec.PrismCentral.AdditionalTrustBundle = &credentials.NutanixTrustBundleReference{
Kind: credentials.NutanixTrustBundleKindConfigMap,
Name: prismCentralEndpointVar.AdditionalTrustBundle,
}
obj.Spec.Template.Spec.PrismCentral.CredentialRef = &credentials.NutanixCredentialReference{
Kind: credentials.SecretKind,
Name: prismCentralEndpointVar.CredentialSecret,
obj.Spec.Template.Spec.PrismCentral = &credentials.NutanixPrismEndpoint{
Address: prismCentralEndpointVar.Host,
Port: prismCentralEndpointVar.Port,
Insecure: prismCentralEndpointVar.Insecure,
AdditionalTrustBundle: &credentials.NutanixTrustBundleReference{
Kind: credentials.NutanixTrustBundleKindConfigMap,
Name: prismCentralEndpointVar.AdditionalTrustBundle,
},
CredentialRef: &credentials.NutanixCredentialReference{
Kind: credentials.SecretKind,
Name: prismCentralEndpointVar.CredentialSecret,
},
}

return nil
Expand Down

0 comments on commit c00bb82

Please sign in to comment.