costmodelenv.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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. KubecostNamespaceEnvVar = "KUBECOST_NAMESPACE"
  22. PodNameEnvVar = "POD_NAME"
  23. ClusterIDEnvVar = "CLUSTER_ID"
  24. ClusterProfileEnvVar = "CLUSTER_PROFILE"
  25. RemoteEnabledEnvVar = "REMOTE_WRITE_ENABLED"
  26. RemotePWEnvVar = "REMOTE_WRITE_PASSWORD"
  27. SQLAddressEnvVar = "SQL_ADDRESS"
  28. UseCSVProviderEnvVar = "USE_CSV_PROVIDER"
  29. UseCustomProviderEnvVar = "USE_CUSTOM_PROVIDER"
  30. CSVRegionEnvVar = "CSV_REGION"
  31. CSVEndpointEnvVar = "CSV_ENDPOINT"
  32. CSVPathEnvVar = "CSV_PATH"
  33. ConfigPathEnvVar = "CONFIG_PATH"
  34. CloudProviderAPIKeyEnvVar = "CLOUD_PROVIDER_API_KEY"
  35. DisableAggregateCostModelCache = "DISABLE_AGGREGATE_COST_MODEL_CACHE"
  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. CacheWarmingEnabledEnvVar = "CACHE_WARMING_ENABLED"
  50. ETLEnabledEnvVar = "ETL_ENABLED"
  51. ETLResolutionSeconds = "ETL_RESOLUTION_SECONDS"
  52. LegacyExternalAPIDisabledVar = "LEGACY_EXTERNAL_API_DISABLED"
  53. PricingConfigmapName = "PRICING_CONFIGMAP_NAME"
  54. MetricsConfigmapName = "METRICS_CONFIGMAP_NAME"
  55. KubecostJobNameEnvVar = "KUBECOST_JOB_NAME"
  56. KubecostConfigBucketEnvVar = "KUBECOST_CONFIG_BUCKET"
  57. ClusterInfoFileEnabledEnvVar = "CLUSTER_INFO_FILE_ENABLED"
  58. ClusterCacheFileEnabledEnvVar = "CLUSTER_CACHE_FILE_ENABLED"
  59. IngestPodUIDEnvVar = "INGEST_POD_UID"
  60. ETLReadOnlyMode = "ETL_READ_ONLY"
  61. AllocationNodeLabelsEnabled = "ALLOCATION_NODE_LABELS_ENABLED"
  62. AssetIncludeLocalDiskCostEnvVar = "ASSET_INCLUDE_LOCAL_DISK_COST"
  63. regionOverrideList = "REGION_OVERRIDE_LIST"
  64. ExportCSVFile = "EXPORT_CSV_FILE"
  65. ExportCSVLabelsList = "EXPORT_CSV_LABELS_LIST"
  66. ExportCSVLabelsAll = "EXPORT_CSV_LABELS_ALL"
  67. ExportCSVMaxDays = "EXPORT_CSV_MAX_DAYS"
  68. ExportBucketConfigFileEnvVar = "EXPORT_BUCKET_CONFIG_FILE"
  69. DataRetentionDailyResolutionDaysEnvVar = "DATA_RETENTION_DAILY_RESOLUTION_DAYS"
  70. DataRetentionHourlyResolutionHoursEnvVar = "DATA_RETENTION_HOURLY_RESOLUTION_HOURS"
  71. // We assume that Kubernetes is enabled if there is a KUBERNETES_PORT environment variable present
  72. KubernetesEnabledEnvVar = "KUBERNETES_PORT"
  73. CloudCostEnabledEnvVar = "CLOUD_COST_ENABLED"
  74. CloudCostConfigPath = "CLOUD_COST_CONFIG_PATH"
  75. CloudCostMonthToDateIntervalVar = "CLOUD_COST_MONTH_TO_DATE_INTERVAL"
  76. CloudCostRefreshRateHoursEnvVar = "CLOUD_COST_REFRESH_RATE_HOURS"
  77. CloudCostQueryWindowDaysEnvVar = "CLOUD_COST_QUERY_WINDOW_DAYS"
  78. CloudCostRunWindowDaysEnvVar = "CLOUD_COST_RUN_WINDOW_DAYS"
  79. CustomCostEnabledEnvVar = "CUSTOM_COST_ENABLED"
  80. CustomCostQueryWindowDaysEnvVar = "CUSTOM_COST_QUERY_WINDOW_DAYS"
  81. CustomCostRefreshRateHoursEnvVar = "CUSTOM_COST_REFRESH_RATE_HOURS"
  82. PluginConfigDirEnvVar = "PLUGIN_CONFIG_DIR"
  83. PluginExecutableDirEnvVar = "PLUGIN_EXECUTABLE_DIR"
  84. OCIPricingURL = "OCI_PRICING_URL"
  85. CarbonEstimatesEnabledEnvVar = "CARBON_ESTIMATES_ENABLED"
  86. UseCacheV1 = "USE_CACHE_V1"
  87. )
  88. const DefaultConfigMountPath = "/var/configs"
  89. func IsETLReadOnlyMode() bool {
  90. return env.GetBool(ETLReadOnlyMode, false)
  91. }
  92. func GetExportCSVFile() string {
  93. return env.Get(ExportCSVFile, "")
  94. }
  95. func GetExportCSVLabelsAll() bool {
  96. return env.GetBool(ExportCSVLabelsAll, false)
  97. }
  98. func GetExportCSVLabelsList() []string {
  99. return env.GetList(ExportCSVLabelsList, ",")
  100. }
  101. func IsPProfEnabled() bool {
  102. return env.GetBool(PProfEnabledEnvVar, false)
  103. }
  104. func GetExportCSVMaxDays() int {
  105. return env.GetInt(ExportCSVMaxDays, 90)
  106. }
  107. // GetAPIPort returns the environment variable value for APIPortEnvVar which
  108. // is the port number the API is available on.
  109. func GetAPIPort() int {
  110. return env.GetInt(APIPortEnvVar, 9003)
  111. }
  112. // GetKubecostConfigBucket returns a file location for a mounted bucket configuration which is used to store
  113. // a subset of kubecost configurations that require sharing via remote storage.
  114. func GetKubecostConfigBucket() string {
  115. return env.Get(KubecostConfigBucketEnvVar, "")
  116. }
  117. // IsClusterInfoFileEnabled returns true if the cluster info is read from a file or pulled from the local
  118. // cloud provider and kubernetes.
  119. func IsClusterInfoFileEnabled() bool {
  120. return env.GetBool(ClusterInfoFileEnabledEnvVar, false)
  121. }
  122. // IsClusterCacheFileEnabled returns true if the kubernetes cluster data is read from a file or pulled from the local
  123. // kubernetes API.
  124. func IsClusterCacheFileEnabled() bool {
  125. return env.GetBool(ClusterCacheFileEnabledEnvVar, false)
  126. }
  127. func GetPricingConfigmapName() string {
  128. return env.Get(PricingConfigmapName, "pricing-configs")
  129. }
  130. func GetMetricsConfigmapName() string {
  131. return env.Get(MetricsConfigmapName, "metrics-config")
  132. }
  133. // IsEmitNamespaceAnnotationsMetric returns true if cost-model is configured to emit the kube_namespace_annotations metric
  134. // containing the namespace annotations
  135. func IsEmitNamespaceAnnotationsMetric() bool {
  136. return env.GetBool(EmitNamespaceAnnotationsMetricEnvVar, false)
  137. }
  138. // IsEmitPodAnnotationsMetric returns true if cost-model is configured to emit the kube_pod_annotations metric containing
  139. // pod annotations.
  140. func IsEmitPodAnnotationsMetric() bool {
  141. return env.GetBool(EmitPodAnnotationsMetricEnvVar, false)
  142. }
  143. // IsEmitKsmV1Metrics returns true if cost-model is configured to emit all necessary KSM v1
  144. // metrics that were removed in KSM v2
  145. func IsEmitKsmV1Metrics() bool {
  146. return env.GetBool(EmitKsmV1MetricsEnvVar, true)
  147. }
  148. func IsEmitKsmV1MetricsOnly() bool {
  149. return env.GetBool(EmitKsmV1MetricsOnly, false)
  150. }
  151. func IsEmitDeprecatedMetrics() bool {
  152. return env.GetBool(EmitDeprecatedMetrics, false)
  153. }
  154. // GetAWSAccessKeyID returns the environment variable value for AWSAccessKeyIDEnvVar which represents
  155. // the AWS access key for authentication
  156. func GetAWSAccessKeyID() string {
  157. awsAccessKeyID := env.Get(AWSAccessKeyIDEnvVar, "")
  158. // If the sample nil service key name is set, zero it out so that it is not
  159. // misinterpreted as a real service key.
  160. if awsAccessKeyID == "AKIXXX" {
  161. awsAccessKeyID = ""
  162. }
  163. return awsAccessKeyID
  164. }
  165. // GetAWSAccessKeySecret returns the environment variable value for AWSAccessKeySecretEnvVar which represents
  166. // the AWS access key secret for authentication
  167. func GetAWSAccessKeySecret() string {
  168. return env.Get(AWSAccessKeySecretEnvVar, "")
  169. }
  170. // GetAWSClusterID returns the environment variable value for AWSClusterIDEnvVar which represents
  171. // an AWS specific cluster identifier.
  172. func GetAWSClusterID() string {
  173. return env.Get(AWSClusterIDEnvVar, "")
  174. }
  175. // GetAWSPricingURL returns an optional alternative URL to fetch AWS pricing data from; for use in airgapped environments
  176. func GetAWSPricingURL() string {
  177. return env.Get(AWSPricingURL, "")
  178. }
  179. // GetAlibabaAccessKeyID returns the environment variable value for AlibabaAccessKeyIDEnvVar which represents
  180. // the Alibaba access key for authentication
  181. func GetAlibabaAccessKeyID() string {
  182. return env.Get(AlibabaAccessKeyIDEnvVar, "")
  183. }
  184. // GetAlibabaAccessKeySecret returns the environment variable value for AlibabaAccessKeySecretEnvVar which represents
  185. // the Alibaba access key secret for authentication
  186. func GetAlibabaAccessKeySecret() string {
  187. return env.Get(AlibabaAccessKeySecretEnvVar, "")
  188. }
  189. // GetAzureOfferID returns the environment variable value for AzureOfferIDEnvVar which represents
  190. // the Azure offer ID for determining prices.
  191. func GetAzureOfferID() string {
  192. return env.Get(AzureOfferIDEnvVar, "")
  193. }
  194. // GetAzureBillingAccount returns the environment variable value for
  195. // AzureBillingAccountEnvVar which represents the Azure billing
  196. // account for determining prices. If this is specified
  197. // customer-specific prices will be downloaded from the consumption
  198. // price sheet API.
  199. func GetAzureBillingAccount() string {
  200. return env.Get(AzureBillingAccountEnvVar, "")
  201. }
  202. // IsAzureDownloadBillingDataToDisk returns the environment variable value for
  203. // AzureDownloadBillingDataToDiskEnvVar which indicates whether the Azure
  204. // Billing Data should be held in memory or written to disk.
  205. func IsAzureDownloadBillingDataToDisk() bool {
  206. return env.GetBool(AzureDownloadBillingDataToDiskEnvVar, true)
  207. }
  208. // GetKubecostNamespace returns the environment variable value for KubecostNamespaceEnvVar which
  209. // represents the namespace the cost model exists in.
  210. func GetKubecostNamespace() string {
  211. return env.Get(KubecostNamespaceEnvVar, "kubecost")
  212. }
  213. // GetPodName returns the name of the current running pod. If this environment variable is not set,
  214. // empty string is returned.
  215. func GetPodName() string {
  216. return env.Get(PodNameEnvVar, "")
  217. }
  218. // GetClusterProfile returns the environment variable value for ClusterProfileEnvVar which
  219. // represents the cluster profile configured for
  220. func GetClusterProfile() string {
  221. return env.Get(ClusterProfileEnvVar, "development")
  222. }
  223. // GetClusterID returns the environment variable value for ClusterIDEnvVar which represents the
  224. // configurable identifier used for multi-cluster metric emission.
  225. func GetClusterID() string {
  226. return env.Get(ClusterIDEnvVar, "")
  227. }
  228. func IsKubeRbacProxyEnabled() bool {
  229. return env.GetBool(KubeRbacProxyEnabled, false)
  230. }
  231. // IsAggregateCostModelCacheDisabled returns the environment variable value for DisableAggregateCostModelCache which
  232. // will inform the aggregator on whether to load cached data. Defaults to false
  233. func IsAggregateCostModelCacheDisabled() bool {
  234. return env.GetBool(DisableAggregateCostModelCache, 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. // IsLogCollectionEnabled returns the environment variable value for LogCollectionEnabledEnvVar which represents
  292. // whether or not log collection has been enabled for kubecost deployments.
  293. func IsLogCollectionEnabled() bool {
  294. return env.GetBool(LogCollectionEnabledEnvVar, true)
  295. }
  296. // IsProductAnalyticsEnabled returns the environment variable value for ProductAnalyticsEnabledEnvVar
  297. func IsProductAnalyticsEnabled() bool {
  298. return env.GetBool(ProductAnalyticsEnabledEnvVar, true)
  299. }
  300. // IsErrorReportingEnabled returns the environment variable value for ErrorReportingEnabledEnvVar
  301. func IsErrorReportingEnabled() bool {
  302. return env.GetBool(ErrorReportingEnabledEnvVar, true)
  303. }
  304. // IsValuesReportingEnabled returns the environment variable value for ValuesReportingEnabledEnvVar
  305. func IsValuesReportingEnabled() bool {
  306. return env.GetBool(ValuesReportingEnabledEnvVar, true)
  307. }
  308. // GetKubeConfigPath returns the environment variable value for KubeConfigPathEnvVar
  309. func GetKubeConfigPath() string {
  310. return env.Get(KubeConfigPathEnvVar, "")
  311. }
  312. // GetUTCOffset returns the environment variable value for UTCOffset
  313. func GetUTCOffset() string {
  314. return env.Get(UTCOffsetEnvVar, "")
  315. }
  316. // GetParsedUTCOffset returns the duration of the configured UTC offset
  317. func GetParsedUTCOffset() time.Duration {
  318. offset, err := timeutil.ParseUTCOffset(GetUTCOffset())
  319. if err != nil {
  320. log.Warnf("Failed to parse UTC offset: %s", err)
  321. return time.Duration(0)
  322. }
  323. return offset
  324. }
  325. // GetKubecostJobName returns the environment variable value for KubecostJobNameEnvVar
  326. func GetKubecostJobName() string {
  327. return env.Get(KubecostJobNameEnvVar, "kubecost")
  328. }
  329. func IsCacheWarmingEnabled() bool {
  330. return env.GetBool(CacheWarmingEnabledEnvVar, true)
  331. }
  332. func IsETLEnabled() bool {
  333. return env.GetBool(ETLEnabledEnvVar, true)
  334. }
  335. // GetETLResolution determines the resolution of ETL queries. The smaller the
  336. // duration, the higher the resolution; the higher the resolution, the more
  337. // accurate the query results, but the more computationally expensive.
  338. func GetETLResolution() time.Duration {
  339. // Use the configured ETL resolution, or default to
  340. // 5m (i.e. 300s)
  341. secs := time.Duration(env.GetInt64(ETLResolutionSeconds, 300))
  342. return secs * time.Second
  343. }
  344. func LegacyExternalCostsAPIDisabled() bool {
  345. return env.GetBool(LegacyExternalAPIDisabledVar, false)
  346. }
  347. // IsIngestingPodUID returns the env variable from ingestPodUID, which alters the
  348. // contents of podKeys in Allocation
  349. func IsIngestingPodUID() bool {
  350. return env.GetBool(IngestPodUIDEnvVar, false)
  351. }
  352. func GetAllocationNodeLabelsEnabled() bool {
  353. return env.GetBool(AllocationNodeLabelsEnabled, true)
  354. }
  355. func GetAssetIncludeLocalDiskCost() bool {
  356. return env.GetBool(AssetIncludeLocalDiskCostEnvVar, true)
  357. }
  358. func GetRegionOverrideList() []string {
  359. regionList := env.GetList(regionOverrideList, ",")
  360. if regionList == nil {
  361. return []string{}
  362. }
  363. return regionList
  364. }
  365. func GetDataRetentionDailyResolutionDays() int64 {
  366. return env.GetInt64(DataRetentionDailyResolutionDaysEnvVar, 30)
  367. }
  368. func GetDataRetentionHourlyResolutionHours() int64 {
  369. return env.GetInt64(DataRetentionHourlyResolutionHoursEnvVar, 49)
  370. }
  371. func IsKubernetesEnabled() bool {
  372. return env.Get(KubernetesEnabledEnvVar, "") != ""
  373. }
  374. func IsCloudCostEnabled() bool {
  375. return env.GetBool(CloudCostEnabledEnvVar, false)
  376. }
  377. func IsCustomCostEnabled() bool {
  378. return env.GetBool(CustomCostEnabledEnvVar, false)
  379. }
  380. func GetCloudCostConfigPath() string {
  381. return env.Get(CloudCostConfigPath, "cloud-integration.json")
  382. }
  383. func GetCloudCostMonthToDateInterval() int {
  384. return env.GetInt(CloudCostMonthToDateIntervalVar, 6)
  385. }
  386. func GetCloudCostRefreshRateHours() int64 {
  387. return env.GetInt64(CloudCostRefreshRateHoursEnvVar, 6)
  388. }
  389. func GetCloudCostQueryWindowDays() int64 {
  390. return env.GetInt64(CloudCostQueryWindowDaysEnvVar, 7)
  391. }
  392. func GetCustomCostQueryWindowHours() int64 {
  393. return env.GetInt64(CustomCostQueryWindowDaysEnvVar, 1)
  394. }
  395. func GetCustomCostQueryWindowDays() int64 {
  396. return env.GetInt64(CustomCostQueryWindowDaysEnvVar, 7)
  397. }
  398. func GetCloudCostRunWindowDays() int64 {
  399. return env.GetInt64(CloudCostRunWindowDaysEnvVar, 3)
  400. }
  401. func GetOCIPricingURL() string {
  402. return env.Get(OCIPricingURL, "https://apexapps.oracle.com/pls/apex/cetools/api/v1/products")
  403. }
  404. func GetPluginConfigDir() string {
  405. return env.Get(PluginConfigDirEnvVar, "/opt/opencost/plugin/config")
  406. }
  407. func GetPluginExecutableDir() string {
  408. return env.Get(PluginExecutableDirEnvVar, "/opt/opencost/plugin/bin")
  409. }
  410. func GetCustomCostRefreshRateHours() string {
  411. return env.Get(CustomCostRefreshRateHoursEnvVar, "12h")
  412. }
  413. func IsCarbonEstimatesEnabled() bool {
  414. return env.GetBool(CarbonEstimatesEnabledEnvVar, false)
  415. }
  416. func GetExportBucketConfigFile() string {
  417. return env.Get(ExportBucketConfigFileEnvVar, "")
  418. }
  419. // GetUseCacheV1 is a temporary flag to allow users to opt-in to using the old cache
  420. // Mainly for comparison purposes
  421. func GetUseCacheV1() bool {
  422. return env.GetBool(UseCacheV1, false)
  423. }
  424. func GetReleaseName() string {
  425. return env.Get(ReleaseNameEnvVar, "kubecost")
  426. }
  427. func GetNetworkCostsPort() int {
  428. return env.GetInt(NetworkCostsPortEnvVar, 3001)
  429. }