env

package
v1.109.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIPortEnvVar = "API_PORT"

	AWSAccessKeyIDEnvVar     = "AWS_ACCESS_KEY_ID"
	AWSAccessKeySecretEnvVar = "AWS_SECRET_ACCESS_KEY"
	AWSClusterIDEnvVar       = "AWS_CLUSTER_ID"
	AWSPricingURL            = "AWS_PRICING_URL"

	AlibabaAccessKeyIDEnvVar     = "ALIBABA_ACCESS_KEY_ID"
	AlibabaAccessKeySecretEnvVar = "ALIBABA_SECRET_ACCESS_KEY"

	AzureOfferIDEnvVar        = "AZURE_OFFER_ID"
	AzureBillingAccountEnvVar = "AZURE_BILLING_ACCOUNT"

	KubecostNamespaceEnvVar        = "KUBECOST_NAMESPACE"
	PodNameEnvVar                  = "POD_NAME"
	ClusterIDEnvVar                = "CLUSTER_ID"
	ClusterProfileEnvVar           = "CLUSTER_PROFILE"
	PrometheusServerEndpointEnvVar = "PROMETHEUS_SERVER_ENDPOINT"
	MaxQueryConcurrencyEnvVar      = "MAX_QUERY_CONCURRENCY"
	QueryLoggingFileEnvVar         = "QUERY_LOGGING_FILE"
	RemoteEnabledEnvVar            = "REMOTE_WRITE_ENABLED"
	RemotePWEnvVar                 = "REMOTE_WRITE_PASSWORD"
	SQLAddressEnvVar               = "SQL_ADDRESS"
	UseCSVProviderEnvVar           = "USE_CSV_PROVIDER"
	CSVRegionEnvVar                = "CSV_REGION"
	CSVEndpointEnvVar              = "CSV_ENDPOINT"
	CSVPathEnvVar                  = "CSV_PATH"
	ConfigPathEnvVar               = "CONFIG_PATH"
	CloudProviderAPIKeyEnvVar      = "CLOUD_PROVIDER_API_KEY"
	DisableAggregateCostModelCache = "DISABLE_AGGREGATE_COST_MODEL_CACHE"

	EmitPodAnnotationsMetricEnvVar       = "EMIT_POD_ANNOTATIONS_METRIC"
	EmitNamespaceAnnotationsMetricEnvVar = "EMIT_NAMESPACE_ANNOTATIONS_METRIC"
	EmitDeprecatedMetrics                = "EMIT_DEPRECATED_METRICS"

	EmitKsmV1MetricsEnvVar = "EMIT_KSM_V1_METRICS"
	EmitKsmV1MetricsOnly   = "EMIT_KSM_V1_METRICS_ONLY"

	ThanosEnabledEnvVar      = "THANOS_ENABLED"
	ThanosQueryUrlEnvVar     = "THANOS_QUERY_URL"
	ThanosOffsetEnvVar       = "THANOS_QUERY_OFFSET"
	ThanosMaxSourceResEnvVar = "THANOS_MAX_SOURCE_RESOLUTION"

	PProfEnabledEnvVar = "PPROF_ENABLED"

	LogCollectionEnabledEnvVar    = "LOG_COLLECTION_ENABLED"
	ProductAnalyticsEnabledEnvVar = "PRODUCT_ANALYTICS_ENABLED"
	ErrorReportingEnabledEnvVar   = "ERROR_REPORTING_ENABLED"
	ValuesReportingEnabledEnvVar  = "VALUES_REPORTING_ENABLED"

	DBBasicAuthUsername = "DB_BASIC_AUTH_USERNAME"
	DBBasicAuthPassword = "DB_BASIC_AUTH_PW"
	DBBearerToken       = "DB_BEARER_TOKEN"

	MultiClusterBasicAuthUsername = "MC_BASIC_AUTH_USERNAME"
	MultiClusterBasicAuthPassword = "MC_BASIC_AUTH_PW"
	MultiClusterBearerToken       = "MC_BEARER_TOKEN"

	InsecureSkipVerify = "INSECURE_SKIP_VERIFY"

	KubeConfigPathEnvVar = "KUBECONFIG_PATH"

	UTCOffsetEnvVar                  = "UTC_OFFSET"
	CurrentClusterIdFilterEnabledVar = "CURRENT_CLUSTER_ID_FILTER_ENABLED"

	CacheWarmingEnabledEnvVar            = "CACHE_WARMING_ENABLED"
	ETLEnabledEnvVar                     = "ETL_ENABLED"
	ETLMaxPrometheusQueryDurationMinutes = "ETL_MAX_PROMETHEUS_QUERY_DURATION_MINUTES"
	ETLResolutionSeconds                 = "ETL_RESOLUTION_SECONDS"
	LegacyExternalAPIDisabledVar         = "LEGACY_EXTERNAL_API_DISABLED"

	PromClusterIDLabelEnvVar = "PROM_CLUSTER_ID_LABEL"

	PricingConfigmapName  = "PRICING_CONFIGMAP_NAME"
	MetricsConfigmapName  = "METRICS_CONFIGMAP_NAME"
	KubecostJobNameEnvVar = "KUBECOST_JOB_NAME"

	KubecostConfigBucketEnvVar    = "KUBECOST_CONFIG_BUCKET"
	ClusterInfoFileEnabledEnvVar  = "CLUSTER_INFO_FILE_ENABLED"
	ClusterCacheFileEnabledEnvVar = "CLUSTER_CACHE_FILE_ENABLED"

	PrometheusQueryOffsetEnvVar                 = "PROMETHEUS_QUERY_OFFSET"
	PrometheusRetryOnRateLimitResponseEnvVar    = "PROMETHEUS_RETRY_ON_RATE_LIMIT"
	PrometheusRetryOnRateLimitMaxRetriesEnvVar  = "PROMETHEUS_RETRY_ON_RATE_LIMIT_MAX_RETRIES"
	PrometheusRetryOnRateLimitDefaultWaitEnvVar = "PROMETHEUS_RETRY_ON_RATE_LIMIT_DEFAULT_WAIT"

	PrometheusHeaderXScopeOrgIdEnvVar = "PROMETHEUS_HEADER_X_SCOPE_ORGID"

	IngestPodUIDEnvVar = "INGEST_POD_UID"

	ETLReadOnlyMode = "ETL_READ_ONLY"

	AllocationNodeLabelsEnabled     = "ALLOCATION_NODE_LABELS_ENABLED"
	AllocationNodeLabelsIncludeList = "ALLOCATION_NODE_LABELS_INCLUDE_LIST"

	ExportCSVFile       = "EXPORT_CSV_FILE"
	ExportCSVLabelsList = "EXPORT_CSV_LABELS_LIST"
	ExportCSVLabelsAll  = "EXPORT_CSV_LABELS_ALL"
	ExportCSVMaxDays    = "EXPORT_CSV_MAX_DAYS"

	DataRetentionDailyResolutionDaysEnvVar = "DATA_RETENTION_DAILY_RESOLUTION_DAYS"

	// We assume that Kubernetes is enabled if there is a KUBERNETES_PORT environment variable present
	KubernetesEnabledEnvVar         = "KUBERNETES_PORT"
	CloudCostEnabledEnvVar          = "CLOUD_COST_ENABLED"
	CloudCostConfigPath             = "CLOUD_COST_CONFIG_PATH"
	CloudCostMonthToDateIntervalVar = "CLOUD_COST_MONTH_TO_DATE_INTERVAL"
	CloudCostRefreshRateHoursEnvVar = "CLOUD_COST_REFRESH_RATE_HOURS"
	CloudCostQueryWindowDaysEnvVar  = "CLOUD_COST_QUERY_WINDOW_DAYS"
	CloudCostRunWindowDaysEnvVar    = "CLOUD_COST_RUN_WINDOW_DAYS"

	OCIPricingURL = "OCI_PRICING_URL"
)
View Source
const (
	KubecostMetricsPodEnabledEnvVar = "KUBECOST_METRICS_POD_ENABLED"
	KubecostMetricsPodPortEnvVar    = "KUBECOST_METRICS_PORT"
	ExportClusterCacheEnabledEnvVar = "EXPORT_CLUSTER_CACHE_ENABLED"
	ExportClusterInfoEnabledEnvVar  = "EXPORT_CLUSTER_INFO_ENABLED"
)
View Source
const DefaultConfigMountPath = "/var/configs"

