kubemetricsenv.go 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. package env
  2. import "github.com/opencost/opencost/core/pkg/env"
  3. const (
  4. KubecostMetricsPodEnabledEnvVar = "KUBECOST_METRICS_POD_ENABLED"
  5. KubecostMetricsPodPortEnvVar = "KUBECOST_METRICS_PORT"
  6. ExportClusterCacheEnabledEnvVar = "EXPORT_CLUSTER_CACHE_ENABLED"
  7. ExportClusterInfoEnabledEnvVar = "EXPORT_CLUSTER_INFO_ENABLED"
  8. )
  9. func GetKubecostMetricsPort() int {
  10. return env.GetInt(KubecostMetricsPodPortEnvVar, 9005)
  11. }
  12. // IsKubecostMetricsPodEnabled returns true if the kubecost metrics pod is deployed
  13. func IsKubecostMetricsPodEnabled() bool {
  14. return env.GetBool(KubecostMetricsPodEnabledEnvVar, false)
  15. }
  16. // IsExportClusterCacheEnabled is set to true if the metrics pod should export the cluster cache
  17. // data to a target file location
  18. func IsExportClusterCacheEnabled() bool {
  19. return env.GetBool(ExportClusterCacheEnabledEnvVar, false)
  20. }
  21. // IsExportClusterInfoEnabled is set to true if the metrics pod should export its own cluster info
  22. // data to a target file location
  23. func IsExportClusterInfoEnabled() bool {
  24. return env.GetBool(ExportClusterInfoEnabledEnvVar, false)
  25. }