This commit is contained in:
Liang Mingqiang
2018-07-09 14:36:32 -04:00
committed by Robbie Zhang
parent 89921a08c1
commit 32f996ab60

View File

@@ -60,11 +60,16 @@ func NewMockProvider(providerConfig, nodeName, operatingSystem string, internalI
// loadConfig loads the given json configuration files. // loadConfig loads the given json configuration files.
func loadConfig(providerConfig string) (config MockConfig, err error) { func loadConfig(providerConfig string) (config MockConfig, err error) {
if providerConfig != "" {
data, err := ioutil.ReadFile(providerConfig) data, err := ioutil.ReadFile(providerConfig)
if err != nil { if err != nil {
return config, err return config, err
} }
err = json.Unmarshal(data, &config) err = json.Unmarshal(data, &config)
if err != nil {
return config, err
}
}
if config.CPU == "" { if config.CPU == "" {
config.CPU = defaultCPUCapacity config.CPU = defaultCPUCapacity
} }
@@ -72,7 +77,7 @@ func loadConfig(providerConfig string) (config MockConfig, err error) {
config.Memory = defaultMemoryCapacity config.Memory = defaultMemoryCapacity
} }
if config.Pods == "" { if config.Pods == "" {
config.Memory = defaultPodCapacity config.Pods = defaultPodCapacity
} }
if _, err = resource.ParseQuantity(config.CPU); err != nil { if _, err = resource.ParseQuantity(config.CPU); err != nil {