Variables

This section is empty.

Functions

func GetAPIPort added in v1.108.0

func GetAPIPort() int

GetAPIPort returns the environment variable value for APIPortEnvVar which is the port number the API is available on.

func GetAWSAccessKeyID

func GetAWSAccessKeyID() string

GetAWSAccessKeyID returns the environment variable value for AWSAccessKeyIDEnvVar which represents the AWS access key for authentication

func GetAWSAccessKeySecret

func GetAWSAccessKeySecret() string

GetAWSAccessKeySecret returns the environment variable value for AWSAccessKeySecretEnvVar which represents the AWS access key secret for authentication

func GetAWSClusterID

func GetAWSClusterID() string

GetAWSClusterID returns the environment variable value for AWSClusterIDEnvVar which represents an AWS specific cluster identifier.

func GetAWSPricingURL added in v1.99.0

func GetAWSPricingURL() string

GetAWSPricingURL returns an optional alternative URL to fetch AWS pricing data from; for use in airgapped environments

func GetAlibabaAccessKeyID added in v1.99.0

func GetAlibabaAccessKeyID() string

GetAlibabaAccessKeyID returns the environment variable value for AlibabaAccessKeyIDEnvVar which represents the Alibaba access key for authentication

func GetAlibabaAccessKeySecret added in v1.99.0

