Browse Source

Use the CLOUD_COST_CONFIG_PATH if Kubernetes isn't enabled

There are no config maps to check for without Kubernetes, so we'll
assume that the file is being provided directly.

Signed-off-by: Matt Ray <github@mattray.dev>
Matt Ray 2 năm trước cách đây
mục cha
commit
0a934a8391
1 tập tin đã thay đổi với 8 bổ sung5 xóa
  1. 8 5
      pkg/cloud/config/watcher.go

+ 8 - 5
pkg/cloud/config/watcher.go

@@ -242,12 +242,13 @@ type MultiCloudWatcher struct {
 }
 
 func (mcw *MultiCloudWatcher) GetConfigs() []cloud.KeyedConfig {
-	log.Info("+++MultiCloudWatcher GetConfigs")
-
-	multiConfigPath := path.Join(env.GetConfigPathWithDefault("/var/configs"), cloudIntegrationSecretPath)
-
-	log.Infof("+++ConfigFileWatcher GetConfigs: multiConfigPath: %s", multiConfigPath)
+	var multiConfigPath string
 
+	if !env.IsKubernetesEnabled() {
+		multiConfigPath = env.GetCloudCostConfigPath()
+	} else {
+		multiConfigPath = path.Join(env.GetConfigPathWithDefault("/var/configs"), cloudIntegrationSecretPath)
+	}
 	exists, err := fileutil.FileExists(multiConfigPath)
 	if err != nil {
 		log.Errorf("MultiCloudWatcher:  error checking file at '%s': %s", multiConfigPath, err.Error())
@@ -268,6 +269,8 @@ func (mcw *MultiCloudWatcher) GetConfigs() []cloud.KeyedConfig {
 		}
 	}
 
+	log.Debugf("MultiCloudWatcher GetConfigs: multiConfigPath: %s", multiConfigPath)
+
 	configurations := &Configurations{}
 	err = loadFile(multiConfigPath, configurations)
 	if err != nil {