cloud

package
v1.98.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpotInfoUpdateType   = "spotinfo"
	AthenaInfoUpdateType = "athenainfo"
	PreemptibleType      = "preemptible"

	APIPricingSource              = "Public API"
	SpotPricingSource             = "Spot Data Feed"
	ReservedInstancePricingSource = "Savings Plan, Reserved Instance, and Out-Of-Cluster"
)
View Source
const (
	AzureFilePremiumStorageClass     = "premium_smb"
	AzureFileStandardStorageClass    = "standard_smb"
	AzureDiskPremiumSSDStorageClass  = "premium_ssd"
	AzureDiskStandardSSDStorageClass = "standard_ssd"
	AzureDiskStandardStorageClass    = "standard_hdd"

	AzureStorageUpdateType = "AzureStorage"
)
View Source
const (
	GCPReservedInstanceResourceTypeRAM string = "MEMORY"
	GCPReservedInstanceResourceTypeCPU string = "VCPU"
	GCPReservedInstanceStatusActive    string = "ACTIVE"
	GCPReservedInstancePlanOneYear     string = "TWELVE_MONTH"
	GCPReservedInstancePlanThreeYear   string = "THIRTY_SIX_MONTH"
)
View Source
const BigqueryUpdateType = "bigqueryupdate"
View Source
const ClusterIdEnvVar = "AWS_CLUSTER_ID"

ClusterIdEnvVar is the environment variable in which one can manually set the ClusterId

View Source
const GKE_GPU_TAG = "cloud.google.com/gke-accelerator"
View Source
const HourlyRateCode = ".6YS6EN2CT7"

HourlyRateCode is appended to a node sku

View Source
const HourlyRateCodeCn = ".Q7UJUT2CE6"
View Source
const (
	InstanceAPIPricing = "Instance API Pricing"
)
View Source
const OnDemandRateCode = ".JRTCKXETXF"

OnDemandRateCode is appended to an node sku

View Source
const OnDemandRateCodeCn = ".99YE2YK9UR"
View Source
const ReservedRateCode = ".38NPMPTW36"

ReservedRateCode is appended to a node sku

View Source
const SpotRefreshDuration = 15 * time.Minute

How often spot data is refreshed

Variables

This section is empty.

Functions

func AllocateIdleByDefault

func AllocateIdleByDefault(p Provider) bool

AllocateIdleByDefault returns true if the application settings specify to allocate idle by default

func ClusterName

func ClusterName(p Provider) string

ClusterName returns the name defined in cluster info, defaulting to the CLUSTER_ID environment variable

func ConfigWatcherFor

func ConfigWatcherFor(p Provider) *watcher.ConfigMapWatcher

ConfigWatcherFor returns a new ConfigWatcher instance which watches changes to the "pricing-configs" configmap

func CreateClusterMeta

func CreateClusterMeta(cluster_id, cluster_name string) error

func CustomPricesEnabled

func CustomPricesEnabled(p Provider) bool

CustomPricesEnabled returns the boolean equivalent of the cloup provider's custom prices flag, indicating whether or not the cluster is using custom pricing.

func GetClusterMeta

func GetClusterMeta(cluster_id string) (string, string, error)

func GetCsv

func GetCsv(location string) (io.Reader, error)

func GetOrCreateClusterMeta

func GetOrCreateClusterMeta(cluster_id, cluster_name string) (string, string, error)

func NewClientCredentialsConfig

func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string, env azure.Environment) auth.ClientCredentialsConfig

NewClientCredentialsConfig creates an AuthorizerConfig object configured to obtain an Authorizer through Client Credentials.

func NodeValueFromMapField

func NodeValueFromMapField(m string, n *v1.Node, useRegion bool) string

func PVValueFromMapField

func PVValueFromMapField(m string, n *v1.PersistentVolume) string

func ParseID

func ParseID(id string) string

ParseID attempts to parse a ProviderId from a string based on formats from the various providers and returns the string as is if it cannot find a match

func ParseLBID

func ParseLBID(id string) string

ParseLBID attempts to parse a LB ProviderId from a string based on formats from the various providers and returns the string as is if it cannot find a match

func ParsePVID

func ParsePVID(id string) string

ParsePVID attempts to parse a PV ProviderId from a string based on formats from the various providers and returns the string as is if it cannot find a match

func SetCustomPricingField

func SetCustomPricingField(obj *CustomPricing, name string, value string) error

func ShareTenancyCosts

func ShareTenancyCosts(p Provider) bool

ShareTenancyCosts returns true if the application settings specify to share tenancy costs by default.

func SharedLabels

func SharedLabels(p Provider) ([]string, []string)

SharedLabel returns the configured set of shared labels as a parallel tuple of keys to values; e.g. for app:kubecost,type:staging this returns (["app", "type"], ["kubecost", "staging"]) in order to match the signature of the NewSharedResourceInfo

func SharedNamespaces

func SharedNamespaces(p Provider) []string

SharedNamespace returns a list of names of shared namespaces, as defined in the application settings

func UpdateClusterMeta

func UpdateClusterMeta(cluster_id, cluster_name string) error

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                      *ProviderConfig

	*CustomProvider
	// contains filtered or unexported fields
}

AWS represents an Amazon Provider

func (*AWS) AllNodePricing

func (aws *AWS) AllNodePricing() (interface{}, error)

AllNodePricing returns all the billing data fetched.

func (*AWS) ApplyReservedInstancePricing

func (aws *AWS) ApplyReservedInstancePricing(nodes map[string]*Node)

ApplyReservedInstancePricing TODO