func GetAlibabaAccessKeySecret() string

GetAlibabaAccessKeySecret returns the environment variable value for AlibabaAccessKeySecretEnvVar which represents the Alibaba access key secret for authentication

func GetAllocationNodeLabelsEnabled added in v1.100.0

func GetAllocationNodeLabelsEnabled() bool

func GetAllocationNodeLabelsIncludeList added in v1.100.0

func GetAllocationNodeLabelsIncludeList() []string

func GetAzureBillingAccount added in v1.103.0

func GetAzureBillingAccount() string

GetAzureBillingAccount returns the environment variable value for AzureBillingAccountEnvVar which represents the Azure billing account for determining prices. If this is specified customer-specific prices will be downloaded from the consumption price sheet API.

func GetAzureOfferID added in v1.103.0

func GetAzureOfferID() string

GetAzureOfferID returns the environment variable value for AzureOfferIDEnvVar which represents the Azure offer ID for determining prices.

func GetCSVEndpoint

func GetCSVEndpoint() string

GetCSVEndpoint returns the environment variable value for CSVEndpointEnvVar which represents the endpoint configured for a S3 CSV provider another than AWS S3.

func GetCSVPath

func GetCSVPath() string

GetCSVPath returns the environment variable value for CSVPathEnvVar which represents the key path configured for a CSV provider.

func GetCSVRegion

func GetCSVRegion() string

GetCSVRegion returns the environment variable value for CSVRegionEnvVar which represents the region configured for a CSV provider.

func GetCloudCostConfigPath added in v1.109.0

func GetCloudCostConfigPath() string

func GetCloudCostMonthToDateInterval added in v1.108.0

func GetCloudCostMonthToDateInterval() int

func GetCloudCostQueryWindowDays added in v1.108.0

func GetCloudCostQueryWindowDays() int64

func GetCloudCostRefreshRateHours added in v1.108.0

func GetCloudCostRefreshRateHours() int64

func GetCloudCostRunWindowDays added in v1.108.0

func GetCloudCostRunWindowDays() int64

func GetCloudProviderAPIKey

func GetCloudProviderAPIKey() string

GetCloudProviderAPI returns the environment variable value for CloudProviderAPIEnvVar which represents the API key provided for the cloud provider.

func GetClusterID

func GetClusterID() string

