-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: dlipovetsky/preflight-nutanix-vmimage
Are you sure you want to change the base?
feat(preflight): Storage container checks for Nutanix #1136
Conversation
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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)
82699cd
to
01bb8ce
Compare
I'll resolve the conflicts. |
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.