func (*AWS) ClusterInfo

func (awsProvider *AWS) ClusterInfo() (map[string]string, error)

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 *AWS) ClusterManagementPricing() (string, float64, error)

func (*AWS) CombinedDiscountForNode

func (aws *AWS) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*AWS) ConfigureAuth

func (aws *AWS) ConfigureAuth() error

updates the authentication to the latest values (via config or secret)

func (*AWS) ConfigureAuthWith

func (aws *AWS) ConfigureAuthWith(config *CustomPricing) error

updates the authentication to the latest values (via config or secret)

func (*AWS) DownloadPricingData

func (aws *AWS) DownloadPricingData() error

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

func (aws *AWS) GetAddresses() ([]byte, error)

GetAddresses retrieves EC2 addresses

func (*AWS) GetConfig

func (aws *AWS) GetConfig() (*CustomPricing, error)

func (*AWS) GetDisks

func (aws *AWS) GetDisks() ([]byte, error)

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) GetKey

func (aws *AWS) GetKey(labels map[string]string, n *v1.Node) Key

GetKey maps node labels to information needed to retrieve pricing data

func (*AWS) GetLocalStorageQuery

func (aws *AWS) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string

func (*AWS) GetManagementPlatform

func (aws *AWS) GetManagementPlatform() (string, error)

func (*AWS) GetPVKey

func (aws *AWS) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*AWS) GetReservationDataFromAthena

func (aws *AWS) GetReservationDataFromAthena() error

func (*AWS) GetSavingsPlanDataFromAthena

func (aws *AWS) GetSavingsPlanDataFromAthena() error

func (*AWS) KubeAttrConversion

func (aws *AWS) KubeAttrConversion(location, instanceType, operatingSystem string) string

KubeAttrConversion maps the k8s labels for region to an aws region

func (*AWS) LoadBalancerPricing

func (aws *AWS) LoadBalancerPricing() (*LoadBalancer, error)

func (*AWS) NetworkPricing

func (aws *AWS) NetworkPricing() (*Network, error)

Stubbed NetworkPricing for AWS. Pull directly from aws.json for now

func (*AWS) NodePricing

func (aws *AWS) NodePricing(k Key) (*Node, error)

NodePricing takes in a key from GetKey and returns a Node object for use in building the cost model.

func (*AWS) PVPricing

func (aws *AWS) PVPricing(pvk PVKey) (*PV, error)

func (*AWS) PricingSourceStatus

func (aws *AWS) PricingSourceStatus() map[string]*PricingSource

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) Regions

func (aws *AWS) Regions() []string

Regions returns a predefined list of AWS regions

func (*AWS) ServiceAccountStatus

func (aws *AWS) ServiceAccountStatus() *ServiceAccountStatus

func (*AWS) SpotRefreshEnabled

func (aws *AWS) SpotRefreshEnabled() bool

SpotRefreshEnabled determines whether the required configs to run the spot feed query have been set up

func (*AWS) UpdateConfig

func (aws *AWS) UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)

func (*AWS) UpdateConfigFromConfigMap

func (aws *AWS) UpdateConfigFromConfigMap(cm map[string]string) (*CustomPricing, error)

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

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

type AWSCurrencyCode struct {
	USD string `json:"USD,omitempty"`
	CNY string `json:"CNY,omitempty"`
}

AWSCurrencyCode is the localized currency. (TODO: support non-USD)

type AWSOfferTerm

type AWSOfferTerm struct {
	Sku             string                  `json:"sku"`
	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"`
	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
}

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       *PV           `json:"pv"`
}

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 AwsAthenaInfo

type AwsAthenaInfo struct {
	AthenaBucketName string `json:"athenaBucketName"`
	AthenaRegion     string `json:"athenaRegion"`
	AthenaDatabase   string `json:"athenaDatabase"`
	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

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 Azure

type Azure struct {
	Pricing                 map[string]*AzurePricing
	DownloadPricingDataLock sync.RWMutex
	Clientset               clustercache.ClusterCache
	Config                  *ProviderConfig

	RateCardPricingError error
	// contains filtered or unexported fields
}

func (*Azure) AllNodePricing

func (az *Azure) AllNodePricing() (interface{}, error)

AllNodePricing returns the Azure pricing objects stored

func (*Azure) ApplyReservedInstancePricing

func (az *Azure) ApplyReservedInstancePricing(nodes map[string]*Node)

func (*Azure) ClusterInfo

func (az *Azure) ClusterInfo() (map[string]string, error)

func (*Azure) ClusterManagementPricing

func (*Azure) ClusterManagementPricing() (string, float64, error)

func (*Azure) CombinedDiscountForNode

func (az *Azure) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*Azure) DownloadPricingData

func (az *Azure) DownloadPricingData() error

DownloadPricingData uses provided azure "best guesses" for pricing

func (*Azure) GetAddresses

func (*Azure) GetAddresses() ([]byte, error)

func (*Azure) GetAzureStorageConfig

func (az *Azure) GetAzureStorageConfig(forceReload bool, cp *CustomPricing) (*AzureStorageConfig, error)

GetAzureStorageConfig retrieves storage config from secret and sets default values

func (*Azure) GetConfig

func (az *Azure) GetConfig() (*CustomPricing, error)

func (*Azure) GetDisks

func (*Azure) GetDisks() ([]byte, error)

func (*Azure) GetKey

func (az *Azure) GetKey(labels map[string]string, n *v1.Node) Key

func (*Azure) GetLocalStorageQuery

func (az *Azure) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string

