Przeglądaj źródła

Guard empty ProjectID if SpotDataBucket is set

Otherwise the S3 query will be `s3://the-bucket/.2019-04-29*` will is for sure not going to work
Matthew L Daniel 7 lat temu
rodzic
commit
b77674693e
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      cloud/awsprovider.go

+ 3 - 0
cloud/awsprovider.go

@@ -232,6 +232,9 @@ func (aws *AWS) DownloadPricingData() error {
 	aws.ServiceKeyName = c.ServiceKeyName
 	aws.ServiceKeySecret = c.ServiceKeySecret
 
+	if len(aws.SpotDataBucket) != 0 && len(aws.ProjectID) == 0 {
+		return fmt.Errorf("using SpotDataBucket \"%s\" without ProjectID will not end well", aws.SpotDataBucket)
+	}
 	nodeList, err := aws.Clientset.CoreV1().Nodes().List(metav1.ListOptions{})
 	if err != nil {
 		return err