Documentation
¶
Index ¶
- Constants
- func AzureIsK8s(labels map[string]string) bool
- func AzureSetProviderID(abv *BillingRowValues) string
- func ConvertAzureStorageConfigToConfig(asc AzureStorageConfig) config.KeyedConfig
- func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string, env azure.Environment) auth.ClientCredentialsConfig
- func ParseAzureSubscriptionID(id string) string
- func SelectAzureCategory(meterCategory string) string
- type AccessKey
- type Authorizer
- type Azure
- func (az *Azure) AllNodePricing() (interface{}, error)
- func (az *Azure) ApplyReservedInstancePricing(nodes map[string]*models.Node)
- func (az *Azure) ClusterInfo() (map[string]string, error)
- func (*Azure) ClusterManagementPricing() (string, float64, error)
- func (az *Azure) CombinedDiscountForNode(instanceType string, isPreemptible bool, ...) float64
- func (az *Azure) DownloadPricingData() error
- func (*Azure) GetAddresses() ([]byte, error)
- func (az *Azure) GetAzureStorageConfig(forceReload bool, cp *models.CustomPricing) (*AzureStorageConfig, error)
- func (az *Azure) GetConfig() (*models.CustomPricing, error)
- func (az *Azure) GetDisks() ([]byte, error)
- func (az *Azure) GetKey(labels map[string]string, n *v1.Node) models.Key
- func (az *Azure) GetLocalStorageQuery(window, offset time.Duration, rate bool, used bool) string
- func (az *Azure) GetManagementPlatform() (string, error)
- func (az *Azure) GetOrphanedResources() ([]models.OrphanedResource, error)
- func (az *Azure) GetPVKey(pv *v1.PersistentVolume, parameters map[string]string, defaultRegion string) models.PVKey
- func (azr *Azure) LoadBalancerPricing() (*models.LoadBalancer, error)
- func (az *Azure) NetworkPricing() (*models.Network, error)
- func (az *Azure) NodePricing(key models.Key) (*models.Node, error)
- func (az *Azure) PVPricing(pvk models.PVKey) (*models.PV, error)
- func (az *Azure) PricingSourceStatus() map[string]*models.PricingSource
- func (az *Azure) PricingSourceSummary() interface{}
- func (az *Azure) Regions() []string
- func (az *Azure) ServiceAccountStatus() *models.ServiceAccountStatus
- func (az *Azure) UpdateConfig(r io.Reader, updateType string) (*models.CustomPricing, error)
- func (az *Azure) UpdateConfigFromConfigMap(a map[string]string) (*models.CustomPricing, error)
- type AzureAppKey
- type AzureBillingResultFunc
- type AzurePricing
- type AzureRetailPricing
- type AzureRetailPricingAttributes
- type AzureServiceKey
- type AzureStorageBillingParser
- type AzureStorageConfig
- type AzureStorageIntegration
- type BillingExportParser
- type BillingRowValues
- type PriceSheetClient
- type PriceSheetClientDownloadProperties
- type PriceSheetClientDownloadResponse
- type PriceSheetDownloader
- type StorageConfiguration
- type StorageConnection
Constants ¶
const ( AzureFilePremiumStorageClass = "premium_smb" AzureFileStandardStorageClass = "standard_smb" AzureDiskPremiumSSDStorageClass = "premium_ssd" AzureDiskStandardSSDStorageClass = "standard_ssd" AzureDiskStandardStorageClass = "standard_hdd" AzureStorageUpdateType = "AzureStorage" )
const AccessKeyAuthorizerType = "AzureAccessKey"
const AzureEnterpriseDateLayout = "01/02/2006"
Variables ¶
This section is empty.
Functions ¶
func AzureIsK8s ¶
Check for the presence of k8s labels
func AzureSetProviderID ¶
func AzureSetProviderID(abv *BillingRowValues) string
func ConvertAzureStorageConfigToConfig ¶
func ConvertAzureStorageConfigToConfig(asc AzureStorageConfig) config.KeyedConfig
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 SelectAzureCategory ¶
Types ¶
type AccessKey ¶
func (*AccessKey) GetBlobCredentials ¶
func (ak *AccessKey) GetBlobCredentials() (azblob.Credential, error)
func (*AccessKey) MarshalJSON ¶
type Authorizer ¶
type Authorizer interface { config.Authorizer GetBlobCredentials() (azblob.Credential, error) }
func SelectAuthorizerByType ¶
func SelectAuthorizerByType(typeStr string) (Authorizer, error)
SelectAuthorizerByType is an implementation of AuthorizerSelectorFn and acts as a register for Authorizer types
type Azure ¶
type Azure struct { Pricing map[string]*AzurePricing DownloadPricingDataLock sync.RWMutex Clientset clustercache.ClusterCache Config models.ProviderConfig ServiceAccountChecks *models.ServiceAccountChecks ClusterAccountID string ClusterRegion string // contains filtered or unexported fields }
func (*Azure) AllNodePricing ¶
AllNodePricing returns the Azure pricing objects stored
func (*Azure) ApplyReservedInstancePricing ¶
func (*Azure) ClusterManagementPricing ¶
func (*Azure) CombinedDiscountForNode ¶
func (*Azure) DownloadPricingData ¶
DownloadPricingData uses provided azure "best guesses" for pricing
func (*Azure) GetAddresses ¶
func (*Azure) GetAzureStorageConfig ¶
func (az *Azure) GetAzureStorageConfig(forceReload bool, cp *models.CustomPricing) (*AzureStorageConfig, error)
GetAzureStorageConfig retrieves storage config from secret and sets default values
func (*Azure) GetLocalStorageQuery ¶
func (*Azure) GetManagementPlatform ¶
func (*Azure) GetOrphanedResources ¶
func (az *Azure) GetOrphanedResources() ([]models.OrphanedResource, error)
func (*Azure) LoadBalancerPricing ¶
func (azr *Azure) LoadBalancerPricing() (*models.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 ¶
Stubbed NetworkPricing for Azure. Pull directly from azure.json for now
func (*Azure) NodePricing ¶
NodePricing returns Azure pricing data for a single node
func (*Azure) PricingSourceStatus ¶
func (az *Azure) PricingSourceStatus() map[string]*models.PricingSource
PricingSourceStatus returns the status of the rate card api
func (*Azure) PricingSourceSummary ¶
func (az *Azure) 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 (*Azure) ServiceAccountStatus ¶
func (az *Azure) ServiceAccountStatus() *models.ServiceAccountStatus
func (*Azure) UpdateConfig ¶
func (*Azure) UpdateConfigFromConfigMap ¶
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 AzureBillingResultFunc ¶
type AzureBillingResultFunc func(*BillingRowValues) error
type AzurePricing ¶
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"` }
AzureServiceKey service key for a specific subscription Deprecated: v1.104 Use ServiceKey instead
func (*AzureServiceKey) IsValid ¶
func (ask *AzureServiceKey) IsValid() bool
Validity check on service key
type AzureStorageBillingParser ¶
type AzureStorageBillingParser struct {
StorageConnection
}
AzureStorageBillingParser accesses billing data stored in CSV files in Azure Storage
func (*AzureStorageBillingParser) Equals ¶
func (asbp *AzureStorageBillingParser) Equals(config cloudconfig.Config) bool
func (*AzureStorageBillingParser) ParseBillingData ¶
func (asbp *AzureStorageBillingParser) ParseBillingData(start, end time.Time, resultFn AzureBillingResultFunc) (cloud.ConnectionStatus, error)
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 Deprecated: v1.104 Use StorageConfiguration instead
func (*AzureStorageConfig) IsEmpty ¶
func (asc *AzureStorageConfig) IsEmpty() bool
IsEmpty returns true if all fields in config are empty, false if not.
type AzureStorageIntegration ¶
type AzureStorageIntegration struct { AzureStorageBillingParser ConnectionStatus cloud.ConnectionStatus }
func (*AzureStorageIntegration) GetCloudCost ¶
func (asi *AzureStorageIntegration) GetCloudCost(start, end time.Time) (*kubecost.CloudCostSetRange, error)
type BillingExportParser ¶
type BillingExportParser struct { Date int MeterCategory int InvoiceEntityID int SubscriptionID int InstanceID int Service int Tags int AdditionalInfo int Cost int NetCost int DateFormat string }
BillingExportParser holds indexes of relevent fields in Azure Billing CSV in addition to the correct data format
func NewBillingParseSchema ¶
func NewBillingParseSchema(headers []string) (*BillingExportParser, error)
func (*BillingExportParser) ParseRow ¶
func (bep *BillingExportParser) ParseRow(start, end time.Time, record []string) *BillingRowValues
type BillingRowValues ¶
type BillingRowValues struct { Date time.Time MeterCategory string SubscriptionID string InvoiceEntityID string InstanceID string Service string Tags map[string]string AdditionalInfo map[string]any Cost float64 NetCost float64 }
BillingRowValues holder for Azure Billing Values
func (*BillingRowValues) IsCompute ¶
func (brv *BillingRowValues) IsCompute(category string) bool
type PriceSheetClient ¶
type PriceSheetClient struct {
// contains filtered or unexported fields
}
PriceSheetClient contains the methods for the PriceSheet group. Don't use this type directly, use NewPriceSheetClient() instead.
func NewPriceSheetClient ¶
func NewPriceSheetClient(billingAccountID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PriceSheetClient, error)
NewPriceSheetClient creates a new instance of PriceSheetClient with the specified values. billingAccountId - Azure Billing Account ID. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.
func (*PriceSheetClient) BeginDownloadByBillingPeriod ¶
func (client *PriceSheetClient) BeginDownloadByBillingPeriod(ctx context.Context, billingPeriodName string) (*runtime.Poller[PriceSheetClientDownloadResponse], error)
BeginDownloadByBillingPeriod - requests a pricesheet for a specific billing period `yyyymm`. Returns a Poller that will provide the download URL when the pricesheet is ready. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-06-01 billingPeriodName - Billing Period Name `yyyymm`.
type PriceSheetDownloader ¶
type PriceSheetDownloader struct { TenantID string ClientID string ClientSecret string BillingAccount string OfferID string ConvertMeterInfo func(info commerce.MeterInfo) (map[string]*AzurePricing, error) }
func (*PriceSheetDownloader) GetPricing ¶
func (d *PriceSheetDownloader) GetPricing(ctx context.Context) (map[string]*AzurePricing, error)
type StorageConfiguration ¶
type StorageConfiguration struct { SubscriptionID string `json:"subscriptionID"` Account string `json:"account"` Container string `json:"container"` Path string `json:"path"` Cloud string `json:"cloud"` Authorizer Authorizer `json:"authorizer"` }
func (*StorageConfiguration) Equals ¶
func (sc *StorageConfiguration) Equals(config config.Config) bool
func (*StorageConfiguration) Key ¶
func (sc *StorageConfiguration) Key() string
func (*StorageConfiguration) Sanitize ¶
func (sc *StorageConfiguration) Sanitize() config.Config
func (*StorageConfiguration) UnmarshalJSON ¶
func (sc *StorageConfiguration) UnmarshalJSON(b []byte) error
func (*StorageConfiguration) Validate ¶
func (sc *StorageConfiguration) Validate() error
Check ensures that all required fields are set, and throws an error if they are not
type StorageConnection ¶
type StorageConnection struct {
StorageConfiguration
}
StorageConnection provides access to Azure Storage
func (*StorageConnection) DownloadBlob ¶
func (sc *StorageConnection) DownloadBlob(blobName string, containerURL *azblob.ContainerURL, ctx context.Context) ([]byte, error)
func (*StorageConnection) Equals ¶
func (sc *StorageConnection) Equals(config cloudconfig.Config) bool