func (*Azure) GetManagementPlatform

func (az *Azure) GetManagementPlatform() (string, error)

func (*Azure) GetPVKey

func (az *Azure) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*Azure) LoadBalancerPricing

func (azr *Azure) LoadBalancerPricing() (*LoadBalancer, error)

LoadBalancerPricing on Azure, LoadBalancer services correspond to public IPs. For now the pricing of LoadBalancer services will be that of a standard static public IP https://azure.microsoft.com/en-us/pricing/details/ip-addresses/. Azure still has load balancers which follow the standard pricing scheme based on rules https://azure.microsoft.com/en-us/pricing/details/load-balancer/, they are created on a per-cluster basis.

func (*Azure) NetworkPricing

func (az *Azure) NetworkPricing() (*Network, error)

Stubbed NetworkPricing for Azure. Pull directly from azure.json for now

func (*Azure) NodePricing

func (az *Azure) NodePricing(key Key) (*Node, error)

NodePricing returns Azure pricing data for a single node

func (*Azure) PVPricing

func (az *Azure) PVPricing(pvk PVKey) (*PV, error)

func (*Azure) PricingSourceStatus

func (az *Azure) PricingSourceStatus() map[string]*PricingSource

PricingSourceStatus returns the status of the rate card api

func (*Azure) Regions

func (az *Azure) Regions() []string

func (*Azure) ServiceAccountStatus

func (az *Azure) ServiceAccountStatus() *ServiceAccountStatus

func (*Azure) UpdateConfig

func (az *Azure) UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)

func (*Azure) UpdateConfigFromConfigMap

func (az *Azure) UpdateConfigFromConfigMap(a map[string]string) (*CustomPricing, error)

type AzureAppKey

type AzureAppKey struct {
	AppID       string `json:"appId"`
	DisplayName string `json:"displayName"`
	Name        string `json:"name"`
	Password    string `json:"password"`
	Tenant      string `json:"tenant"`
}

Represents an azure app key

type AzurePricing

type AzurePricing struct {
	Node *Node
	PV   *PV
}

AzurePricing either contains a Node or PV

type AzureRetailPricing

type AzureRetailPricing struct {
	BillingCurrency    string                         `json:"BillingCurrency"`
	CustomerEntityId   string                         `json:"CustomerEntityId"`
	CustomerEntityType string                         `json:"CustomerEntityType"`
	Items              []AzureRetailPricingAttributes `json:"Items"`
	NextPageLink       string                         `json:"NextPageLink"`
	Count              int                            `json:"Count"`
}

AzureRetailPricing struct for unmarshalling Azure Retail pricing api JSON response

type AzureRetailPricingAttributes

type AzureRetailPricingAttributes struct {
	CurrencyCode         string     `json:"currencyCode"`
	TierMinimumUnits     float32    `json:"tierMinimumUnits"`
	RetailPrice          float32    `json:"retailPrice"`
	UnitPrice            float32    `json:"unitPrice"`
	ArmRegionName        string     `json:"armRegionName"`
	Location             string     `json:"location"`
	EffectiveStartDate   *time.Time `json:"effectiveStartDate"`
	EffectiveEndDate     *time.Time `json:"effectiveEndDate"`
	MeterId              string     `json:"meterId"`
	MeterName            string     `json:"meterName"`
	ProductId            string     `json:"productId"`
	SkuId                string     `json:"skuId"`
	ProductName          string     `json:"productName"`
	SkuName              string     `json:"skuName"`
	ServiceName          string     `json:"serviceName"`
	ServiceId            string     `json:"serviceId"`
	ServiceFamily        string     `json:"serviceFamily"`
	UnitOfMeasure        string     `json:"unitOfMeasure"`
	Type                 string     `json:"type"`
	IsPrimaryMeterRegion bool       `json:"isPrimaryMeterRegion"`
	ArmSkuName           string     `json:"armSkuName"`
}

AzureRetailPricingAttributes struct for unmarshalling Azure Retail pricing api JSON response

type AzureServiceKey

type AzureServiceKey struct {
	SubscriptionID string       `json:"subscriptionId"`
	ServiceKey     *AzureAppKey `json:"serviceKey"`
}

Azure service key for a specific subscription

func (*AzureServiceKey) IsValid

func (ask *AzureServiceKey) IsValid() bool

Validity check on service key

type AzureStorageConfig

type AzureStorageConfig struct {
	SubscriptionId string `json:"azureSubscriptionID"`
	AccountName    string `json:"azureStorageAccount"`
	AccessKey      string `json:"azureStorageAccessKey"`
	ContainerName  string `json:"azureStorageContainer"`
	ContainerPath  string `json:"azureContainerPath"`
	AzureCloud     string `json:"azureCloud"`
}

AzureStorageConfig Represents an azure storage config

func (*AzureStorageConfig) IsEmpty

func (asc *AzureStorageConfig) IsEmpty() bool

IsEmpty returns true if all fields in config are empty, false if not.

type BigQueryConfig

type BigQueryConfig struct {
	ProjectID          string            `json:"projectID"`
	BillingDataDataset string            `json:"billingDataDataset"`
	Key                map[string]string `json:"key"`
}

BigQueryConfig contain the required config and credentials to access OOC resources for GCP

func (*BigQueryConfig) IsEmpty

func (bqc *BigQueryConfig) IsEmpty() bool

IsEmpty returns true if all fields in config are empty, false if not.

type CSVProvider

