Skip to content

Commit 265a77a

Browse files
committed
fixup! feat: Nutanix VM image preflight check
Address linter errors
1 parent 3688af0 commit 265a77a

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

pkg/webhook/preflight/nutanix/nutanix.go renamed to pkg/webhook/preflight/nutanix/checker.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@ import (
2020
type Checker struct {
2121
client ctrlclient.Client
2222
nutanixClient *prismv4.Client
23-
cluster *clusterv1.Cluster
24-
clusterConfig *variables.ClusterConfigSpec
2523
}
2624

27-
func (n *Checker) Provider() string {
28-
return "nutanix"
29-
}
30-
31-
func (n *Checker) Checks(
25+
func (n *Checker) Init(
3226
ctx context.Context,
3327
client ctrlclient.Client,
3428
cluster *clusterv1.Cluster,
@@ -54,7 +48,10 @@ func (n *Checker) Checks(
5448
if clusterConfig.ControlPlane != nil && clusterConfig.ControlPlane.Nutanix != nil {
5549
checks = append(
5650
checks,
57-
n.VMImageCheck(clusterConfig.ControlPlane.Nutanix.MachineDetails, "controlPlane.nutanix.machineDetails"),
51+
n.VMImageCheck(
52+
&clusterConfig.ControlPlane.Nutanix.MachineDetails,
53+
"controlPlane.nutanix.machineDetails",
54+
),
5855
)
5956
}
6057

@@ -79,7 +76,7 @@ func (n *Checker) Checks(
7976
}
8077

8178
n.VMImageCheck(
82-
workerConfig.Nutanix.MachineDetails,
79+
&workerConfig.Nutanix.MachineDetails,
8380
fmt.Sprintf(
8481
"workers.machineDeployments[.name=%s].variables.overrides[.name=workerConfig].value.nutanix.machineDetails",
8582
md.Name,

pkg/webhook/preflight/nutanix/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func newV4Client(
2525
error,
2626
) {
2727
if clusterConfig.Nutanix.PrismCentralEndpoint.Credentials.SecretRef.Name == "" {
28-
return nil, fmt.Errorf("Prism Central credentials reference SecretRef.Name has no value")
28+
return nil, fmt.Errorf("prism Central credentials reference SecretRef.Name has no value")
2929
}
3030

3131
credentialsSecret := &corev1.Secret{}
@@ -56,6 +56,5 @@ func newV4Client(
5656
Username: credentials.Username,
5757
Password: credentials.Password,
5858
Insecure: clusterConfig.Nutanix.PrismCentralEndpoint.Insecure,
59-
// TODO AdditionalTrustBundle
6059
})
6160
}

pkg/webhook/preflight/nutanix/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/webhook/preflight"
1414
)
1515

16-
func (n *Checker) VMImageCheck(details carenv1.NutanixMachineDetails, field string) preflight.Check {
16+
func (n *Checker) VMImageCheck(details *carenv1.NutanixMachineDetails, field string) preflight.Check {
1717
return func(ctx context.Context) preflight.CheckResult {
1818
result := preflight.CheckResult{
1919
Allowed: true,

0 commit comments

Comments
 (0)