Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertAwsAthenaInfoToConfig(aai AwsAthenaInfo) cloud.KeyedConfig
- func GetAthenaQueryFunc(fn func(types.Row)) func(*athena.GetQueryResultsOutput) bool
- func GetAthenaRowValue(row types.Row, queryColumnIndexes map[string]int, columnName string) string
- func GetAthenaRowValueFloat(row types.Row, queryColumnIndexes map[string]int, columnName string) (float64, error)
- func GetCSVRowValue(row []string, queryColumnIndexes map[string]int, columnName string) string
- func GetCSVRowValueFloat(row []string, queryColumnIndexes map[string]int, columnName string) (float64, error)
- func ParseARN(id string) string
- func SelectAWSCategory(providerID, usageType, service string) string
- type AWS
- func (aws *AWS) AllNodePricing() (interface{}, error)
- func (aws *AWS) ApplyReservedInstancePricing(nodes map[string]*models.Node)
- func (awsProvider *AWS) ClusterInfo() (map[string]string, error)
- func (aws *AWS) ClusterManagementPricing() (string, float64, error)
- func (aws *AWS) CombinedDiscountForNode(instanceType string, isPreemptible bool, ...) float64
- func (aws *AWS) ConfigureAuth() error
- func (aws *AWS) ConfigureAuthWith(config *models.CustomPricing) error
- func (aws *AWS) DownloadPricingData() error
- func (aws *AWS) GetAWSAccessKey() (*AWSAccessKey, error)
- func (aws *AWS) GetAWSAthenaInfo() (*AwsAthenaInfo, error)
- func (aws *AWS) GetAddresses() ([]byte, error)
- func (aws *AWS) GetConfig() (*models.CustomPricing, error)
- func (aws *AWS) GetDisks() ([]byte, error)
- func (aws *AWS) GetKey(labels map[string]string, n *v1.Node) models.Key
- func (aws *AWS) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string
- func (aws *AWS) GetManagementPlatform() (string, error)
- func (aws *AWS) GetOrphanedResources() ([]models.OrphanedResource, error)
- func (aws *AWS) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) models.PVKey
- func (aws *AWS) GetReservationDataFromAthena() error
- func (aws *AWS) GetSavingsPlanDataFromAthena() error
- func (aws *AWS) KubeAttrConversion(region, instanceType, operatingSystem string) string
- func (aws *AWS) LoadBalancerPricing() (*models.LoadBalancer, error)
- func (aws *AWS) NetworkPricing() (*models.Network, error)
- func (aws *AWS) NodePricing(k models.Key) (*models.Node, models.PricingMetadata, error)
- func (aws *AWS) PVPricing(pvk models.PVKey) (*models.PV, error)
- func (aws *AWS) PricingSourceStatus() map[string]*models.PricingSource
- func (aws *AWS) PricingSourceSummary() interface{}
- func (aws *AWS) QueryAthenaPaginated(ctx context.Context, query string, fn func(*athena.GetQueryResultsOutput) bool) error
- func (aws *AWS) Regions() []string
- func (aws *AWS) ServiceAccountStatus() *models.ServiceAccountStatus
- func (aws *AWS) SpotRefreshEnabled() bool
- func (aws *AWS) UpdateConfig(r io.Reader, updateType string) (*models.CustomPricing, error)
- func (aws *AWS) UpdateConfigFromConfigMap(cm map[string]string) (*models.CustomPricing, error)
- type AWSAccessKey
- type AWSCurrencyCode
- type AWSOfferTerm
- type AWSPricing
- type AWSPricingTerms
- type AWSProduct
- type AWSProductAttributes
- type AWSProductTerms
- type AWSRateCode
- type AccessKey
- func (ak *AccessKey) CreateAWSConfig(region string) (cfg aws.Config, err error)
- func (ak *AccessKey) Equals(config cloud.Config) bool
- func (ak *AccessKey) MarshalJSON() ([]byte, error)
- func (ak *AccessKey) Retrieve(ctx context.Context) (aws.Credentials, error)
- func (ak *AccessKey) Sanitize() cloud.Config
- func (ak *AccessKey) Validate() error
- type AssumeRole
- func (ara *AssumeRole) CreateAWSConfig(region string) (aws.Config, error)
- func (ara *AssumeRole) Equals(config cloud.Config) bool
- func (ara *AssumeRole) MarshalJSON() ([]byte, error)
- func (ara *AssumeRole) Sanitize() cloud.Config
- func (ara *AssumeRole) UnmarshalJSON(b []byte) error
- func (ara *AssumeRole) Validate() error
- type AthenaConfiguration
- func (ac *AthenaConfiguration) Equals(config cloud.Config) bool
- func (ac *AthenaConfiguration) Key() string
- func (ac *AthenaConfiguration) Provider() string
- func (ac *AthenaConfiguration) Sanitize() cloud.Config
- func (ac *AthenaConfiguration) UnmarshalJSON(b []byte) error
- func (ac *AthenaConfiguration) Validate() error
- type AthenaIntegration
- func (ai *AthenaIntegration) ConvertLabelToAWSTag(label string) string
- func (ai *AthenaIntegration) GetAmortizedCostCase(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetAmortizedCostColumn(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetAmortizedNetCostCase(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetAmortizedNetCostColumn(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetCloudCost(start, end time.Time) (*opencost.CloudCostSetRange, error)
- func (ai *AthenaIntegration) GetConnectionStatusFromResult(result cloud.EmptyChecker, currentStatus cloud.ConnectionStatus) cloud.ConnectionStatus
- func (ai *AthenaIntegration) GetIsKubernetesColumn(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetListCostColumn() string
- func (ai *AthenaIntegration) GetNetCostColumn(allColumns map[string]bool) string
- func (ai *AthenaIntegration) GetPartitionWhere(start, end time.Time) string
- func (ai *AthenaIntegration) RemoveColumnAliases(columns []string)
- func (ai *AthenaIntegration) RowToCloudCost(row types.Row, aqi AthenaQueryIndexes, ccsr *opencost.CloudCostSetRange) error
- type AthenaQuerier
- func (aq *AthenaQuerier) Equals(config cloud.Config) bool
- func (aq *AthenaQuerier) GetAthenaClient() (*athena.Client, error)
- func (aq *AthenaQuerier) GetColumns() (map[string]bool, error)
- func (aq *AthenaQuerier) GetStatus() cloud.ConnectionStatus
- func (aq *AthenaQuerier) Query(ctx context.Context, query string, fn func(*athena.GetQueryResultsOutput) bool) error
- type AthenaQueryIndexes
- type Authorizer
- type AwsAthenaInfo
- type AwsSpotFeedInfo
- type GoogleIDTokenRetriever
- type IDTokenRetriever
- type RIData
- type S3Configuration
- func (s3c *S3Configuration) CreateAWSConfig() (aws.Config, error)
- func (s3c *S3Configuration) Equals(config cloud.Config) bool
- func (s3c *S3Configuration) Key() string
- func (s3c *S3Configuration) Provider() string
- func (s3c *S3Configuration) Sanitize() cloud.Config
- func (s3c *S3Configuration) UnmarshalJSON(b []byte) error
- func (s3c *S3Configuration) Validate() error
- type S3Connection
- type S3SelectIntegration
- type S3SelectQuerier
- func (s3sq *S3SelectQuerier) Equals(config cloud.Config) bool
- func (s3sq *S3SelectQuerier) GetHeaders(queryKey string, cli *s3.Client) ([]string, error)
- func (s3sq *S3SelectQuerier) GetQueryKeys(start, end time.Time, client *s3.Client) ([]string, error)
- func (s3sq *S3SelectQuerier) Query(query string, queryKeys []string, cli *s3.Client, fn func(*csv.Reader) error) error
- type SavingsPlanData
- type ServiceAccount
- type WebIdentity
- func (wea *WebIdentity) CreateAWSConfig(region string) (aws.Config, error)
- func (wea *WebIdentity) Equals(config cloud.Config) bool
- func (wea *WebIdentity) MarshalJSON() ([]byte, error)
- func (wea *WebIdentity) Sanitize() cloud.Config
- func (wea *WebIdentity) UnmarshalJSON(b []byte) error
- func (wea *WebIdentity) Validate() error
Constants ¶
const ( SpotInfoUpdateType = "spotinfo" AthenaInfoUpdateType = "athenainfo" PreemptibleType = "preemptible" APIPricingSource = "Public API" SpotPricingSource = "Spot Data Feed" ReservedInstancePricingSource = "Savings Plan, Reserved Instance, and Out-Of-Cluster" InUseState = "in-use" AttachedState = "attached" AWSHourlyPublicIPCost = 0.005 EKSCapacityTypeLabel = "eks.amazonaws.com/capacityType" EKSCapacitySpotTypeValue = "SPOT" )
const ( TagAWSEKSClusterName = "aws:eks:cluster-name" TagEKSClusterName = "eks:cluster-name" TagEKSCtlClusterName = "alpha.eksctl.io/cluster-name" TagKubernetesServiceName = "kubernetes.io/service-name" TagKubernetesPVCName = "kubernetes.io/created-for/pvc/name" TagKubernetesPVName = "kubernetes.io/created-for/pv/name" )
const AWSLabelColumnPrefix = "resource_tags_aws_"
const AccessKeyAuthorizerType = "AWSAccessKey"
const AssumeRoleAuthorizerType = "AWSAssumeRole"
const AthenaDateColumn = "line_item_usage_start_date"
athenaDateTruncColumn Aggregates line items from the hourly level to daily. "line_item_usage_start_date" is used because at all time values 00:00-23:00 it will truncate to the correct date.
const AthenaDateLayout = "2006-01-02 15:04:05.000"
athenaDateLayout is the default AWS date format
const AthenaDateTruncColumn = "DATE_TRUNC('day'," + AthenaDateColumn + ") as usage_date"
const AthenaNetPricingColumn = "line_item_net_unblended_cost"
Net Cost Columns
const AthenaNetRIPricingColumn = "reservation_net_effective_cost"
Amortized Net Cost Columns
const AthenaNetSPPricingColumn = "savings_plan_net_savings_plan_effective_cost"
const AthenaPricingColumn = "line_item_unblended_cost"
Cost Columns
const AthenaRIPricingColumn = "reservation_effective_cost"
Amortized Cost Columns
const AthenaResourceTagPrefix = "resource_tags_"
const AthenaSPPricingColumn = "savings_plan_savings_plan_effective_cost"
const AthenaWhereDateFmt = `line_item_usage_start_date >= date '%s' AND line_item_usage_start_date < date '%s'`
const AthenaWhereUsage = "" /* 236-byte string literal not displayed */
const ClusterIdEnvVar = "AWS_CLUSTER_ID"
ClusterIdEnvVar is the environment variable in which one can manually set the ClusterId
const HourlyRateCode = "6YS6EN2CT7"
HourlyRateCode is appended to a node sku
const HourlyRateCodeCn = "Q7UJUT2CE6"
const LabelColumnPrefix = "resource_tags_user_"
const S3SelectAWSLabelPrefix = "resourceTags/aws:"
const S3SelectAccountID = `s."lineItem/UsageAccountId"`
const S3SelectAvailabilityZone = `s."lineItem/AvailabilityZone"`
const S3SelectBillPayerAccountID = `s."bill/PayerAccountId"`
S3Object is aliased as "s" in queries
const S3SelectDateLayout = "2006-01-02T15:04:05Z"
const S3SelectItemType = `s."lineItem/LineItemType"`
const S3SelectListCost = `s."lineItem/UnblendedCost"`
const S3SelectNetCost = `s."lineItem/NetUnblendedCost"`
const S3SelectNetRICost = `s."reservation/NetEffectiveCost"`
const S3SelectNetSPCost = `s."savingsPlan/NetSavingsPlanEffectiveCost"`
const S3SelectProductCode = `s."lineItem/ProductCode"`
const S3SelectRICost = `s."reservation/EffectiveCost"`
These two may be used for Amortized<Net>Cost
const S3SelectRegionCode = `s."product/regionCode"`
const S3SelectResourceID = `s."lineItem/ResourceId"`
const S3SelectResourceTagsPrefix = "resourceTags/"
const S3SelectSPCost = `s."savingsPlan/SavingsPlanEffectiveCost"`
const S3SelectStartDate = `s."lineItem/UsageStartDate"`
const S3SelectUsageType = `s."lineItem/UsageType"`
const S3SelectUserLabelPrefix = "resourceTags/user:"
const ServiceAccountAuthorizerType = "AWSServiceAccount"
const SpotRefreshDuration = 15 * time.Minute
SpotRefreshDuration represents how much time must pass before we refresh
const WebIdentityAuthorizerType = "AWSWebIdentity"
Variables ¶
var AthenaNetPricingCoalesce = fmt.Sprintf("COALESCE(%s, %s, 0)", AthenaNetPricingColumn, AthenaPricingColumn)
var AthenaNetRIPricingCoalesce = fmt.Sprintf("COALESCE(%s, %s, 0)", AthenaNetRIPricingColumn, AthenaRIPricingColumn)
var AthenaNetSPPricingCoalesce = fmt.Sprintf("COALESCE(%s, %s, 0)", AthenaNetSPPricingColumn, AthenaSPPricingColumn)
var OnDemandRateCodes = map[string]struct{}{
"JRTCKXETXF": {},
}
OnDemandRateCodes is are sets of identifiers for offerTermCodes matching 'On Demand' rates
var OnDemandRateCodesCn = map[string]struct{}{
"99YE2YK9UR": {},
"5Y9WH78GDR": {},
"KW44MY7SZN": {},
}
var ( // StorageClassProvisionerDefaults specifies the default storage class types depending upon the provisioner StorageClassProvisionerDefaults = map[string]string{ "kubernetes.io/aws-ebs": "gp2", "ebs.csi.aws.com": "gp3", } )
Functions ¶
func ConvertAwsAthenaInfoToConfig ¶
func ConvertAwsAthenaInfoToConfig(aai AwsAthenaInfo) cloud.KeyedConfig
ConvertAwsAthenaInfoToConfig takes a legacy config and generates a Config based on the presence of properties to match legacy behavior
func GetAthenaQueryFunc ¶
func GetAthenaQueryFunc(fn func(types.Row)) func(*athena.GetQueryResultsOutput) bool
func GetAthenaRowValue ¶
GetAthenaRowValue retrieve value from athena row based on column names and used stringutil.Bank() to prevent duplicate allocation of strings
func GetAthenaRowValueFloat ¶
func GetAthenaRowValueFloat(row types.Row, queryColumnIndexes map[string]int, columnName string) (float64, error)
getAthenaRowValueFloat retrieve value from athena row based on column names and convert to float if possible
func GetCSVRowValue ¶
GetCSVRowValue retrieve value from athena row based on column names and used stringutil.Bank() to prevent duplicate allocation of strings
func GetCSVRowValueFloat ¶
func GetCSVRowValueFloat(row []string, queryColumnIndexes map[string]int, columnName string) (float64, error)
GetCSVRowValueFloat retrieve value from athena row based on column names and convert to float if possible.
func SelectAWSCategory ¶
Types ¶
type AWS ¶
type AWS struct { Pricing map[string]*AWSProductTerms SpotPricingByInstanceID map[string]*spotInfo SpotPricingUpdatedAt *time.Time SpotRefreshRunning bool SpotPricingLock sync.RWMutex SpotPricingError error RIPricingByInstanceID map[string]*RIData RIPricingError error RIDataRunning bool RIDataLock sync.RWMutex SavingsPlanDataByInstanceID map[string]*SavingsPlanData SavingsPlanDataRunning bool SavingsPlanDataLock sync.RWMutex ValidPricingKeys map[string]bool Clientset clustercache.ClusterCache BaseCPUPrice string BaseRAMPrice string BaseGPUPrice string BaseSpotCPUPrice string BaseSpotRAMPrice string BaseSpotGPUPrice string SpotLabelName string SpotLabelValue string SpotDataRegion string SpotDataBucket string SpotDataPrefix string ProjectID string DownloadPricingDataLock sync.RWMutex Config models.ProviderConfig ServiceAccountChecks *models.ServiceAccountChecks ClusterRegion string ClusterAccountID string // contains filtered or unexported fields }
AWS represents an Amazon Provider
func (*AWS) AllNodePricing ¶
AllNodePricing returns all the billing data fetched.
func (*AWS) ApplyReservedInstancePricing ¶
ApplyReservedInstancePricing TODO
func (*AWS) ClusterInfo ¶
ClusterInfo returns an object that represents the cluster. TODO: actually return the name of the cluster. Blocked on cluster federation.
func (*AWS) ClusterManagementPricing ¶
func (*AWS) CombinedDiscountForNode ¶
func (*AWS) ConfigureAuth ¶
updates the authentication to the latest values (via config or secret)
func (*AWS) ConfigureAuthWith ¶
func (aws *AWS) ConfigureAuthWith(config *models.CustomPricing) error
updates the authentication to the latest values (via config or secret)
func (*AWS) DownloadPricingData ¶
DownloadPricingData fetches data from the AWS Pricing API
func (*AWS) GetAWSAccessKey ¶
func (aws *AWS) GetAWSAccessKey() (*AWSAccessKey, error)
GetAWSAccessKey generate an AWSAccessKey object from the config
func (*AWS) GetAWSAthenaInfo ¶
func (aws *AWS) GetAWSAthenaInfo() (*AwsAthenaInfo, error)
GetAWSAthenaInfo generate an AWSAthenaInfo object from the config
func (*AWS) GetAddresses ¶
GetAddresses retrieves EC2 addresses
func (*AWS) GetDisks ¶
GetDisks returns the AWS disks backing PVs. Useful because sometimes k8s will not clean up PVs correctly. Requires a json config in /var/configs with key region.
func (*AWS) GetLocalStorageQuery ¶
func (*AWS) GetManagementPlatform ¶
func (*AWS) GetOrphanedResources ¶
func (aws *AWS) GetOrphanedResources() ([]models.OrphanedResource, error)
func (*AWS) GetReservationDataFromAthena ¶
func (*AWS) GetSavingsPlanDataFromAthena ¶
func (*AWS) KubeAttrConversion ¶
KubeAttrConversion maps the k8s labels for region to an AWS key
func (*AWS) LoadBalancerPricing ¶
func (aws *AWS) LoadBalancerPricing() (*models.LoadBalancer, error)
func (*AWS) NetworkPricing ¶
Stubbed NetworkPricing for AWS. Pull directly from aws.json for now
func (*AWS) NodePricing ¶
NodePricing takes in a key from GetKey and returns a Node object for use in building the cost model.
func (*AWS) PricingSourceStatus ¶
func (aws *AWS) PricingSourceStatus() map[string]*models.PricingSource
func (*AWS) PricingSourceSummary ¶
func (aws *AWS) PricingSourceSummary() interface{}
PricingSourceSummary returns the pricing source summary for the provider. The summary represents what was _parsed_ from the pricing source, not everything that was _available_ in the pricing source.
func (*AWS) QueryAthenaPaginated ¶
func (aws *AWS) QueryAthenaPaginated(ctx context.Context, query string, fn func(*athena.GetQueryResultsOutput) bool) error
QueryAthenaPaginated executes athena query and processes results.
func (*AWS) ServiceAccountStatus ¶
func (aws *AWS) ServiceAccountStatus() *models.ServiceAccountStatus
func (*AWS) SpotRefreshEnabled ¶
SpotRefreshEnabled determines whether the required configs to run the spot feed query have been set up
func (*AWS) UpdateConfig ¶
func (*AWS) UpdateConfigFromConfigMap ¶
type AWSAccessKey ¶
type AWSAccessKey struct { AccessKeyID string `json:"aws_access_key_id"` SecretAccessKey string `json:"aws_secret_access_key"` }
AWSAccessKey holds AWS credentials and fulfils the awsV2.CredentialsProvider interface Deprecated: v1.104 Use AccessKey instead
func (AWSAccessKey) CreateConfig ¶
func (accessKey AWSAccessKey) CreateConfig(region string) (awsSDK.Config, error)
CreateConfig creates an AWS SDK V2 Config for the credentials that it contains for the provided region
func (AWSAccessKey) Retrieve ¶
func (accessKey AWSAccessKey) Retrieve(ctx context.Context) (awsSDK.Credentials, error)
Retrieve returns a set of awsV2 credentials using the AWSAccessKey's key and secret. This fulfils the awsV2.CredentialsProvider interface contract.
type AWSCurrencyCode ¶
AWSCurrencyCode is the localized currency. (TODO: support non-USD)
type AWSOfferTerm ¶
type AWSOfferTerm struct { Sku string `json:"sku"` OfferTermCode string `json:"offerTermCode"` PriceDimensions map[string]*AWSRateCode `json:"priceDimensions"` }
AWSOfferTerm is a sku extension used to pay for the node.
func (*AWSOfferTerm) String ¶
func (ot *AWSOfferTerm) String() string
type AWSPricing ¶
type AWSPricing struct { Products map[string]*AWSProduct `json:"products"` Terms AWSPricingTerms `json:"terms"` }
AWSPricing maps a k8s node to an AWS Pricing "product"
type AWSPricingTerms ¶
type AWSPricingTerms struct { OnDemand map[string]map[string]*AWSOfferTerm `json:"OnDemand"` Reserved map[string]map[string]*AWSOfferTerm `json:"Reserved"` }
AWSPricingTerms are how you pay for the node: OnDemand, Reserved, or (TODO) Spot
type AWSProduct ¶
type AWSProduct struct { Sku string `json:"sku"` Attributes AWSProductAttributes `json:"attributes"` }
AWSProduct represents a purchased SKU
type AWSProductAttributes ¶
type AWSProductAttributes struct { Location string `json:"location"` RegionCode string `json:"regionCode"` Operation string `json:"operation"` InstanceType string `json:"instanceType"` Memory string `json:"memory"` Storage string `json:"storage"` VCpu string `json:"vcpu"` UsageType string `json:"usagetype"` OperatingSystem string `json:"operatingSystem"` PreInstalledSw string `json:"preInstalledSw"` InstanceFamily string `json:"instanceFamily"` CapacityStatus string `json:"capacitystatus"` GPU string `json:"gpu"` // GPU represents the number of GPU on the instance MarketOption string `json:"marketOption"` }
AWSProductAttributes represents metadata about the product used to map to a node.
type AWSProductTerms ¶
type AWSProductTerms struct { Sku string `json:"sku"` OnDemand *AWSOfferTerm `json:"OnDemand"` Reserved *AWSOfferTerm `json:"Reserved"` Memory string `json:"memory"` Storage string `json:"storage"` VCpu string `json:"vcpu"` GPU string `json:"gpu"` // GPU represents the number of GPU on the instance PV *models.PV `json:"pv"` LoadBalancer *models.LoadBalancer `json:"load_balancer"` }
AWSProductTerms represents the full terms of the product
type AWSRateCode ¶
type AWSRateCode struct { Unit string `json:"unit"` PricePerUnit AWSCurrencyCode `json:"pricePerUnit"` }
AWSRateCode encodes data about the price of a product
func (*AWSRateCode) String ¶
func (rc *AWSRateCode) String() string
type AccessKey ¶
AccessKey holds AWS credentials and fulfils the awsV2.CredentialsProvider interface
func (*AccessKey) CreateAWSConfig ¶
CreateAWSConfig creates an AWS SDK V2 Config for the credentials that it contains for the provided region
func (*AccessKey) MarshalJSON ¶
MarshalJSON custom json marshalling functions, sets properties as tagged in struct and sets the authorizer type property
type AssumeRole ¶
type AssumeRole struct { Authorizer Authorizer `json:"authorizer"` RoleARN string `json:"roleARN"` }
AssumeRole is a wrapper for another Authorizer which adds an assumed role to the configuration
func (*AssumeRole) CreateAWSConfig ¶
func (ara *AssumeRole) CreateAWSConfig(region string) (aws.Config, error)
func (*AssumeRole) MarshalJSON ¶
func (ara *AssumeRole) MarshalJSON() ([]byte, error)
MarshalJSON custom json marshalling functions, sets properties as tagged in struct and sets the authorizer type property
func (*AssumeRole) Sanitize ¶
func (ara *AssumeRole) Sanitize() cloud.Config
func (*AssumeRole) UnmarshalJSON ¶
func (ara *AssumeRole) UnmarshalJSON(b []byte) error
UnmarshalJSON is required for AssumeRole because it needs to unmarshal an Authorizer interface
func (*AssumeRole) Validate ¶
func (ara *AssumeRole) Validate() error
type AthenaConfiguration ¶
type AthenaConfiguration struct { Bucket string `json:"bucket"` Region string `json:"region"` Database string `json:"database"` Catalog string `json:"catalog"` Table string `json:"table"` Workgroup string `json:"workgroup"` Account string `json:"account"` Authorizer Authorizer `json:"authorizer"` }
AthenaConfiguration
func (*AthenaConfiguration) Equals ¶
func (ac *AthenaConfiguration) Equals(config cloud.Config) bool
func (*AthenaConfiguration) Key ¶
func (ac *AthenaConfiguration) Key() string
func (*AthenaConfiguration) Provider ¶ added in v1.107.0
func (ac *AthenaConfiguration) Provider() string
func (*AthenaConfiguration) Sanitize ¶
func (ac *AthenaConfiguration) Sanitize() cloud.Config
func (*AthenaConfiguration) UnmarshalJSON ¶
func (ac *AthenaConfiguration) UnmarshalJSON(b []byte) error
func (*AthenaConfiguration) Validate ¶
func (ac *AthenaConfiguration) Validate() error
type AthenaIntegration ¶
type AthenaIntegration struct {
AthenaQuerier
}
func (*AthenaIntegration) ConvertLabelToAWSTag ¶
func (ai *AthenaIntegration) ConvertLabelToAWSTag(label string) string
func (*AthenaIntegration) GetAmortizedCostCase ¶
func (ai *AthenaIntegration) GetAmortizedCostCase(allColumns map[string]bool) string
func (*AthenaIntegration) GetAmortizedCostColumn ¶ added in v1.106.3
func (ai *AthenaIntegration) GetAmortizedCostColumn(allColumns map[string]bool) string
func (*AthenaIntegration) GetAmortizedNetCostCase ¶
func (ai *AthenaIntegration) GetAmortizedNetCostCase(allColumns map[string]bool) string
func (*AthenaIntegration) GetAmortizedNetCostColumn ¶
func (ai *AthenaIntegration) GetAmortizedNetCostColumn(allColumns map[string]bool) string
func (*AthenaIntegration) GetCloudCost ¶
func (ai *AthenaIntegration) GetCloudCost(start, end time.Time) (*opencost.CloudCostSetRange, error)
Query Athena for CUR data and build a new CloudCostSetRange containing the info
func (*AthenaIntegration) GetConnectionStatusFromResult ¶
func (ai *AthenaIntegration) GetConnectionStatusFromResult(result cloud.EmptyChecker, currentStatus cloud.ConnectionStatus) cloud.ConnectionStatus
func (*AthenaIntegration) GetIsKubernetesColumn ¶
func (ai *AthenaIntegration) GetIsKubernetesColumn(allColumns map[string]bool) string
GetIsKubernetesColumn builds a column that determines if a row represents kubernetes spend
func (*AthenaIntegration) GetListCostColumn ¶
func (ai *AthenaIntegration) GetListCostColumn() string
func (*AthenaIntegration) GetNetCostColumn ¶
func (ai *AthenaIntegration) GetNetCostColumn(allColumns map[string]bool) string
func (*AthenaIntegration) GetPartitionWhere ¶ added in v1.106.3
func (ai *AthenaIntegration) GetPartitionWhere(start, end time.Time) string
func (*AthenaIntegration) RemoveColumnAliases ¶
func (ai *AthenaIntegration) RemoveColumnAliases(columns []string)
func (*AthenaIntegration) RowToCloudCost ¶
func (ai *AthenaIntegration) RowToCloudCost(row types.Row, aqi AthenaQueryIndexes, ccsr *opencost.CloudCostSetRange) error
type AthenaQuerier ¶
type AthenaQuerier struct { AthenaConfiguration ConnectionStatus cloud.ConnectionStatus }
func (*AthenaQuerier) GetAthenaClient ¶
func (aq *AthenaQuerier) GetAthenaClient() (*athena.Client, error)
func (*AthenaQuerier) GetColumns ¶
func (aq *AthenaQuerier) GetColumns() (map[string]bool, error)
GetColumns returns a list of the names of all columns in the configured Athena table
func (*AthenaQuerier) GetStatus ¶ added in v1.107.0
func (aq *AthenaQuerier) GetStatus() cloud.ConnectionStatus
func (*AthenaQuerier) Query ¶
func (aq *AthenaQuerier) Query(ctx context.Context, query string, fn func(*athena.GetQueryResultsOutput) bool) error
type AthenaQueryIndexes ¶
type AthenaQueryIndexes struct { Query string ColumnIndexes map[string]int TagColumns []string AWSTagColumns []string ListCostColumn string NetCostColumn string AmortizedNetCostColumn string AmortizedCostColumn string IsK8sColumn string }
AthenaQueryIndexes is a struct for holding the context of a query
type Authorizer ¶
Authorizer implementations provide aws.Config for AWS SDK calls
func SelectAuthorizerByType ¶
func SelectAuthorizerByType(typeStr string) (Authorizer, error)
SelectAuthorizerByType is an implementation of AuthorizerSelectorFn and acts as a register for Authorizer types
type AwsAthenaInfo ¶
type AwsAthenaInfo struct { AthenaBucketName string `json:"athenaBucketName"` AthenaRegion string `json:"athenaRegion"` AthenaDatabase string `json:"athenaDatabase"` AthenaCatalog string `json:"athenaCatalog"` AthenaTable string `json:"athenaTable"` AthenaWorkgroup string `json:"athenaWorkgroup"` ServiceKeyName string `json:"serviceKeyName"` ServiceKeySecret string `json:"serviceKeySecret"` AccountID string `json:"projectID"` MasterPayerARN string `json:"masterPayerARN"` }
AwsAthenaInfo contains configuration for CUR integration Deprecated: v1.104 Use AthenaConfiguration instead
func (*AwsAthenaInfo) CreateConfig ¶
func (aai *AwsAthenaInfo) CreateConfig() (awsSDK.Config, error)
CreateConfig creates an AWS SDK V2 Config for the credentials that it contains
func (*AwsAthenaInfo) IsEmpty ¶
func (aai *AwsAthenaInfo) IsEmpty() bool
IsEmpty returns true if all fields in config are empty, false if not.
type AwsSpotFeedInfo ¶
type AwsSpotFeedInfo struct { BucketName string `json:"bucketName"` Prefix string `json:"prefix"` Region string `json:"region"` AccountID string `json:"projectID"` ServiceKeyName string `json:"serviceKeyName"` ServiceKeySecret string `json:"serviceKeySecret"` SpotLabel string `json:"spotLabel"` SpotLabelValue string `json:"spotLabelValue"` }
AwsSpotFeedInfo contains configuration for spot feed integration
type GoogleIDTokenRetriever ¶ added in v1.111.0
type GoogleIDTokenRetriever struct {
Aud string `json:"aud"`
}
func (GoogleIDTokenRetriever) Equals ¶ added in v1.111.0
func (gitr GoogleIDTokenRetriever) Equals(other IDTokenRetriever) bool
func (GoogleIDTokenRetriever) GetIdentityToken ¶ added in v1.111.0
func (gitr GoogleIDTokenRetriever) GetIdentityToken() ([]byte, error)
func (GoogleIDTokenRetriever) Sanitize ¶ added in v1.111.0
func (gitr GoogleIDTokenRetriever) Sanitize() IDTokenRetriever
func (GoogleIDTokenRetriever) Validate ¶ added in v1.111.0
func (gitr GoogleIDTokenRetriever) Validate() error
type IDTokenRetriever ¶ added in v1.111.0
type IDTokenRetriever interface { GetIdentityToken() ([]byte, error) Validate() error Sanitize() IDTokenRetriever Equals(IDTokenRetriever) bool }
type S3Configuration ¶
type S3Configuration struct { Bucket string `json:"bucket"` Region string `json:"region"` Account string `json:"account"` Authorizer Authorizer `json:"authorizer"` }
func (*S3Configuration) CreateAWSConfig ¶
func (s3c *S3Configuration) CreateAWSConfig() (aws.Config, error)
func (*S3Configuration) Key ¶
func (s3c *S3Configuration) Key() string
func (*S3Configuration) Provider ¶ added in v1.107.0
func (s3c *S3Configuration) Provider() string
func (*S3Configuration) Sanitize ¶
func (s3c *S3Configuration) Sanitize() cloud.Config
func (*S3Configuration) UnmarshalJSON ¶
func (s3c *S3Configuration) UnmarshalJSON(b []byte) error
func (*S3Configuration) Validate ¶
func (s3c *S3Configuration) Validate() error
type S3Connection ¶
type S3Connection struct { S3Configuration ConnectionStatus cloud.ConnectionStatus }
func (*S3Connection) GetS3Client ¶
func (s3c *S3Connection) GetS3Client() (*s3.Client, error)
func (*S3Connection) GetStatus ¶ added in v1.107.0
func (s3c *S3Connection) GetStatus() cloud.ConnectionStatus
func (*S3Connection) ListObjects ¶
func (s3c *S3Connection) ListObjects(cli *s3.Client) (*s3.ListObjectsOutput, error)
type S3SelectIntegration ¶ added in v1.105.0
type S3SelectIntegration struct {
S3SelectQuerier
}
func (*S3SelectIntegration) GetCloudCost ¶ added in v1.105.0
func (s3si *S3SelectIntegration) GetCloudCost( start, end time.Time, ) (*opencost.CloudCostSetRange, error)
type S3SelectQuerier ¶
type S3SelectQuerier struct { S3Connection // contains filtered or unexported fields }
func (*S3SelectQuerier) GetHeaders ¶ added in v1.112.0
func (*S3SelectQuerier) GetQueryKeys ¶
func (s3sq *S3SelectQuerier) GetQueryKeys(start, end time.Time, client *s3.Client) ([]string, error)
GetQueryKeys returns a list of s3 object names, where the there are 1 object for each month within the range between start and end
type SavingsPlanData ¶
type ServiceAccount ¶
type ServiceAccount struct{}
ServiceAccount uses pod annotations along with a service account to authenticate integrations
func (*ServiceAccount) CreateAWSConfig ¶
func (sa *ServiceAccount) CreateAWSConfig(region string) (aws.Config, error)
func (*ServiceAccount) MarshalJSON ¶
func (sa *ServiceAccount) MarshalJSON() ([]byte, error)
MarshalJSON custom json marshalling functions, sets properties as tagged in struct and sets the authorizer type property
func (*ServiceAccount) Sanitize ¶
func (sa *ServiceAccount) Sanitize() cloud.Config
func (*ServiceAccount) Validate ¶
func (sa *ServiceAccount) Validate() error
Check has nothing to check at this level, connection will fail if Pod Annotation and Service Account are not configured correctly
type WebIdentity ¶ added in v1.111.0
type WebIdentity struct { RoleARN string `json:"roleARN"` IdentityProvider string `json:"identityProvider"` TokenRetriever IDTokenRetriever `json:"tokenRetriever"` }
func (*WebIdentity) CreateAWSConfig ¶ added in v1.111.0
func (wea *WebIdentity) CreateAWSConfig(region string) (aws.Config, error)
func (*WebIdentity) Equals ¶ added in v1.111.0
func (wea *WebIdentity) Equals(config cloud.Config) bool
func (*WebIdentity) MarshalJSON ¶ added in v1.111.0
func (wea *WebIdentity) MarshalJSON() ([]byte, error)
func (*WebIdentity) Sanitize ¶ added in v1.111.0
func (wea *WebIdentity) Sanitize() cloud.Config
func (*WebIdentity) UnmarshalJSON ¶ added in v1.111.0
func (wea *WebIdentity) UnmarshalJSON(b []byte) error
func (*WebIdentity) Validate ¶ added in v1.111.0
func (wea *WebIdentity) Validate() error