type CSVProvider struct {
	*CustomProvider
	CSVLocation             string
	Pricing                 map[string]*price
	NodeClassPricing        map[string]float64
	NodeClassCount          map[string]float64
	NodeMapField            string
	PricingPV               map[string]*price
	PVMapField              string
	UsesRegion              bool
	DownloadPricingDataLock sync.RWMutex
}

func (*CSVProvider) ClusterManagementPricing

func (*CSVProvider) ClusterManagementPricing() (string, float64, error)

func (*CSVProvider) CombinedDiscountForNode

func (c *CSVProvider) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*CSVProvider) DownloadPricingData

func (c *CSVProvider) DownloadPricingData() error

func (*CSVProvider) GetKey

func (c *CSVProvider) GetKey(l map[string]string, n *v1.Node) Key

func (*CSVProvider) GetPVKey

func (c *CSVProvider) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*CSVProvider) NodePricing

func (c *CSVProvider) NodePricing(key Key) (*Node, error)

func (*CSVProvider) PVPricing

func (c *CSVProvider) PVPricing(pvk PVKey) (*PV, error)

func (*CSVProvider) Regions

func (c *CSVProvider) Regions() []string

func (*CSVProvider) ServiceAccountStatus

func (c *CSVProvider) ServiceAccountStatus() *ServiceAccountStatus

type CustomPricing

type CustomPricing struct {
	Provider                     string `json:"provider"`
	Description                  string `json:"description"`
	CPU                          string `json:"CPU"`
	SpotCPU                      string `json:"spotCPU"`
	RAM                          string `json:"RAM"`
	SpotRAM                      string `json:"spotRAM"`
	GPU                          string `json:"GPU"`
	SpotGPU                      string `json:"spotGPU"`
	Storage                      string `json:"storage"`
	ZoneNetworkEgress            string `json:"zoneNetworkEgress"`
	RegionNetworkEgress          string `json:"regionNetworkEgress"`
	InternetNetworkEgress        string `json:"internetNetworkEgress"`
	FirstFiveForwardingRulesCost string `json:"firstFiveForwardingRulesCost"`
	AdditionalForwardingRuleCost string `json:"additionalForwardingRuleCost"`
	LBIngressDataCost            string `json:"LBIngressDataCost"`
	SpotLabel                    string `json:"spotLabel,omitempty"`
	SpotLabelValue               string `json:"spotLabelValue,omitempty"`
	GpuLabel                     string `json:"gpuLabel,omitempty"`
	GpuLabelValue                string `json:"gpuLabelValue,omitempty"`
	ServiceKeyName               string `json:"awsServiceKeyName,omitempty"`
	ServiceKeySecret             string `json:"awsServiceKeySecret,omitempty"`
	SpotDataRegion               string `json:"awsSpotDataRegion,omitempty"`
	SpotDataBucket               string `json:"awsSpotDataBucket,omitempty"`
	SpotDataPrefix               string `json:"awsSpotDataPrefix,omitempty"`
	ProjectID                    string `json:"projectID,omitempty"`
	AthenaProjectID              string `json:"athenaProjectID,omitempty"`
	AthenaBucketName             string `json:"athenaBucketName"`
	AthenaRegion                 string `json:"athenaRegion"`
	AthenaDatabase               string `json:"athenaDatabase"`
	AthenaTable                  string `json:"athenaTable"`
	AthenaWorkgroup              string `json:"athenaWorkgroup"`
	MasterPayerARN               string `json:"masterPayerARN"`
	BillingDataDataset           string `json:"billingDataDataset,omitempty"`
	CustomPricesEnabled          string `json:"customPricesEnabled"`
	DefaultIdle                  string `json:"defaultIdle"`
	AzureSubscriptionID          string `json:"azureSubscriptionID"`
	AzureClientID                string `json:"azureClientID"`
	AzureClientSecret            string `json:"azureClientSecret"`
	AzureTenantID                string `json:"azureTenantID"`
	AzureBillingRegion           string `json:"azureBillingRegion"`
	AzureOfferDurableID          string `json:"azureOfferDurableID"`
	AzureStorageSubscriptionID   string `json:"azureStorageSubscriptionID"`
	AzureStorageAccount          string `json:"azureStorageAccount"`
	AzureStorageAccessKey        string `json:"azureStorageAccessKey"`
	AzureStorageContainer        string `json:"azureStorageContainer"`
	AzureContainerPath           string `json:"azureContainerPath"`
	AzureCloud                   string `json:"azureCloud"`
	CurrencyCode                 string `json:"currencyCode"`
	Discount                     string `json:"discount"`
	NegotiatedDiscount           string `json:"negotiatedDiscount"`
	SharedOverhead               string `json:"sharedOverhead"`
	ClusterName                  string `json:"clusterName"`
	SharedNamespaces             string `json:"sharedNamespaces"`
	SharedLabelNames             string `json:"sharedLabelNames"`
	SharedLabelValues            string `json:"sharedLabelValues"`
	ShareTenancyCosts            string `json:"shareTenancyCosts"` // TODO clean up configuration so we can use a type other that string (this should be a bool, but the app panics if it's not a string)
	ReadOnly                     string `json:"readOnly"`
	EditorAccess                 string `json:"editorAccess"`
	KubecostToken                string `json:"kubecostToken"`
	GoogleAnalyticsTag           string `json:"googleAnalyticsTag"`
	ExcludeProviderID            string `json:"excludeProviderID"`
}

func DefaultPricing

func DefaultPricing() *CustomPricing

DefaultPricing should be returned so we can do computation even if no file is supplied.

func (*CustomPricing) GetSharedOverheadCostPerMonth

