digitalocean

package
v1.120.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 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 DODiskInfo added in v1.120.0

type DODiskInfo struct {
	Type string     `json:"type"`
	Size DODiskSize `json:"size"`
}

DODiskInfo represents disk information for a DigitalOcean size

type DODiskSize added in v1.120.0

type DODiskSize struct {
	Amount int    `json:"amount"`
	Unit   string `json:"unit"`
}

DODiskSize represents disk size details

type DOGPUInfo added in v1.120.0

type DOGPUInfo struct {
	Count int       `json:"count"`
	VRAM  DOGPUVRAM `json:"vram"`
	Model string    `json:"model"`
}

DOGPUInfo represents GPU information for a DigitalOcean size

type DOGPUVRAM added in v1.120.0

type DOGPUVRAM struct {
	Amount int    `json:"amount"`
	Unit   string `json:"unit"`
}

DOGPUVRAM represents GPU VRAM details

type DOKS

type DOKS struct {
	PricingURL            string
	Cache                 *PricingCache
	Sizes                 map[string]*DOSize
	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 DOLinks struct {
	Pages DOPages `json:"pages,omitempty"`
}

DOLinks represents pagination links

type DOMeta added in v1.120.0

type DOMeta struct {
	Total int `json:"total"`
}

DOMeta represents metadata about the response

type DOPages added in v1.120.0

type DOPages struct {
	First string `json:"first,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Next  string `json:"next,omitempty"`
	Last  string `json:"last,omitempty"`
}

DOPages represents pagination page links

type DOResponse

type DOResponse struct {
	Sizes []DOSize `json:"sizes"`
	Links DOLinks  `json:"links,omitempty"`
	Meta  DOMeta   `json:"meta,omitempty"`
}

DOResponse represents the response from DigitalOcean's /v2/sizes API

type DOSize added in v1.120.0

type DOSize struct {
	Slug         string       `json:"slug"`
	Memory       int          `json:"memory"` // Memory in MB
	VCPUs        int          `json:"vcpus"`
	Disk         int          `json:"disk"`          // Disk in GB
	Transfer     float64      `json:"transfer"`      // Transfer in TB
	PriceMonthly float64      `json:"price_monthly"` // Monthly price in USD
	PriceHourly  float64      `json:"price_hourly"`  // Hourly price in USD
	Regions      []string     `json:"regions"`
	Available    bool         `json:"available"`
	Description  string       `json:"description"`
	DiskInfo     []DODiskInfo `json:"disk_info,omitempty"`
	GPUInfo      DOGPUInfo    `json:"gpu_info,omitempty"`
}

DOSize represents a DigitalOcean Droplet size

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