mirror of
https://github.com/kastenhq/kubestr.git
synced 2024-12-14 11:57:56 +00:00
text change and throttling fix (#35)
This commit is contained in:
parent
bc9dbcb6b4
commit
8077b22799
3 changed files with 40 additions and 18 deletions
|
@ -145,7 +145,7 @@ func (f *FIOrunner) RunFioHelper(ctx context.Context, args *RunFIOArgs) (*RunFIO
|
|||
return &RunFIOResult{
|
||||
Size: args.Size,
|
||||
StorageClass: sc,
|
||||
FioConfig: "",
|
||||
FioConfig: configMap.Data[testFileName],
|
||||
Result: fioOutput,
|
||||
}, nil
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ func (s *fioStepper) loadConfigMap(ctx context.Context, args *RunFIOArgs) (*v1.C
|
|||
configMap.Data[filepath.Base(args.FIOJobFilepath)] = string(data)
|
||||
case args.FIOJobName != "":
|
||||
if _, ok := fioJobs[args.FIOJobName]; !ok {
|
||||
return nil, fmt.Errorf("FIO job not found")
|
||||
return nil, fmt.Errorf("FIO job not found- (%s)", args.FIOJobName)
|
||||
}
|
||||
configMap.Data[args.FIOJobName] = fioJobs[args.FIOJobName]
|
||||
default:
|
||||
|
|
|
@ -31,9 +31,14 @@ __ __ ______ _______ _______ ______
|
|||
**************************************
|
||||
`
|
||||
|
||||
var (
|
||||
DefaultQPS = float32(50)
|
||||
DefaultBurst = 100
|
||||
)
|
||||
|
||||
// NewKubestr initializes a new kubestr object to run preflight tests
|
||||
func NewKubestr() (*Kubestr, error) {
|
||||
cli, err := kube.NewClient()
|
||||
cli, err := getKubeCli()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -66,3 +71,20 @@ func getDynCli() (dynamic.Interface, error) {
|
|||
}
|
||||
return clientset, nil
|
||||
}
|
||||
|
||||
// getKubeCli load the config and returns a kubernetes client
|
||||
// NewClient returns a k8 client configured by the kanister environment.
|
||||
func getKubeCli() (kubernetes.Interface, error) {
|
||||
config, err := kube.LoadConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.QPS = DefaultQPS
|
||||
config.Burst = DefaultBurst
|
||||
// creates the clientset
|
||||
clientset, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return clientset, nil
|
||||
}
|
||||
|
|
|
@ -87,7 +87,6 @@ func (c *CSIDriver) URL() string {
|
|||
func (c *CSIDriver) Print(prefix string) {
|
||||
fmt.Printf(prefix+" Provider: %s\n", c.Provider())
|
||||
fmt.Printf(prefix+" Website: %s\n", c.URL())
|
||||
fmt.Printf(prefix+" Available Versions: %s\n", c.Versions)
|
||||
fmt.Printf(prefix+" Description: %s\n", c.Description)
|
||||
fmt.Printf(prefix+" Additional Features: %s\n", c.Features)
|
||||
}
|
||||
|
@ -129,20 +128,6 @@ func (v *Provisioner) Print() {
|
|||
default:
|
||||
fmt.Println(" Unknown driver type.")
|
||||
}
|
||||
|
||||
if len(v.StorageClasses) > 0 {
|
||||
fmt.Println()
|
||||
fmt.Println(" To perform a FIO test, run-")
|
||||
fmt.Println(" curl https://kastenhq.github.io/kubestr/run_fio2.sh | bash /dev/stdin -s <storage class>")
|
||||
switch {
|
||||
case len(v.VolumeSnapshotClasses) == 0 && v.CSIDriver != nil && v.CSIDriver.SupportsSnapshots():
|
||||
fmt.Println()
|
||||
fmt.Println(" This provisioner supports snapshots, however no Volume Snaphsot Classes were found.")
|
||||
case len(v.VolumeSnapshotClasses) > 0:
|
||||
fmt.Println()
|
||||
fmt.Println(" (Coming soon) Test snapshot/restore functionality.")
|
||||
}
|
||||
}
|
||||
fmt.Println()
|
||||
if len(v.StorageClasses) > 0 {
|
||||
fmt.Printf(" Storage Classes:\n")
|
||||
|
@ -163,6 +148,21 @@ func (v *Provisioner) Print() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.StorageClasses) > 0 {
|
||||
fmt.Println()
|
||||
fmt.Println(" To perform a FIO test, run-")
|
||||
fmt.Println(" ./kubestr fio -c <storage class>")
|
||||
fmt.Println(" Validate the results against our benchmarks at <website>. For more options try '-h'.")
|
||||
switch {
|
||||
case len(v.VolumeSnapshotClasses) == 0 && v.CSIDriver != nil && v.CSIDriver.SupportsSnapshots():
|
||||
fmt.Println()
|
||||
fmt.Println(" This provisioner supports snapshots, however no Volume Snaphsot Classes were found.")
|
||||
case len(v.VolumeSnapshotClasses) > 0:
|
||||
fmt.Println()
|
||||
fmt.Println(" (Coming soon) Test snapshot/restore functionality.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateProvisioners validates the provisioners in a cluster
|
||||
|
|
Loading…
Reference in a new issue