func (cp *CustomPricing) GetSharedOverheadCostPerMonth() float64

GetSharedOverheadCostPerMonth parses and returns a float64 representation of the configured monthly shared overhead cost. If the string version cannot be parsed into a float, an error is logged and 0.0 is returned.

type CustomProvider

type CustomProvider struct {
	Clientset               clustercache.ClusterCache
	Pricing                 map[string]*NodePrice
	SpotLabel               string
	SpotLabelValue          string
	GPULabel                string
	GPULabelValue           string
	DownloadPricingDataLock sync.RWMutex
	Config                  *ProviderConfig
}

func (*CustomProvider) AllNodePricing

func (cp *CustomProvider) AllNodePricing() (interface{}, error)

func (*CustomProvider) ApplyReservedInstancePricing

func (*CustomProvider) ApplyReservedInstancePricing(nodes map[string]*Node)

func (*CustomProvider) ClusterInfo

func (cp *CustomProvider) ClusterInfo() (map[string]string, error)

func (*CustomProvider) ClusterManagementPricing

func (*CustomProvider) ClusterManagementPricing() (string, float64, error)

func (*CustomProvider) CombinedDiscountForNode

func (cp *CustomProvider) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*CustomProvider) DownloadPricingData

func (cp *CustomProvider) DownloadPricingData() error

func (*CustomProvider) ExternalAllocations

func (*CustomProvider) ExternalAllocations(start string, end string, aggregator []string, filterType string, filterValue string, crossCluster bool) ([]*OutOfClusterAllocation, error)

ExternalAllocations represents tagged assets outside the scope of kubernetes. "start" and "end" are dates of the format YYYY-MM-DD "aggregator" is the tag used to determine how to allocate those assets, ie namespace, pod, etc.

func (*CustomProvider) GetAddresses

func (*CustomProvider) GetAddresses() ([]byte, error)

func (*CustomProvider) GetConfig

func (cp *CustomProvider) GetConfig() (*CustomPricing, error)

func (*CustomProvider) GetDisks

func (*CustomProvider) GetDisks() ([]byte, error)

func (*CustomProvider) GetKey

func (cp *CustomProvider) GetKey(labels map[string]string, n *v1.Node) Key

func (*CustomProvider) GetLocalStorageQuery

func (*CustomProvider) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string

func (*CustomProvider) GetManagementPlatform

func (*CustomProvider) GetManagementPlatform() (string, error)

func (*CustomProvider) GetPVKey

func (*CustomProvider) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*CustomProvider) LoadBalancerPricing

func (cp *CustomProvider) LoadBalancerPricing() (*LoadBalancer, error)

func (*CustomProvider) NetworkPricing

func (cp *CustomProvider) NetworkPricing() (*Network, error)

func (*CustomProvider) NodePricing

func (cp *CustomProvider) NodePricing(key Key) (*Node, error)

func (*CustomProvider) PVPricing

func (cp *CustomProvider) PVPricing(pvk PVKey) (*PV, error)

func (*CustomProvider) PricingSourceStatus

func (cp *CustomProvider) PricingSourceStatus() map[string]*PricingSource

func (*CustomProvider) QuerySQL

func (*CustomProvider) QuerySQL(query string) ([]byte, error)

func (*CustomProvider) Regions

func (cp *CustomProvider) Regions() []string

func (*CustomProvider) ServiceAccountStatus

func (cp *CustomProvider) ServiceAccountStatus() *ServiceAccountStatus

func (*CustomProvider) UpdateConfig

func (cp *CustomProvider) UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)

func (*CustomProvider) UpdateConfigFromConfigMap

func (cp *CustomProvider) UpdateConfigFromConfigMap(a map[string]string) (*CustomPricing, error)

type GCP

type GCP struct {
	Pricing                 map[string]*GCPPricing
	Clientset               clustercache.ClusterCache
	APIKey                  string
	BaseCPUPrice            string
	ProjectID               string
	BillingDataDataset      string
	DownloadPricingDataLock sync.RWMutex
	ReservedInstances       []*GCPReservedInstance
	Config                  *ProviderConfig
	ServiceKeyProvided      bool
	ValidPricingKeys        map[string]bool

	*CustomProvider
	// contains filtered or unexported fields
}

GCP implements a provider interface for GCP

func (*GCP) AllNodePricing

func (gcp *GCP) AllNodePricing() (interface{}, error)

AllNodePricing returns the GCP pricing objects stored

func (*GCP) ApplyReservedInstancePricing

func (gcp *GCP) ApplyReservedInstancePricing(nodes map[string]*Node)

func (*GCP) ClusterInfo

func (gcp *GCP) ClusterInfo() (map[string]string, error)

ClusterInfo returns information on the GKE cluster, as provided by metadata.

func (*GCP) ClusterManagementPricing

func (gcp *GCP) ClusterManagementPricing() (string, float64, error)

func (*GCP) CombinedDiscountForNode

func (gcp *GCP) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*GCP) DownloadPricingData

func (gcp *GCP) DownloadPricingData() error

DownloadPricingData fetches data from the GCP Pricing API. Requires a key-- a kubecost key is provided for quickstart, but should be replaced by a users.

func (*GCP) GetAddresses

func (*GCP) GetAddresses() ([]byte, error)

func (*GCP) GetConfig

func (gcp *GCP) GetConfig() (*CustomPricing, error)

func (*GCP) GetDisks

func (*GCP) GetDisks() ([]byte, error)

GetDisks returns the GCP disks backing PVs. Useful because sometimes k8s will not clean up PVs correctly. Requires a json config in /var/configs with key region.