GetClusterID returns the environment variable value for ClusterIDEnvVar which represents the configurable identifier used for multi-cluster metric emission.

func GetClusterProfile

func GetClusterProfile() string

GetClusterProfile returns the environment variable value for ClusterProfileEnvVar which represents the cluster profile configured for

func GetConfigPathWithDefault

func GetConfigPathWithDefault(defaultValue string) string

GetConfigPath returns the environment variable value for ConfigPathEnvVar which represents the cost model configuration path

func GetCostAnalyzerVolumeMountPath added in v1.102.0

func GetCostAnalyzerVolumeMountPath() string

GetCostAnalyzerVolumeMountPath is an alias of GetConfigPath, which returns the mount path for the Cost Analyzer volume, which stores configs, persistent data, etc.

func GetDBBasicAuthUserPassword

func GetDBBasicAuthUserPassword() string

func GetDBBasicAuthUsername

func GetDBBasicAuthUsername() string

func GetDBBearerToken

func GetDBBearerToken() string

func GetDataRetentionDailyResolutionDays added in v1.108.0

func GetDataRetentionDailyResolutionDays() int64

func GetETLMaxPrometheusQueryDuration

func GetETLMaxPrometheusQueryDuration() time.Duration

func GetETLResolution

func GetETLResolution() time.Duration

GetETLResolution determines the resolution of ETL queries. The smaller the duration, the higher the resolution; the higher the resolution, the more accurate the query results, but the more computationally expensive.

func GetExportCSVFile added in v1.104.0

func GetExportCSVFile() string

func GetExportCSVLabelsAll added in v1.104.0

func GetExportCSVLabelsAll() bool

func GetExportCSVLabelsList added in v1.104.0

func GetExportCSVLabelsList() []string

func GetExportCSVMaxDays added in v1.107.0

func GetExportCSVMaxDays() int

func GetInsecureSkipVerify

func GetInsecureSkipVerify() bool

func GetKubeConfigPath

func GetKubeConfigPath() string

GetKubeConfigPath returns the environment variable value for KubeConfigPathEnvVar

func GetKubecostConfigBucket

func GetKubecostConfigBucket() string

GetKubecostConfigBucket returns a file location for a mounted bucket configuration which is used to store a subset of kubecost configurations that require sharing via remote storage.

func GetKubecostJobName

func GetKubecostJobName() string

GetKubecostJobName returns the environment variable value for KubecostJobNameEnvVar

func GetKubecostMetricsPort

func GetKubecostMetricsPort() int

func GetKubecostNamespace

func GetKubecostNamespace() string

GetKubecostNamespace returns the environment variable value for KubecostNamespaceEnvVar which represents the namespace the cost model exists in.

func GetMaxQueryConcurrency

func GetMaxQueryConcurrency() int

GetMaxQueryConcurrency returns the environment variable value for MaxQueryConcurrencyEnvVar

func GetMetricsConfigmapName

func GetMetricsConfigmapName() string

func GetMultiClusterBasicAuthPassword

func GetMultiClusterBasicAuthPassword() string

GetMultiClusterBasicAuthPassword returns the environment variable value for MultiClusterBasicAuthPassword

func GetMultiClusterBasicAuthUsername

func GetMultiClusterBasicAuthUsername() string

GetMultiClusterBasicAuthUsername returns the environment variable value for MultiClusterBasicAuthUsername

func GetMultiClusterBearerToken

func GetMultiClusterBearerToken() string

func GetOCIPricingURL added in v1.109.0

func GetOCIPricingURL() string

func GetParsedUTCOffset

func GetParsedUTCOffset() time.Duration

GetParsedUTCOffset returns the duration of the configured UTC offset

func GetPodName

func GetPodName() string

GetPodName returns the name of the current running pod. If this environment variable is not set, empty string is returned.

func GetPricingConfigmapName

func GetPricingConfigmapName() string

func GetPromClusterFilter added in v1.104.0

func GetPromClusterFilter() string

GetPromClusterFilter returns environment variable value CurrentClusterIdFilterEnabledVar which represents additional prometheus filter for all metrics for current cluster id

