costmodelenv.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. package env
  2. import (
  3. "time"
  4. "github.com/opencost/opencost/core/pkg/env"
  5. "github.com/opencost/opencost/core/pkg/log"
  6. "github.com/opencost/opencost/core/pkg/util/timeutil"
  7. )
  8. const (
  9. APIPortEnvVar = "API_PORT"
  10. NetworkCostsPortEnvVar = "NETWORK_COSTS_PORT"
  11. AWSAccessKeyIDEnvVar = "AWS_ACCESS_KEY_ID"
  12. AWSAccessKeySecretEnvVar = "AWS_SECRET_ACCESS_KEY"
  13. AWSClusterIDEnvVar = "AWS_CLUSTER_ID"
  14. AWSPricingURL = "AWS_PRICING_URL"
  15. AlibabaAccessKeyIDEnvVar = "ALIBABA_ACCESS_KEY_ID"
  16. AlibabaAccessKeySecretEnvVar = "ALIBABA_SECRET_ACCESS_KEY"
  17. AzureOfferIDEnvVar = "AZURE_OFFER_ID"
  18. AzureBillingAccountEnvVar = "AZURE_BILLING_ACCOUNT"
  19. AzureDownloadBillingDataToDiskEnvVar = "AZURE_DOWNLOAD_BILLING_DATA_TO_DISK"
  20. ReleaseNameEnvVar = "RELEASE_NAME"
  21. PodNameEnvVar = "POD_NAME"
  22. ClusterIDEnvVar = "CLUSTER_ID"
  23. ClusterProfileEnvVar = "CLUSTER_PROFILE"
  24. RemoteEnabledEnvVar = "REMOTE_WRITE_ENABLED"
  25. RemotePWEnvVar = "REMOTE_WRITE_PASSWORD"
  26. SQLAddressEnvVar = "SQL_ADDRESS"
  27. UseCSVProviderEnvVar = "USE_CSV_PROVIDER"
  28. UseCustomProviderEnvVar = "USE_CUSTOM_PROVIDER"
  29. CSVRegionEnvVar = "CSV_REGION"
  30. CSVEndpointEnvVar = "CSV_ENDPOINT"
  31. CSVPathEnvVar = "CSV_PATH"
  32. ConfigPathEnvVar = "CONFIG_PATH"
  33. CloudProviderAPIKeyEnvVar = "CLOUD_PROVIDER_API_KEY"
  34. CollectorDataSourceEnabledEnvVar = "COLLECTOR_DATA_SOURCE_ENABLED"
  35. PVMountPath = "PV_MOUNT_PATH"
  36. EmitPodAnnotationsMetricEnvVar = "EMIT_POD_ANNOTATIONS_METRIC"
  37. EmitNamespaceAnnotationsMetricEnvVar = "EMIT_NAMESPACE_ANNOTATIONS_METRIC"
  38. EmitDeprecatedMetrics = "EMIT_DEPRECATED_METRICS"
  39. EmitKsmV1MetricsEnvVar = "EMIT_KSM_V1_METRICS"
  40. EmitKsmV1MetricsOnly = "EMIT_KSM_V1_METRICS_ONLY"
  41. PProfEnabledEnvVar = "PPROF_ENABLED"
  42. LogCollectionEnabledEnvVar = "LOG_COLLECTION_ENABLED"
  43. ProductAnalyticsEnabledEnvVar = "PRODUCT_ANALYTICS_ENABLED"
  44. ErrorReportingEnabledEnvVar = "ERROR_REPORTING_ENABLED"
  45. ValuesReportingEnabledEnvVar = "VALUES_REPORTING_ENABLED"
  46. KubeRbacProxyEnabled = "KUBE_RBAC_PROXY_ENABLED"
  47. KubeConfigPathEnvVar = "KUBECONFIG_PATH"
  48. UTCOffsetEnvVar = "UTC_OFFSET"
  49. PricingConfigmapName = "PRICING_CONFIGMAP_NAME"
  50. MetricsConfigmapName = "METRICS_CONFIGMAP_NAME"
  51. ClusterInfoFileEnabledEnvVar = "CLUSTER_INFO_FILE_ENABLED"
  52. ClusterCacheFileEnabledEnvVar = "CLUSTER_CACHE_FILE_ENABLED"
  53. IngestPodUIDEnvVar = "INGEST_POD_UID"
  54. ETLReadOnlyMode = "ETL_READ_ONLY"
  55. AllocationNodeLabelsEnabled = "ALLOCATION_NODE_LABELS_ENABLED"
  56. AssetIncludeLocalDiskCostEnvVar = "ASSET_INCLUDE_LOCAL_DISK_COST"
  57. regionOverrideList = "REGION_OVERRIDE_LIST"
  58. ExportCSVFile = "EXPORT_CSV_FILE"
  59. ExportCSVLabelsList = "EXPORT_CSV_LABELS_LIST"
  60. ExportCSVLabelsAll = "EXPORT_CSV_LABELS_ALL"
  61. ExportCSVMaxDays = "EXPORT_CSV_MAX_DAYS"
  62. ExportBucketConfigFileEnvVar = "EXPORT_BUCKET_CONFIG_FILE"
  63. DataRetentionDailyResolutionDaysEnvVar = "DATA_RETENTION_DAILY_RESOLUTION_DAYS"
  64. DataRetentionHourlyResolutionHoursEnvVar = "DATA_RETENTION_HOURLY_RESOLUTION_HOURS"
  65. // We assume that Kubernetes is enabled if there is a KUBERNETES_PORT environment variable present
  66. KubernetesEnabledEnvVar = "KUBERNETES_PORT"
  67. CloudCostEnabledEnvVar = "CLOUD_COST_ENABLED"
  68. CloudCostConfigPath = "CLOUD_COST_CONFIG_PATH"
  69. CloudCostMonthToDateIntervalVar = "CLOUD_COST_MONTH_TO_DATE_INTERVAL"
  70. CloudCostRefreshRateHoursEnvVar = "CLOUD_COST_REFRESH_RATE_HOURS"
  71. CloudCostQueryWindowDaysEnvVar = "CLOUD_COST_QUERY_WINDOW_DAYS"
  72. CloudCostRunWindowDaysEnvVar = "CLOUD_COST_RUN_WINDOW_DAYS"
  73. CustomCostEnabledEnvVar = "CUSTOM_COST_ENABLED"
  74. CustomCostQueryWindowDaysEnvVar = "CUSTOM_COST_QUERY_WINDOW_DAYS"
  75. CustomCostRefreshRateHoursEnvVar = "CUSTOM_COST_REFRESH_RATE_HOURS"
  76. PluginConfigDirEnvVar = "PLUGIN_CONFIG_DIR"
  77. PluginExecutableDirEnvVar = "PLUGIN_EXECUTABLE_DIR"
  78. OCIPricingURL = "OCI_PRICING_URL"
  79. CarbonEstimatesEnabledEnvVar = "CARBON_ESTIMATES_ENABLED"
  80. UseCacheV1 = "USE_CACHE_V1"
  81. InstallNamespaceEnvVar = "INSTALL_NAMESPACE"
  82. ConfigBucketEnvVar = "CONFIG_BUCKET"
  83. // Node Stats Client Configuration
  84. NodeStatsForceKubeProxyEnvVar = "NODESTATS_FORCE_KUBE_PROXY"
  85. NodeStatsLocalProxyEnvVar = "NODESTATS_LOCAL_PROXY"
  86. NodeStatsInsecureEnvVar = "NODESTATS_INSECURE"
  87. NodeStatsCertFileEnvVar = "NODESTATS_CERT_FILE"
  88. NodeStatsKeyFileEnvVar = "NODESTATS_KEY_FILE"
  89. // Deprecated
  90. KubecostNamespaceEnvVar = "KUBECOST_NAMESPACE"
  91. KubecostConfigBucketEnvVar = "KUBECOST_CONFIG_BUCKET"
  92. )
  93. const DefaultConfigMountPath = "/var/configs"
  94. func IsETLReadOnlyMode() bool {
  95. return env.GetBool(ETLReadOnlyMode, false)
  96. }
  97. func GetExportCSVFile() string {
  98. return env.Get(ExportCSVFile, "")
  99. }
  100. func GetExportCSVLabelsAll() bool {
  101. return env.GetBool(ExportCSVLabelsAll, false)
  102. }
  103. func GetExportCSVLabelsList() []string {
  104. return env.GetList(ExportCSVLabelsList, ",")
  105. }
  106. func IsPProfEnabled() bool {
  107. return env.GetBool(PProfEnabledEnvVar, false)
  108. }
  109. func GetExportCSVMaxDays() int {
  110. return env.GetInt(ExportCSVMaxDays, 90)
  111. }
  112. // GetAPIPort returns the environment variable value for APIPortEnvVar which
  113. // is the port number the API is available on.
  114. func GetAPIPort() int {
  115. return env.GetInt(APIPortEnvVar, 9003)
  116. }
  117. // GetConfigBucketFile returns a file location for a mounted bucket configuration which is used to store
  118. // a subset of configurations that require sharing via remote storage.
  119. func GetConfigBucketFile() string {
  120. return env.Get(ConfigBucketEnvVar, env.Get(KubecostConfigBucketEnvVar, ""))
  121. }
  122. // IsClusterInfoFileEnabled returns true if the cluster info is read from a file or pulled from the local
  123. // cloud provider and kubernetes.
  124. func IsClusterInfoFileEnabled() bool {
  125. return env.GetBool(ClusterInfoFileEnabledEnvVar, false)
  126. }
  127. // IsClusterCacheFileEnabled returns true if the kubernetes cluster data is read from a file or pulled from the local
  128. // kubernetes API.
  129. func IsClusterCacheFileEnabled() bool {
  130. return env.GetBool(ClusterCacheFileEnabledEnvVar, false)
  131. }
  132. func GetPricingConfigmapName() string {
  133. return env.Get(PricingConfigmapName, "pricing-configs")
  134. }
  135. func GetMetricsConfigmapName() string {
  136. return env.Get(MetricsConfigmapName, "metrics-config")
  137. }
  138. // IsEmitNamespaceAnnotationsMetric returns true if cost-model is configured to emit the kube_namespace_annotations metric
  139. // containing the namespace annotations
  140. func IsEmitNamespaceAnnotationsMetric() bool {
  141. return env.GetBool(EmitNamespaceAnnotationsMetricEnvVar, false)
  142. }
  143. // IsEmitPodAnnotationsMetric returns true if cost-model is configured to emit the kube_pod_annotations metric containing
  144. // pod annotations.
  145. func IsEmitPodAnnotationsMetric() bool {
  146. return env.GetBool(EmitPodAnnotationsMetricEnvVar, false)
  147. }
  148. // IsEmitKsmV1Metrics returns true if cost-model is configured to emit all necessary KSM v1
  149. // metrics that were removed in KSM v2
  150. func IsEmitKsmV1Metrics() bool {
  151. return env.GetBool(EmitKsmV1MetricsEnvVar, true)
  152. }
  153. func IsEmitKsmV1MetricsOnly() bool {
  154. return env.GetBool(EmitKsmV1MetricsOnly, false)
  155. }
  156. func IsEmitDeprecatedMetrics() bool {
  157. return env.GetBool(EmitDeprecatedMetrics, false)
  158. }
  159. // GetAWSAccessKeyID returns the environment variable value for AWSAccessKeyIDEnvVar which represents
  160. // the AWS access key for authentication
  161. func GetAWSAccessKeyID() string {
  162. awsAccessKeyID := env.Get(AWSAccessKeyIDEnvVar, "")
  163. // If the sample nil service key name is set, zero it out so that it is not
  164. // misinterpreted as a real service key.
  165. if awsAccessKeyID == "AKIXXX" {
  166. awsAccessKeyID = ""
  167. }
  168. return awsAccessKeyID
  169. }
  170. // GetAWSAccessKeySecret returns the environment variable value for AWSAccessKeySecretEnvVar which represents
  171. // the AWS access key secret for authentication
  172. func GetAWSAccessKeySecret() string {
  173. return env.Get(AWSAccessKeySecretEnvVar, "")
  174. }
  175. // GetAWSClusterID returns the environment variable value for AWSClusterIDEnvVar which represents
  176. // an AWS specific cluster identifier.
  177. func GetAWSClusterID() string {
  178. return env.Get(AWSClusterIDEnvVar, "")
  179. }
  180. // GetAWSPricingURL returns an optional alternative URL to fetch AWS pricing data from; for use in airgapped environments
  181. func GetAWSPricingURL() string {
  182. return env.Get(AWSPricingURL, "")
  183. }
  184. // GetAlibabaAccessKeyID returns the environment variable value for AlibabaAccessKeyIDEnvVar which represents
  185. // the Alibaba access key for authentication
  186. func GetAlibabaAccessKeyID() string {
  187. return env.Get(AlibabaAccessKeyIDEnvVar, "")
  188. }
  189. // GetAlibabaAccessKeySecret returns the environment variable value for AlibabaAccessKeySecretEnvVar which represents
  190. // the Alibaba access key secret for authentication
  191. func GetAlibabaAccessKeySecret() string {
  192. return env.Get(AlibabaAccessKeySecretEnvVar, "")
  193. }
  194. // GetAzureOfferID returns the environment variable value for AzureOfferIDEnvVar which represents
  195. // the Azure offer ID for determining prices.
  196. func GetAzureOfferID() string {
  197. return env.Get(AzureOfferIDEnvVar, "")
  198. }
  199. // GetAzureBillingAccount returns the environment variable value for
  200. // AzureBillingAccountEnvVar which represents the Azure billing
  201. // account for determining prices. If this is specified
  202. // customer-specific prices will be downloaded from the consumption
  203. // price sheet API.
  204. func GetAzureBillingAccount() string {
  205. return env.Get(AzureBillingAccountEnvVar, "")
  206. }
  207. // IsAzureDownloadBillingDataToDisk returns the environment variable value for
  208. // AzureDownloadBillingDataToDiskEnvVar which indicates whether the Azure
  209. // Billing Data should be held in memory or written to disk.
  210. func IsAzureDownloadBillingDataToDisk() bool {
  211. return env.GetBool(AzureDownloadBillingDataToDiskEnvVar, true)
  212. }
  213. // GetInstallNamespace returns the environment variable value that is set for the kubernetes namespace
  214. // this service is installed in.
  215. func GetInstallNamespace() string {
  216. return env.Get(InstallNamespaceEnvVar, env.Get(KubecostNamespaceEnvVar, "opencost"))
  217. }
  218. // GetPodName returns the name of the current running pod. If this environment variable is not set,
  219. // empty string is returned.
  220. func GetPodName() string {
  221. return env.Get(PodNameEnvVar, "")
  222. }
  223. // GetClusterProfile returns the environment variable value for ClusterProfileEnvVar which
  224. // represents the cluster profile configured for
  225. func GetClusterProfile() string {
  226. return env.Get(ClusterProfileEnvVar, "development")
  227. }
  228. // GetClusterID returns the environment variable value for ClusterIDEnvVar which represents the
  229. // configurable identifier used for multi-cluster metric emission.
  230. func GetClusterID() string {
  231. return env.Get(ClusterIDEnvVar, "")
  232. }
  233. func IsKubeRbacProxyEnabled() bool {
  234. return env.GetBool(KubeRbacProxyEnabled, false)
  235. }
  236. // IsRemoteEnabled returns the environment variable value for RemoteEnabledEnvVar which represents whether
  237. // or not remote write is enabled for prometheus for use with SQL backed persistent storage.
  238. func IsRemoteEnabled() bool {
  239. return env.GetBool(RemoteEnabledEnvVar, false)
  240. }
  241. // GetRemotePW returns the environment variable value for RemotePWEnvVar which represents the remote
  242. // persistent storage password.
  243. func GetRemotePW() string {
  244. return env.Get(RemotePWEnvVar, "")
  245. }
  246. // GetSQLAddress returns the environment variable value for SQLAddressEnvVar which represents the SQL
  247. // database address used with remote persistent storage.
  248. func GetSQLAddress() string {
  249. return env.Get(SQLAddressEnvVar, "")
  250. }
  251. // IsUseCSVProvider returns the environment variable value for UseCSVProviderEnvVar which represents
  252. // whether or not the use of a CSV cost provider is enabled.
  253. func IsUseCSVProvider() bool {
  254. return env.GetBool(UseCSVProviderEnvVar, false)
  255. }
  256. // IsUseCustomProvider returns the environment variable value for UseCustomProviderEnvVar which represents
  257. // whether or not the use of a custom cost provider is enabled.
  258. func IsUseCustomProvider() bool {
  259. return env.GetBool(UseCustomProviderEnvVar, false)
  260. }
  261. // GetCSVRegion returns the environment variable value for CSVRegionEnvVar which represents the
  262. // region configured for a CSV provider.
  263. func GetCSVRegion() string {
  264. return env.Get(CSVRegionEnvVar, "")
  265. }
  266. // GetCSVEndpoint returns the environment variable value for CSVEndpointEnvVar which represents the
  267. // endpoint configured for a S3 CSV provider another than AWS S3.
  268. func GetCSVEndpoint() string {
  269. return env.Get(CSVEndpointEnvVar, "")
  270. }
  271. // GetCSVPath returns the environment variable value for CSVPathEnvVar which represents the key path
  272. // configured for a CSV provider.
  273. func GetCSVPath() string {
  274. return env.Get(CSVPathEnvVar, "")
  275. }
  276. // GetCostAnalyzerVolumeMountPath is an alias of GetConfigPath, which returns the mount path for the
  277. // Cost Analyzer volume, which stores configs, persistent data, etc.
  278. func GetCostAnalyzerVolumeMountPath() string {
  279. return GetConfigPathWithDefault(DefaultConfigMountPath)
  280. }
  281. // GetConfigPath returns the environment variable value for ConfigPathEnvVar which represents the cost
  282. // model configuration path
  283. func GetConfigPathWithDefault(defaultValue string) string {
  284. return env.Get(ConfigPathEnvVar, defaultValue)
  285. }
  286. // GetCloudProviderAPI returns the environment variable value for CloudProviderAPIEnvVar which represents
  287. // the API key provided for the cloud provider.
  288. func GetCloudProviderAPIKey() string {
  289. return env.Get(CloudProviderAPIKeyEnvVar, "")
  290. }
  291. func GetPVMountPath() string {
  292. return env.Get(PVMountPath, "")
  293. }
  294. // IsCollectorDataSourceEnabeled returns the environment variable which enables a source.OpencostDatasource which does not use uses Prometheus
  295. func IsCollectorDataSourceEnabled() bool {
  296. return env.GetBool(CollectorDataSourceEnabledEnvVar, false)
  297. }
  298. // IsLogCollectionEnabled returns the environment variable value for LogCollectionEnabledEnvVar which represents
  299. // whether or not log collection has been enabled for kubecost deployments.
  300. func IsLogCollectionEnabled() bool {
  301. return env.GetBool(LogCollectionEnabledEnvVar, true)
  302. }
  303. // IsProductAnalyticsEnabled returns the environment variable value for ProductAnalyticsEnabledEnvVar
  304. func IsProductAnalyticsEnabled() bool {
  305. return env.GetBool(ProductAnalyticsEnabledEnvVar, true)
  306. }
  307. // IsErrorReportingEnabled returns the environment variable value for ErrorReportingEnabledEnvVar
  308. func IsErrorReportingEnabled() bool {
  309. return env.GetBool(ErrorReportingEnabledEnvVar, true)
  310. }
  311. // IsValuesReportingEnabled returns the environment variable value for ValuesReportingEnabledEnvVar
  312. func IsValuesReportingEnabled() bool {
  313. return env.GetBool(ValuesReportingEnabledEnvVar, true)
  314. }
  315. // GetKubeConfigPath returns the environment variable value for KubeConfigPathEnvVar
  316. func GetKubeConfigPath() string {
  317. return env.Get(KubeConfigPathEnvVar, "")
  318. }
  319. // GetUTCOffset returns the environment variable value for UTCOffset
  320. func GetUTCOffset() string {
  321. return env.Get(UTCOffsetEnvVar, "")
  322. }
  323. // GetParsedUTCOffset returns the duration of the configured UTC offset
  324. func GetParsedUTCOffset() time.Duration {
  325. offset, err := timeutil.ParseUTCOffset(GetUTCOffset())
  326. if err != nil {
  327. log.Warnf("Failed to parse UTC offset: %s", err)
  328. return time.Duration(0)
  329. }
  330. return offset
  331. }
  332. // IsIngestingPodUID returns the env variable from ingestPodUID, which alters the
  333. // contents of podKeys in Allocation
  334. func IsIngestingPodUID() bool {
  335. return env.GetBool(IngestPodUIDEnvVar, false)
  336. }
  337. func IsAllocationNodeLabelsEnabled() bool {
  338. return env.GetBool(AllocationNodeLabelsEnabled, true)
  339. }
  340. func IsAssetIncludeLocalDiskCost() bool {
  341. return env.GetBool(AssetIncludeLocalDiskCostEnvVar, true)
  342. }
  343. func GetRegionOverrideList() []string {
  344. regionList := env.GetList(regionOverrideList, ",")
  345. if regionList == nil {
  346. return []string{}
  347. }
  348. return regionList
  349. }
  350. func GetDataRetentionDailyResolutionDays() int64 {
  351. return env.GetInt64(DataRetentionDailyResolutionDaysEnvVar, 30)
  352. }
  353. func GetDataRetentionHourlyResolutionHours() int64 {
  354. return env.GetInt64(DataRetentionHourlyResolutionHoursEnvVar, 49)
  355. }
  356. func IsKubernetesEnabled() bool {
  357. return env.Get(KubernetesEnabledEnvVar, "") != ""
  358. }
  359. func IsCloudCostEnabled() bool {
  360. return env.GetBool(CloudCostEnabledEnvVar, false)
  361. }
  362. func IsCustomCostEnabled() bool {
  363. return env.GetBool(CustomCostEnabledEnvVar, false)
  364. }
  365. func GetCloudCostConfigPath() string {
  366. return env.Get(CloudCostConfigPath, "cloud-integration.json")
  367. }
  368. func GetCloudCostMonthToDateInterval() int {
  369. return env.GetInt(CloudCostMonthToDateIntervalVar, 6)
  370. }
  371. func GetCloudCostRefreshRateHours() int64 {
  372. return env.GetInt64(CloudCostRefreshRateHoursEnvVar, 6)
  373. }
  374. func GetCloudCostQueryWindowDays() int64 {
  375. return env.GetInt64(CloudCostQueryWindowDaysEnvVar, 7)
  376. }
  377. func GetCustomCostQueryWindowHours() int64 {
  378. return env.GetInt64(CustomCostQueryWindowDaysEnvVar, 1)
  379. }
  380. func GetCustomCostQueryWindowDays() int64 {
  381. return env.GetInt64(CustomCostQueryWindowDaysEnvVar, 7)
  382. }
  383. func GetCloudCostRunWindowDays() int64 {
  384. return env.GetInt64(CloudCostRunWindowDaysEnvVar, 3)
  385. }
  386. func GetOCIPricingURL() string {
  387. return env.Get(OCIPricingURL, "https://apexapps.oracle.com/pls/apex/cetools/api/v1/products")
  388. }
  389. func GetPluginConfigDir() string {
  390. return env.Get(PluginConfigDirEnvVar, "/opt/opencost/plugin/config")
  391. }
  392. func GetPluginExecutableDir() string {
  393. return env.Get(PluginExecutableDirEnvVar, "/opt/opencost/plugin/bin")
  394. }
  395. func GetCustomCostRefreshRateHours() string {
  396. return env.Get(CustomCostRefreshRateHoursEnvVar, "12h")
  397. }
  398. func IsCarbonEstimatesEnabled() bool {
  399. return env.GetBool(CarbonEstimatesEnabledEnvVar, false)
  400. }
  401. func GetExportBucketConfigFile() string {
  402. return env.Get(ExportBucketConfigFileEnvVar, "")
  403. }
  404. // GetUseCacheV1 is a temporary flag to allow users to opt-in to using the old cache
  405. // Mainly for comparison purposes
  406. func GetUseCacheV1() bool {
  407. return env.GetBool(UseCacheV1, false)
  408. }
  409. func GetReleaseName() string {
  410. return env.Get(ReleaseNameEnvVar, "kubecost")
  411. }
  412. func GetNetworkCostsPort() int {
  413. return env.GetInt(NetworkCostsPortEnvVar, 3001)
  414. }
  415. // IsNodeStatsForceKubeProxy returns true if the node stats client should force the kube proxy direct end
  416. // point formatting
  417. func IsNodeStatsForceKubeProxy() bool {
  418. return env.GetBool(NodeStatsForceKubeProxyEnvVar, false)
  419. }
  420. // GetNodeStatsLocalProxy returns the fully qualified local proxy endpoint for the node stats client IFF the proxyAPI
  421. // is selected.
  422. func GetNodeStatsLocalProxy() string {
  423. return env.Get(NodeStatsLocalProxyEnvVar, "")
  424. }
  425. // IsNodeStatsInsecure returns true if the node stats client should skip TLS verification
  426. func IsNodeStatsInsecure() bool {
  427. return env.GetBool(NodeStatsInsecureEnvVar, false)
  428. }
  429. // GetNodeStatsCertFile returns the path of the cert file
  430. func GetNodeStatsCertFile() string {
  431. return env.Get(NodeStatsCertFileEnvVar, "")
  432. }
  433. // GetNodeStatsKeyFile returns the path of the key file
  434. func GetNodeStatsKeyFile() string {
  435. return env.Get(NodeStatsKeyFileEnvVar, "")
  436. }