func (*GCP) GetKey

func (gcp *GCP) GetKey(labels map[string]string, n *v1.Node) Key

func (*GCP) GetLocalStorageQuery

func (gcp *GCP) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string

GetLocalStorageQuery returns the cost of local storage for the given window. Setting rate=true returns hourly spend. Setting used=true only tracks used storage, not total.

func (*GCP) GetManagementPlatform

func (gcp *GCP) GetManagementPlatform() (string, error)

func (*GCP) GetPVKey

func (gcp *GCP) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*GCP) LoadBalancerPricing

func (gcp *GCP) LoadBalancerPricing() (*LoadBalancer, error)

func (*GCP) NetworkPricing

func (gcp *GCP) NetworkPricing() (*Network, error)

Stubbed NetworkPricing for GCP. Pull directly from gcp.json for now

func (*GCP) NodePricing

func (gcp *GCP) NodePricing(key Key) (*Node, error)

NodePricing returns GCP pricing data for a single node

func (*GCP) PVPricing

func (gcp *GCP) PVPricing(pvk PVKey) (*PV, error)

func (*GCP) PricingSourceStatus

func (gcp *GCP) PricingSourceStatus() map[string]*PricingSource

func (*GCP) Regions

func (gcp *GCP) Regions() []string

func (*GCP) ServiceAccountStatus

func (gcp *GCP) ServiceAccountStatus() *ServiceAccountStatus

func (*GCP) UpdateConfig

func (gcp *GCP) UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)

func (*GCP) UpdateConfigFromConfigMap

func (gcp *GCP) UpdateConfigFromConfigMap(a map[string]string) (*CustomPricing, error)

type GCPPricing

type GCPPricing struct {
	Name                string           `json:"name"`
	SKUID               string           `json:"skuId"`
	Description         string           `json:"description"`
	Category            *GCPResourceInfo `json:"category"`
	ServiceRegions      []string         `json:"serviceRegions"`
	PricingInfo         []*PricingInfo   `json:"pricingInfo"`
	ServiceProviderName string           `json:"serviceProviderName"`
	Node                *Node            `json:"node"`
	PV                  *PV              `json:"pv"`
}

GCPPricing represents GCP pricing data for a SKU

type GCPReservedCounter

type GCPReservedCounter struct {
	RemainingCPU int64
	RemainingRAM int64
	Instance     *GCPReservedInstance
}

type GCPReservedInstance

type GCPReservedInstance struct {
	ReservedRAM int64
	ReservedCPU int64
	Plan        *GCPReservedInstancePlan
	StartDate   time.Time
	EndDate     time.Time
	Region      string
}

func (*GCPReservedInstance) String

func (r *GCPReservedInstance) String() string

type GCPReservedInstancePlan

type GCPReservedInstancePlan struct {
	Name    string
	CPUCost float64
	RAMCost float64
}

type GCPResourceInfo

type GCPResourceInfo struct {
	ServiceDisplayName string `json:"serviceDisplayName"`
	ResourceFamily     string `json:"resourceFamily"`
	ResourceGroup      string `json:"resourceGroup"`
	UsageType          string `json:"usageType"`
}

GCPResourceInfo contains metadata about the node.

type Key

type Key interface {
	ID() string       // ID represents an exact match
	Features() string // Features are a comma separated string of node metadata that could match pricing
	GPUType() string  // GPUType returns "" if no GPU exists, but the name of the GPU otherwise
}

Key represents a way for nodes to match between the k8s API and a pricing API

type LoadBalancer

type LoadBalancer struct {
	IngressIPAddresses []string `json:"IngressIPAddresses"`
	Cost               float64  `json:"hourlyCost"`
}

LoadBalancer is the interface by which the provider and cost model communicate LoadBalancer prices. The provider will best-effort try to fill out this struct.

type Network

type Network struct {
	ZoneNetworkEgressCost     float64
	RegionNetworkEgressCost   float64
	InternetNetworkEgressCost float64
}

Network is the interface by which the provider and cost model communicate network egress prices. The provider will best-effort try to fill out this struct.

type Node

type Node struct {
	Cost             string                `json:"hourlyCost"`
	VCPU             string                `json:"CPU"`
	VCPUCost         string                `json:"CPUHourlyCost"`
	RAM              string                `json:"RAM"`
	RAMBytes         string                `json:"RAMBytes"`
	RAMCost          string                `json:"RAMGBHourlyCost"`
	Storage          string                `json:"storage"`
	StorageCost      string                `json:"storageHourlyCost"`
	UsesBaseCPUPrice bool                  `json:"usesDefaultPrice"`
	BaseCPUPrice     string                `json:"baseCPUPrice"` // Used to compute an implicit RAM GB/Hr price when RAM pricing is not provided.
	BaseRAMPrice     string                `json:"baseRAMPrice"` // Used to compute an implicit RAM GB/Hr price when RAM pricing is not provided.
	BaseGPUPrice     string                `json:"baseGPUPrice"`
	UsageType        string                `json:"usageType"`
	GPU              string                `json:"gpu"` // GPU represents the number of GPU on the instance
	GPUName          string                `json:"gpuName"`
	GPUCost          string                `json:"gpuCost"`
	InstanceType     string                `json:"instanceType,omitempty"`
	Region           string                `json:"region,omitempty"`
	Reserved         *ReservedInstanceData `json:"reserved,omitempty"`
	ProviderID       string                `json:"providerID,omitempty"`
	PricingType      PricingType           `json:"pricingType,omitempty"`
}