func GetPromClusterLabel

func GetPromClusterLabel() string

GetPromClusterLabel returns the environment variable value for PromClusterIDLabel

func GetPrometheusHeaderXScopeOrgId added in v1.106.0

func GetPrometheusHeaderXScopeOrgId() string

GetPrometheusHeaderXScopeOrgId returns the default value for X-Scope-OrgID header used for requests in Mimir/Cortex-Tenant API. To use Mimir(or Cortex-Tenant) instead of Prometheus add variable from cluster settings: "PROMETHEUS_HEADER_X_SCOPE_ORGID": "my-cluster-name" Then set Prometheus URL to prometheus API endpoint: "PROMETHEUS_SERVER_ENDPOINT": "http://mimir-url/prometheus/"

func GetPrometheusQueryOffset

func GetPrometheusQueryOffset() time.Duration

GetPrometheusQueryOffset returns the time.Duration to offset all prometheus queries by. NOTE: This env var is applied to all non-range queries made via our query context. This should only be applied when there is a significant delay in data arriving in the target prom db. For example, if supplying a thanos or cortex querier for the prometheus server, using a 3h offset will ensure that current time = current time - 3h.

This offset is NOT the same as the GetThanosOffset() option, as that is only applied to queries made specifically targeting thanos. This offset is applied globally.

func GetPrometheusRetryOnRateLimitDefaultWait

func GetPrometheusRetryOnRateLimitDefaultWait() time.Duration

GetPrometheusRetryOnRateLimitDefaultWait returns the default wait time for a retriable rate limit response without a Retry-After header.

func GetPrometheusRetryOnRateLimitMaxRetries

func GetPrometheusRetryOnRateLimitMaxRetries() int

GetPrometheusRetryOnRateLimitMaxRetries returns the maximum number of retries that should be attempted prior to failing. Only used if IsPrometheusRetryOnRateLimitResponse() is true.

func GetPrometheusServerEndpoint

func GetPrometheusServerEndpoint() string

GetPrometheusServerEndpoint returns the environment variable value for PrometheusServerEndpointEnvVar which represents the prometheus server endpoint used to execute prometheus queries.

func GetQueryLoggingFile

func GetQueryLoggingFile() string

GetQueryLoggingFile returns a file location if query logging is enabled. Otherwise, empty string

func GetRegionOverrideList added in v1.101.0

func GetRegionOverrideList() []string

func GetRemotePW

func GetRemotePW() string

GetRemotePW returns the environment variable value for RemotePWEnvVar which represents the remote persistent storage password.

func GetSQLAddress

func GetSQLAddress() string

GetSQLAddress returns the environment variable value for SQLAddressEnvVar which represents the SQL database address used with remote persistent storage.

func GetThanosMaxSourceResolution

func GetThanosMaxSourceResolution() string

GetThanosMaxSourceResolution returns the environment variable value for ThanosMaxSourceResEnvVar which represents the max source resolution to use when querying thanos.

func GetThanosOffset

func GetThanosOffset() string

GetThanosOffset returns the environment variable value for ThanosOffsetEnvVar which represents the total amount of time to offset all queries made to thanos.

func GetThanosQueryUrl

func GetThanosQueryUrl() string

GetThanosQueryUrl returns the environment variable value for ThanosQueryUrlEnvVar which represents the target query endpoint for hitting thanos.

func GetUTCOffset

func GetUTCOffset() string

GetUTCOffset returns the environment variable value for UTCOffset

func IsAggregateCostModelCacheDisabled added in v1.99.0

func IsAggregateCostModelCacheDisabled() bool

IsAggregateCostModelCacheDisabled returns the environment variable value for DisableAggregateCostModelCache which will inform the aggregator on whether to load cached data. Defaults to false

func IsCacheWarmingEnabled

func IsCacheWarmingEnabled() bool

func IsCloudCostEnabled added in v1.108.0

func IsCloudCostEnabled() bool

func IsClusterCacheFileEnabled

func IsClusterCacheFileEnabled() bool

