digitalocean

package
v1.117.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOAllowance

type DOAllowance struct {
	Quantity    string `json:"quantity"`
	Unit        string `json:"unit"`
	AllowanceId string `json:"allowanceId"`
	Schedule    string `json:"schedule"`
}

type DOAttribute

type DOAttribute struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Unit  string `json:"unit"`
}

type DOKS

type DOKS struct {
	PricingURL            string
	Cache                 *PricingCache
	Products              map[string][]DOProduct
	Config                models.ProviderConfig
	Clientset             clustercache.ClusterCache
	ClusterManagementCost float64
}

func NewDOKSProvider

func NewDOKSProvider(pricingURL string) *DOKS

func (*DOKS) AllNodePricing

func (do *DOKS) AllNodePricing() (interface{}, error)

func (*DOKS) AllPVPricing

func (do *DOKS) AllPVPricing() (map[models.PVKey]*models.PV, error)

func (*DOKS) ApplyReservedInstancePricing

func (do *DOKS) ApplyReservedInstancePricing(map[string]*models.Node)

func (*DOKS) ClusterInfo

func (do *DOKS) ClusterInfo() (map[string]string, error)

func (*DOKS) ClusterManagementPricing

func (do *DOKS) ClusterManagementPricing() (string, float64, error)

func (*DOKS) CombinedDiscountForNode

func (do *DOKS) CombinedDiscountForNode(string, bool, float64, float64) float64

func (*DOKS) CustomPricingEnabled

func (do *DOKS) CustomPricingEnabled() bool

func (*DOKS) DownloadPricingData

func (do *DOKS) DownloadPricingData() error

func (*DOKS) GetAddresses

func (do *DOKS) GetAddresses() ([]byte, error)

func (*DOKS) GetClusterManagementPricing

func (do *DOKS) GetClusterManagementPricing() float64

func (*DOKS) GetConfig

func (do *DOKS) GetConfig() (*models.CustomPricing, error)

func (*DOKS) GetDisks

func (do *DOKS) GetDisks() ([]byte, error)

func (*DOKS) GetKey

func (do *DOKS) GetKey(labels map[string]string, n *clustercache.Node) models.Key

func (*DOKS) GetManagementPlatform

func (do *DOKS) GetManagementPlatform() (string, error)

func (*DOKS) GetOrphanedResources

func (do *DOKS) GetOrphanedResources() ([]models.OrphanedResource, error)

func (*DOKS) GetPVKey

func (do *DOKS) GetPVKey(pv *clustercache.PersistentVolume, parameters map[string]string, defaultRegion string) models.PVKey

func (*DOKS) GpuPricing

func (do *DOKS) GpuPricing(input map[string]string) (string, error)

func (*DOKS) LoadBalancerPricing

func (do *DOKS) LoadBalancerPricing() (*models.LoadBalancer, error)

LoadBalancerPricing returns the hourly cost of a Load Balancer in DigitalOcean (DOKS).

DigitalOcean offers multiple Load Balancers with different prices:

- Public HTTP Load Balancer: ~$0.01786/hr - Private Network Load Balancer: ~$0.02232/hr - Public Network Load Balancer: ~$0.02232/hr - Statically sized Load Balancers: $0.01786–$0.10714/hr

However, the current OpenCost provider interface does not pass information about individual Load Balancer characteristics (like annotations or network mode).

As a result, this implementation uses a fixed average hourly rate of $0.02, which is representative of the most common DO LBs.

TODO Once the provider interface supports more granular Load Balancer metadata, this method should be updated to assign costs more precisely.

func (*DOKS) NetworkPricing

func (do *DOKS) NetworkPricing() (*models.Network, error)

func (*DOKS) NodePricing

func (do *DOKS) NodePricing(key models.Key) (*models.Node, models.PricingMetadata, error)

func (*DOKS) PVPricing

func (do *DOKS) PVPricing(key models.PVKey) (*models.PV, error)

func (*DOKS) PricingSourceStatus

func (do *DOKS) PricingSourceStatus() map[string]*models.PricingSource

func (*DOKS) PricingSourceSummary

func (do *DOKS) PricingSourceSummary() interface{}

func (*DOKS) Regions

func (do *DOKS) Regions() []string

func (*DOKS) ServiceAccountStatus

func (do *DOKS) ServiceAccountStatus() *models.ServiceAccountStatus

func (*DOKS) UpdateConfig

func (do *DOKS) UpdateConfig(r io.Reader, updateType string) (*models.CustomPricing, error)

func (*DOKS) UpdateConfigFromConfigMap

func (do *DOKS) UpdateConfigFromConfigMap(map[string]string) (*models.CustomPricing, error)

type DOPrice

type DOPrice struct {
	Unit      string `json:"unit"`
	Rate      string `json:"rate"`
	MinAmount string `json:"minAmount"`
	MaxAmount string `json:"maxAmount"`
	MinUsage  string `json:"minUsage"`
	MaxUsage  string `json:"maxUsage"`
	Currency  string `json:"currency"`
	Region    string `json:"region"`
}

type DOProduct

type DOProduct struct {
	SKU         string        `json:"sku"`
	ItemType    string        `json:"itemType"`
	DisplayName string        `json:"displayName"`
	Category    string        `json:"category"`
	Prices      []DOPrice     `json:"prices"`
	Allowances  []DOAllowance `json:"allowances,omitempty"`
	Attributes  []DOAttribute `json:"attributes,omitempty"`
	EffectiveAt string        `json:"effectiveAt"`
}

type DOResponse

type DOResponse struct {
	Products []DOProduct `json:"products"`
}

type PricingCache

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

func NewPricingCache

func NewPricingCache() *PricingCache

type SlugBase

type SlugBase struct {
	BaseSlug   string
	BaseCost   float64
	BaseVCPU   int
	BaseRAMGiB int
}

Jump to

Keyboard shortcuts

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