Node is the interface by which the provider and cost model communicate Node prices. The provider will best-effort try to fill out this struct.

func (*Node) IsSpot

func (n *Node) IsSpot() bool

IsSpot determines whether or not a Node uses spot by usage type

type NodePrice

type NodePrice struct {
	CPU string
	RAM string
	GPU string
}

type OutOfClusterAllocation

type OutOfClusterAllocation struct {
	Aggregator  string  `json:"aggregator"`
	Environment string  `json:"environment"`
	Service     string  `json:"service"`
	Cost        float64 `json:"cost"`
	Cluster     string  `json:"cluster"`
}

OutOfClusterAllocation represents a cloud provider cost not associated with kubernetes

type PV

type PV struct {
	Cost       string            `json:"hourlyCost"`
	CostPerIO  string            `json:"costPerIOOperation"`
	Class      string            `json:"storageClass"`
	Size       string            `json:"size"`
	Region     string            `json:"region"`
	ProviderID string            `json:"providerID,omitempty"`
	Parameters map[string]string `json:"parameters"`
}

PV is the interface by which the provider and cost model communicate PV prices. The provider will best-effort try to fill out this struct.

type PVKey

type PVKey interface {
	Features() string
	GetStorageClass() string
	ID() string
}

type PricingExpression

type PricingExpression struct {
	UsageUnit                string         `json:"usageUnit"`
	UsageUnitDescription     string         `json:"usageUnitDescription"`
	BaseUnit                 string         `json:"baseUnit"`
	BaseUnitConversionFactor int64          `json:"-"`
	DisplayQuantity          int            `json:"displayQuantity"`
	TieredRates              []*TieredRates `json:"tieredRates"`
}

PricingExpression contains metadata about a cost.

type PricingInfo

type PricingInfo struct {
	Summary                string             `json:"summary"`
	PricingExpression      *PricingExpression `json:"pricingExpression"`
	CurrencyConversionRate float64            `json:"currencyConversionRate"`
	EffectiveTime          string             `json:""`
}

PricingInfo contains metadata about a cost.

type PricingMatchMetadata

type PricingMatchMetadata struct {
	TotalNodes        int                 `json:"TotalNodes"`
	PricingTypeCounts map[PricingType]int `json:"PricingType"`
}

type PricingSource

type PricingSource struct {
	Name      string `json:"name"`
	Enabled   bool   `json:"enabled"`
	Available bool   `json:"available"`
	Error     string `json:"error"`
}

type PricingSources

type PricingSources struct {
	PricingSources map[string]*PricingSource
}

type PricingType

type PricingType string
const (
	Api           PricingType = "api"
	Spot          PricingType = "spot"
	Reserved      PricingType = "reserved"
	SavingsPlan   PricingType = "savingsPlan"
	CsvExact      PricingType = "csvExact"
	CsvClass      PricingType = "csvClass"
	DefaultPrices PricingType = "defaultPrices"
)

type Provider

type Provider interface {
	ClusterInfo() (map[string]string, error)
	GetAddresses() ([]byte, error)
	GetDisks() ([]byte, error)
	NodePricing(Key) (*Node, error)
	PVPricing(PVKey) (*PV, error)
	NetworkPricing() (*Network, error)           // TODO: add key interface arg for dynamic price fetching
	LoadBalancerPricing() (*LoadBalancer, error) // TODO: add key interface arg for dynamic price fetching
	AllNodePricing() (interface{}, error)
	DownloadPricingData() error
	GetKey(map[string]string, *v1.Node) Key
	GetPVKey(*v1.PersistentVolume, map[string]string, string) PVKey
	UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)
	UpdateConfigFromConfigMap(map[string]string) (*CustomPricing, error)
	GetConfig() (*CustomPricing, error)
	GetManagementPlatform() (string, error)
	GetLocalStorageQuery(time.Duration, time.Duration, bool, bool) string
	ApplyReservedInstancePricing(map[string]*Node)
	ServiceAccountStatus() *ServiceAccountStatus
	PricingSourceStatus() map[string]*PricingSource
	ClusterManagementPricing() (string, float64, error)
	CombinedDiscountForNode(string, bool, float64, float64) float64
	Regions() []string
}

Provider represents a k8s provider.

func NewProvider

func NewProvider(cache clustercache.ClusterCache, apiKey string, config *config.ConfigFileManager) (Provider, error)

NewProvider looks at the nodespec or provider metadata server to decide which provider to instantiate.

type ProviderConfig

type ProviderConfig struct {
	// contains filtered or unexported fields
}

ProviderConfig is a utility class that provides a thread-safe configuration storage/cache for all Provider implementations

func NewProviderConfig

func NewProviderConfig(configManager *config.ConfigFileManager, fileName string) *ProviderConfig

NewProviderConfig creates a new ConfigFile and returns the ProviderConfig

func (*ProviderConfig) ConfigFileManager

func (pc *ProviderConfig) ConfigFileManager() *config.ConfigFileManager

ConfigFileManager returns the ConfigFileManager instance used to manage the CustomPricing configuration. In the event of a multi-provider setup, this instance should be used to configure any other configuration providers.

func (*ProviderConfig) GetCustomPricingData

func (pc *ProviderConfig) GetCustomPricingData() (*CustomPricing, error)

ThreadSafe method for retrieving the custom pricing config.

func (*ProviderConfig) Update

func (pc *ProviderConfig) Update(updateFunc func(*CustomPricing) error) (*CustomPricing, error)

Allows a call to manually update the configuration while maintaining proper thread-safety for read/write methods.

func (*ProviderConfig) UpdateFromMap

func (pc *ProviderConfig) UpdateFromMap(a map[string]string) (*CustomPricing, error)

ThreadSafe update of the config using a string map

type RIData

type RIData struct {
	ResourceID     string
	EffectiveCost  float64
	ReservationARN string
	MostRecentDate string
}

type ReservedInstanceData

type ReservedInstanceData struct {
	ReservedCPU int64   `json:"reservedCPU"`
	ReservedRAM int64   `json:"reservedRAM"`
	CPUCost     float64 `json:"CPUHourlyCost"`
	RAMCost     float64 `json:"RAMHourlyCost"`
}

ReservedInstanceData keeps record of resources on a node should be priced at reserved rates

type SavingsPlanData

type SavingsPlanData struct {
	ResourceID     string
	EffectiveCost  float64
	SavingsPlanARN string
	MostRecentDate string
}

type Scaleway added in v1.97.0

type Scaleway struct {
	Clientset               clustercache.ClusterCache
	Config                  *ProviderConfig
	Pricing                 map[string]*ScalewayPricing
	DownloadPricingDataLock sync.RWMutex
}

func (*Scaleway) AllNodePricing added in v1.97.0

func (c *Scaleway) AllNodePricing() (interface{}, error)

func (*Scaleway) ApplyReservedInstancePricing added in v1.97.0

func (*Scaleway) ApplyReservedInstancePricing(map[string]*Node)

func (*Scaleway) ClusterInfo added in v1.97.0

func (scw *Scaleway) ClusterInfo() (map[string]string, error)

func (*Scaleway) ClusterManagementPricing added in v1.97.0

func (*Scaleway) ClusterManagementPricing() (string, float64, error)

func (*Scaleway) CombinedDiscountForNode added in v1.97.0

func (c *Scaleway) CombinedDiscountForNode(instanceType string, isPreemptible bool, defaultDiscount, negotiatedDiscount float64) float64

func (*Scaleway) DownloadPricingData added in v1.97.0

func (c *Scaleway) DownloadPricingData() error

func (*Scaleway) GetAddresses added in v1.97.0

func (*Scaleway) GetAddresses() ([]byte, error)

func (*Scaleway) GetConfig added in v1.97.0

func (scw *Scaleway) GetConfig() (*CustomPricing, error)

func (*Scaleway) GetDisks added in v1.97.0

func (*Scaleway) GetDisks() ([]byte, error)

func (*Scaleway) GetKey added in v1.97.0

func (c *Scaleway) GetKey(l map[string]string, n *v1.Node) Key

func (*Scaleway) GetLocalStorageQuery added in v1.97.0

func (*Scaleway) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string

func (*Scaleway) GetManagementPlatform added in v1.97.0

func (scw *Scaleway) GetManagementPlatform() (string, error)

func (*Scaleway) GetPVKey added in v1.97.0

func (c *Scaleway) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) PVKey

func (*Scaleway) LoadBalancerPricing added in v1.97.0

func (c *Scaleway) LoadBalancerPricing() (*LoadBalancer, error)

func (*Scaleway) NetworkPricing added in v1.97.0

func (c *Scaleway) NetworkPricing() (*Network, error)

func (*Scaleway) NodePricing added in v1.97.0

func (c *Scaleway) NodePricing(key Key) (*Node, error)

func (*Scaleway) PVPricing added in v1.97.0

func (c *Scaleway) PVPricing(pvk PVKey) (*PV, error)

func (*Scaleway) PricingSourceStatus added in v1.97.0

func (c *Scaleway) PricingSourceStatus() map[string]*PricingSource

func (*Scaleway) Regions added in v1.97.0

func (c *Scaleway) Regions() []string

func (*Scaleway) ServiceAccountStatus added in v1.97.0

func (c *Scaleway) ServiceAccountStatus() *ServiceAccountStatus

func (*Scaleway) UpdateConfig added in v1.97.0

func (c *Scaleway) UpdateConfig(r io.Reader, updateType string) (*CustomPricing, error)

func (*Scaleway) UpdateConfigFromConfigMap added in v1.97.0

func (c *Scaleway) UpdateConfigFromConfigMap(a map[string]string) (*CustomPricing, error)

type ScalewayPricing added in v1.97.0

type ScalewayPricing struct {
	NodesInfos map[string]*instance.ServerType
	PVCost     float64
}

type ServiceAccountCheck

type ServiceAccountCheck struct {
	Message        string `json:"message"`
	Status         bool   `json:"status"`
	AdditionalInfo string `json:"additionalInfo"`
}

type ServiceAccountChecks

type ServiceAccountChecks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ServiceAccountChecks is a thread safe map for holding ServiceAccountCheck objects

func NewServiceAccountChecks

func NewServiceAccountChecks() *ServiceAccountChecks

NewServiceAccountChecks initialize ServiceAccountChecks

type ServiceAccountStatus

type ServiceAccountStatus struct {
	Checks []*ServiceAccountCheck `json:"checks"`
}

type TieredRates

type TieredRates struct {
	StartUsageAmount int            `json:"startUsageAmount"`
	UnitPrice        *UnitPriceInfo `json:"unitPrice"`
}

TieredRates contain data about variable pricing.

type UnitPriceInfo

type UnitPriceInfo struct {
	CurrencyCode string  `json:"currencyCode"`
	Units        string  `json:"units"`
	Nanos        float64 `json:"nanos"`
}

UnitPriceInfo contains data about the actual price being charged.

Jump to

Keyboard shortcuts

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