IsClusterCacheFileEnabled returns true if the kubernetes cluster data is read from a file or pulled from the local kubernetes API.

func IsClusterInfoFileEnabled

func IsClusterInfoFileEnabled() bool

IsClusterInfoFileEnabled returns true if the cluster info is read from a file or pulled from the local cloud provider and kubernetes.

func IsETLEnabled

func IsETLEnabled() bool

func IsETLReadOnlyMode

func IsETLReadOnlyMode() bool

func IsEmitDeprecatedMetrics added in v1.109.0

func IsEmitDeprecatedMetrics() bool

func IsEmitKsmV1Metrics

func IsEmitKsmV1Metrics() bool

IsEmitKsmV1Metrics returns true if cost-model is configured to emit all necessary KSM v1 metrics that were removed in KSM v2

func IsEmitKsmV1MetricsOnly

func IsEmitKsmV1MetricsOnly() bool

func IsEmitNamespaceAnnotationsMetric

func IsEmitNamespaceAnnotationsMetric() bool

IsEmitNamespaceAnnotationsMetric returns true if cost-model is configured to emit the kube_namespace_annotations metric containing the namespace annotations

func IsEmitPodAnnotationsMetric

func IsEmitPodAnnotationsMetric() bool

IsEmitPodAnnotationsMetric returns true if cost-model is configured to emit the kube_pod_annotations metric containing pod annotations.

func IsErrorReportingEnabled

func IsErrorReportingEnabled() bool

IsErrorReportingEnabled returns the environment variable value for ErrorReportingEnabledEnvVar

func IsExportClusterCacheEnabled

func IsExportClusterCacheEnabled() bool

IsExportClusterCacheEnabled is set to true if the metrics pod should export the cluster cache data to a target file location

func IsExportClusterInfoEnabled

func IsExportClusterInfoEnabled() bool

IsExportClusterInfoEnabled is set to true if the metrics pod should export its own cluster info data to a target file location

func IsIngestingPodUID

func IsIngestingPodUID() bool

IsIngestingPodUID returns the env variable from ingestPodUID, which alters the contents of podKeys in Allocation

func IsKubecostMetricsPodEnabled

func IsKubecostMetricsPodEnabled() bool

IsKubecostMetricsPodEnabled returns true if the kubecost metrics pod is deployed

func IsKubernetesEnabled added in v1.109.0

func IsKubernetesEnabled() bool

func IsLogCollectionEnabled

func IsLogCollectionEnabled() bool

IsLogCollectionEnabled returns the environment variable value for LogCollectionEnabledEnvVar which represents whether or not log collection has been enabled for kubecost deployments.

func IsPProfEnabled added in v1.108.0

func IsPProfEnabled() bool

func IsProductAnalyticsEnabled

func IsProductAnalyticsEnabled() bool

IsProductAnalyticsEnabled returns the environment variable value for ProductAnalyticsEnabledEnvVar

func IsPrometheusRetryOnRateLimitResponse

func IsPrometheusRetryOnRateLimitResponse() bool

IsPrometheusRetryOnRateLimitResponse will attempt to retry if a 429 response is received OR a 400 with a body containing ThrottleException (common in AWS services like AMP)

func IsRemoteEnabled

func IsRemoteEnabled() bool

IsRemoteEnabled returns the environment variable value for RemoteEnabledEnvVar which represents whether or not remote write is enabled for prometheus for use with SQL backed persistent storage.

func IsThanosEnabled

func IsThanosEnabled() bool

IsThanosEnabled returns the environment variable value for ThanosEnabledEnvVar which represents whether or not thanos is enabled.

func IsUseCSVProvider

func IsUseCSVProvider() bool

IsUseCSVProvider returns the environment variable value for UseCSVProviderEnvVar which represents whether or not the use of a CSV cost provider is enabled.

func IsValuesReportingEnabled

func IsValuesReportingEnabled() bool

IsValuesReportingEnabled returns the environment variable value for ValuesReportingEnabledEnvVar

func LegacyExternalCostsAPIDisabled

func LegacyExternalCostsAPIDisabled() bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL