Skip to content

feat(preflight): Storage container checks for Nutanix #1136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: dlipovetsky/preflight-nutanix-vmimage
Choose a base branch
from

Conversation

thunderboltsid
Copy link
Contributor

Add pre-flight checks to ensure the storage container mentioned in CSI Provider storage class config parameters is present in all relevant AOS clusters i.e. control plane and workers.

@@ -7,11 +7,10 @@ import (
"context"
"fmt"

prismv4 "github.com/nutanix-cloud-native/prism-go-client/v4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)


import (
"context"
"fmt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)

// storageContainerCheck checks if the storage container specified in the CSIProvider's StorageClassConfigs exists.
// It admits the NodeSpec instead of the MachineDetails because the failure domains will be specified in the NodeSpec
// and the MachineDetails.Cluster will be nil in that case.
func (n *Checker) storageContainerCheck(ctx context.Context, nodeSpec *carenv1.NutanixNodeSpec, csiSpec *carenv1.CSIProvider, field string, result *preflight.CheckResult) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (golines)

result.Allowed = false
result.Error = true
result.Causes = append(result.Causes, preflight.Cause{
Message: fmt.Sprintf("no storage container found for cluster %q", nodeSpec.MachineDetails.Cluster.Name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
printf: fmt.Sprintf format %q has arg nodeSpec.MachineDetails.Cluster.Name of wrong type *string (govet)

if csiSpec.StorageClassConfigs == nil {
result.Allowed = false
result.Causes = append(result.Causes, preflight.Cause{
Message: fmt.Sprintf("no storage class configs found for cluster %q", nodeSpec.MachineDetails.Cluster.Name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
printf: fmt.Sprintf format %q has arg nodeSpec.MachineDetails.Cluster.Name of wrong type *string (govet)

return nil, fmt.Errorf("failed to get cluster: %w", err)
}

fltr := fmt.Sprintf("name eq '%s' and clusterExtId eq '%s'", storageContainerName, cluster.ExtId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
printf: fmt.Sprintf format %s has arg cluster.ExtId of wrong type *string (govet)

continue
}

// TODO: check if cluster name is set, if not use uuid. If neither is set, use the cluster name from the NodeSpec failure domain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
The line is 131 characters long, which exceeds the maximum of 120 characters. (lll)

@dlipovetsky dlipovetsky force-pushed the dlipovetsky/preflight-nutanix-vmimage branch from 82699cd to 01bb8ce Compare May 30, 2025 15:58
@dlipovetsky
Copy link
Contributor

I'll resolve the conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants