Documentation
¶
Index ¶
- Constants
- func AzureIsK8s(labels map[string]string) bool
- func AzureSetProviderID(abv *BillingRowValues) (providerID string, isVMSSShared bool)
- func ConvertAzureStorageConfigToConfig(asc AzureStorageConfig) cloud.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 Authorizer
- type AuthorizerHolder
- 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, models.PricingMetadata, 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 DefaultAzureCredentialHolder
- func (dac *DefaultAzureCredentialHolder) Equals(config cloud.Config) bool
- func (dac *DefaultAzureCredentialHolder) GetCredential() (azcore.TokenCredential, error)
- func (dac *DefaultAzureCredentialHolder) MarshalJSON() ([]byte, error)
- func (dac *DefaultAzureCredentialHolder) Sanitize() cloud.Config
- func (dac *DefaultAzureCredentialHolder) Validate() error
- type PriceSheetClient
- type PriceSheetClientDownloadProperties
- type PriceSheetClientDownloadResponse
- type PriceSheetDownloader
- type SharedKeyCredential
- func (skc *SharedKeyCredential) Equals(config cloud.Config) bool
- func (skc *SharedKeyCredential) GetBlobClient(serviceURL string) (*azblob.Client, error)
- func (skc *SharedKeyCredential) MarshalJSON() ([]byte, error)
- func (skc *SharedKeyCredential) Sanitize() cloud.Config
- func (skc *SharedKeyCredential) Validate() error
- type StorageAuthorizer
- type StorageConfiguration
- func (sc *StorageConfiguration) Equals(config cloud.Config) bool
- func (sc *StorageConfiguration) Key() string
- func (sc *StorageConfiguration) Provider() string
- func (sc *StorageConfiguration) Sanitize() cloud.Config
- func (sc *StorageConfiguration) UnmarshalJSON(b []byte) error
- func (sc *StorageConfiguration) Validate() error
- type StorageConnection
Constants ¶
const ( AzureFilePremiumStorageClass = "premium_smb" AzureFileStandardStorageClass = "standard_smb" AzureDiskPremiumSSDStorageClass = "premium_ssd" AzureDiskStandardSSDStorageClass = "standard_ssd" AzureDiskStandardStorageClass = "standard_hdd" AzureStorageUpdateType = "AzureStorage" )
const AzureEnterpriseDateLayout = "01/02/2006"
const DefaultCredentialAuthorizerType = "AzureDefaultCredential"
Variables ¶
This section is empty.
Functions ¶
func AzureIsK8s ¶
Check for the presence of k8s labels
func AzureSetProviderID ¶
func AzureSetProviderID(abv *BillingRowValues) (providerID string, isVMSSShared bool)
isVMSSShared represents a bool that lets you know while setting providerID we were able to get the actual VMName associated with a VM of a group of VMs in VMSS.
func ConvertAzureStorageConfigToConfig ¶
func ConvertAzureStorageConfigToConfig(asc AzureStorageConfig) cloud.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 Authorizer ¶
type Authorizer interface {
cloud.Authorizer
GetCredential() (azcore.TokenCredential, error)
}
Authorizer configs provide credentials from azidentity to connect to Azure services.
func SelectAuthorizerByType ¶
func SelectAuthorizerByType(typeStr string) (Authorizer, error)
SelectAuthorizerByType is an implementation of AuthorizerSelectorFn and acts as a register for Authorizer types
type AuthorizerHolder ¶ added in v1.108.0
type AuthorizerHolder struct {
Authorizer
}
AuthorizerHolder is a StorageAuthorizer implementation that wraps an Authorizer implementation
func (*AuthorizerHolder) Equals ¶ added in v1.108.0
func (ah *AuthorizerHolder) Equals(config cloud.Config) bool
func (*AuthorizerHolder) GetBlobClient ¶ added in v1.108.0
func (ah *AuthorizerHolder) GetBlobClient(serviceURL string) (*azblob.Client, error)
func (*AuthorizerHolder) Sanitize ¶ added in v1.108.0
func (ah *AuthorizerHolder) Sanitize() cloud.Config
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 cloud.Config) bool
func (*AzureStorageBillingParser) ParseBillingData ¶
func (asbp *AzureStorageBillingParser) ParseBillingData(start, end time.Time, resultFn AzureBillingResultFunc) 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
}
func (*AzureStorageIntegration) GetCloudCost ¶
func (asi *AzureStorageIntegration) GetCloudCost(start, end time.Time) (*opencost.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 DefaultAzureCredentialHolder ¶ added in v1.108.0
type DefaultAzureCredentialHolder struct{}
func (*DefaultAzureCredentialHolder) Equals ¶ added in v1.108.0
func (dac *DefaultAzureCredentialHolder) Equals(config cloud.Config) bool
func (*DefaultAzureCredentialHolder) GetCredential ¶ added in v1.108.0
func (dac *DefaultAzureCredentialHolder) GetCredential() (azcore.TokenCredential, error)
func (*DefaultAzureCredentialHolder) MarshalJSON ¶ added in v1.108.0
func (dac *DefaultAzureCredentialHolder) MarshalJSON() ([]byte, error)
func (*DefaultAzureCredentialHolder) Sanitize ¶ added in v1.108.0
func (dac *DefaultAzureCredentialHolder) Sanitize() cloud.Config
func (*DefaultAzureCredentialHolder) Validate ¶ added in v1.108.0
func (dac *DefaultAzureCredentialHolder) Validate() error
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 SharedKeyCredential ¶ added in v1.108.0
type SharedKeyCredential struct {
}
SharedKeyCredential is a StorageAuthorizer with credentials which cannot be used to authorize other services. This is a legacy auth method which is not included in azidentity
func (*SharedKeyCredential) Equals ¶ added in v1.108.0
func (skc *SharedKeyCredential) Equals(config cloud.Config) bool
func (*SharedKeyCredential) GetBlobClient ¶ added in v1.108.0
func (skc *SharedKeyCredential) GetBlobClient(serviceURL string) (*azblob.Client, error)
func (*SharedKeyCredential) MarshalJSON ¶ added in v1.108.0
func (skc *SharedKeyCredential) MarshalJSON() ([]byte, error)
func (*SharedKeyCredential) Sanitize ¶ added in v1.108.0
func (skc *SharedKeyCredential) Sanitize() cloud.Config
func (*SharedKeyCredential) Validate ¶ added in v1.108.0
func (skc *SharedKeyCredential) Validate() error
type StorageAuthorizer ¶ added in v1.108.0
type StorageAuthorizer interface {
cloud.Authorizer
GetBlobClient(serviceURL string) (*azblob.Client, error)
}
StorageAuthorizer is a service specific Authorizer for Azure Storage, it exists so that we can support existing Shared Key configurations while allowing the Authorizer to have a service agnostic api
func SelectStorageAuthorizerByType ¶ added in v1.108.0
func SelectStorageAuthorizerByType(typeStr string) (StorageAuthorizer, error)
SelectStorageAuthorizerByType is an implementation of AuthorizerSelectorFn and acts as a register for Authorizer types
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 StorageAuthorizer `json:"authorizer"`
}
func (*StorageConfiguration) Equals ¶
func (sc *StorageConfiguration) Equals(config cloud.Config) bool
func (*StorageConfiguration) Key ¶
func (sc *StorageConfiguration) Key() string
func (*StorageConfiguration) Provider ¶ added in v1.107.0
func (sc *StorageConfiguration) Provider() string
func (*StorageConfiguration) Sanitize ¶
func (sc *StorageConfiguration) Sanitize() cloud.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
ConnectionStatus cloud.ConnectionStatus
}
StorageConnection provides access to Azure Storage
func (*StorageConnection) DownloadBlobToFile ¶ added in v1.109.0
func (sc *StorageConnection) DownloadBlobToFile(localFilePath string, blobName string, client *azblob.Client, ctx context.Context) error
DownloadBlobToFile downloads the Azure Billing CSV to a local file
func (*StorageConnection) GetStatus ¶ added in v1.107.0
func (sc *StorageConnection) GetStatus() cloud.ConnectionStatus