pkg

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AnnotationDiskType    = "ultron.io/disk-type"
	AnnotationNetworkType = "ultron.io/network-type"
	AnnotationStorageSize = "ultron.io/storage-size"
	AnnotationPriority    = "ultron.io/priority"
	AnnotationManaged     = "ultron.io/managed"

	CacheKeyWeightedNodes                       = "ULTRON_WEIGHTED_NODES"
	CacheKeyDurableVmConfigurations             = "ULTRON_DURABLE_VMCONFIGURATION"
	CacheKeyDurableVmConfigurationLatencyRates  = "ULTRON_DURABLE_VMCONFIGURATION_LATENCY_RATES"
	CacheKeySpotVmConfigurations                = "ULTRON_SPOT_VMCONFIGURATION"
	CacheKeySpotVmConfigurationInteruptionRates = "ULTRON_SPOT_VMCONFIGURATION_INTERUPTION_RATES"

	ComputeTypeDurable   ComputeType = "durable"
	ComputeTypeEphemeral ComputeType = "ephemeral"

	DefaultDiskType              = "SSD"
	DefaultNetworkType           = "isolated"
	DefaultStorageSizeGB         = 10.0
	DefaultPriority              = PriorityLow
	DefaultDurableInstanceType   = "ultron.durable"
	DefaultEphemeralInstanceType = "ultron.ephemeral"

	EnvServerAddress                 = "ULTRON_SERVER_ADDRESS"
	EnvServerCertificateOrganization = "ULTRON_SERVER_CERTIFICATE_ORGANIZATION"
	EnvServerCertificateCommonName   = "ULTRON_SERVER_CERTIFICATE_COMMON_NAME"
	EnvServerCertificateDnsNames     = "ULTRON_SERVER_CERTIFICATE_DNS_NAMES"
	EnvServerCertificateIpAddresses  = "ULTRON_SERVER_CERTIFICATE_IP_ADDRESSES"
	EnvServerCertificateExportPath   = "ULTRON_SERVER_CERTIFICATE_EXPORT_PATH"
	EnvRedisServerAddress            = "ULTRON_SERVER_REDIS_ADDRESS"
	EnvRedisServerPassword           = "ULTRON_SERVER_REDIS_PASSWORD"
	EnvRedisServerDatabase           = "ULTRON_SERVER_REDIS_DATABASE"
	EnvKubernetesConfig              = "KUBECONFIG"
	EnvKubernetesServiceHost         = "KUBERNETES_SERVICE_HOST"
	EnvKubernetesServicePort         = "KUBERNETES_SERVICE_PORT"

	LabelHostName     = "kubernetes.io/hostname"
	LabelInstanceType = "node.kubernetes.io/instance-type"

	MetadataName = "metadata.name"

	PriorityLow  PriorityEnum = false
	PriorityHigh PriorityEnum = true

	TopicNodeObserve = "ULTRON_TOPIC_NODE_OBSERVE"
	TopicPodObserve  = "ULTRON_TOPIC_POD_OBSERVE"
)

Variables

This section is empty.

Functions

func InitializeRedisClient added in v0.1.3

func InitializeRedisClient(address string, password string, db int) *redis.Client

func InitializeRedisClientFromConfig added in v0.1.4

func InitializeRedisClientFromConfig(ctx context.Context, config *Config, sugar *zap.SugaredLogger) *redis.Client

Types

type ComputeConfiguration

type ComputeConfiguration struct {
	Id                *int32       `json:"id,omitempty"`
	ProviderId        *int32       `json:"providerId,omitempty"`
	ProviderName      *string      `json:"providerName,omitempty"`
	LocationId        *int32       `json:"locationId,omitempty"`
	LocationName      *string      `json:"locationName,omitempty"`
	DataCenterId      *string      `json:"dataCenterId,omitempty"`
	DataCenterName    *string      `json:"dataCenterName,omitempty"`
	OsId              *int32       `json:"osId,omitempty"`
	OsType            *string      `json:"osType,omitempty"`
	OsVersion         *string      `json:"osVersion,omitempty"`
	CloudNetworkTypes []string     `json:"cloudNetworkTypes,omitempty"`
	VCpuType          *string      `json:"vCpuType,omitempty"`
	VCpu              *int32       `json:"vCpu,omitempty"`
	RamGb             *int32       `json:"ramGb,omitempty"`
	VolumeGb          *int32       `json:"volumeGb,omitempty"`
	VolumeType        *string      `json:"volumeType,omitempty"`
	Cost              *ComputeCost `json:"cost,omitempty"`
	ComputeType       ComputeType  `json:"computeType,omitempty"`
}

type ComputeCost added in v0.0.6

type ComputeCost struct {
	Unit         *string  `json:"unit,omitempty"`
	Currency     *string  `json:"currency,omitempty"`
	PricePerUnit *float32 `json:"pricePerUnit,omitempty"`
}

type ComputeType

type ComputeType string

type Config added in v0.1.3

type Config struct {
	RedisServerAddress        string
	RedisServerPassword       string
	RedisServerDatabase       int
	ServerAddress             string
	CertificateOrganization   string
	CertificateCommonName     string
	CertificateDnsNamesCSV    string
	CertificateIpAddressesCSV string
	CertificateExportPath     string
}

func LoadConfig added in v0.1.3

func LoadConfig() (*Config, error)

type KubernetesClientWrapper added in v0.2.0

type KubernetesClientWrapper struct {
	ClientSet *kubernetes.Clientset
}

func (*KubernetesClientWrapper) CoreV1 added in v0.2.0

type MetricsClientWrapper added in v0.2.0

type MetricsClientWrapper struct {
	ClientSet *metricsclient.Clientset
}

func (*MetricsClientWrapper) MetricsV1beta1 added in v0.2.0

type MetricsContainer added in v0.2.0

type MetricsContainer struct {
	Name  string
	Usage corev1.ResourceList
}

type MetricsNode added in v0.2.0

type MetricsNode struct {
	Name  string
	Usage corev1.ResourceList
}

type MetricsNodeList added in v0.2.0

type MetricsNodeList struct {
	Items []MetricsNode
}

type MetricsPod added in v0.2.0

type MetricsPod struct {
	Name       string
	Namespace  string
	Containers []MetricsContainer
}

type MetricsPodList added in v0.2.0

type MetricsPodList struct {
	Items []MetricsPod
}

type PriorityEnum

type PriorityEnum bool

func (PriorityEnum) String

func (p PriorityEnum) String() string

type RealKubernetesClient added in v0.2.0

type RealKubernetesClient struct {
	ClientSet *kubernetes.Clientset
}

func (*RealKubernetesClient) ListNamespaces added in v0.2.0

func (*RealKubernetesClient) ListNodes added in v0.2.0

func (*RealKubernetesClient) ListPods added in v0.3.1

func (r *RealKubernetesClient) ListPods(ctx context.Context, namespace string, opts metav1.ListOptions) (*corev1.PodList, error)

type RealMetricsClient added in v0.2.0

type RealMetricsClient struct {
	ClientSet *metricsclient.Clientset
}

func (*RealMetricsClient) ListNodeMetrics added in v0.2.0

func (r *RealMetricsClient) ListNodeMetrics(ctx context.Context, opts metav1.ListOptions) (*MetricsNodeList, error)

func (*RealMetricsClient) ListPodMetrics added in v0.2.0

func (r *RealMetricsClient) ListPodMetrics(ctx context.Context, namespace string, opts metav1.ListOptions) (*MetricsPodList, error)

type WeightedInteruptionRate

type WeightedInteruptionRate struct {
	Selector map[string]string
	Value    float64
}

type WeightedLatencyRate

type WeightedLatencyRate struct {
	Selector map[string]string
	Value    float64
}

type WeightedNode

type WeightedNode struct {
	Selector         map[string]string
	AvailableCPU     float64
	TotalCPU         float64
	AvailableMemory  float64
	TotalMemory      float64
	AvailableStorage float64
	TotalStorage     float64
	DiskType         string
	NetworkType      string
	Price            float64
	MedianPrice      float64
	InstanceType     string
	InterruptionRate WeightedInteruptionRate
	LatencyRate      WeightedLatencyRate
}

type WeightedPod

type WeightedPod struct {
	Selector             map[string]string
	RequestedCPU         float64
	RequestedMemory      float64
	RequestedStorage     float64
	RequestedDiskType    string
	RequestedNetworkType string
	LimitCPU             float64
	LimitMemory          float64
	Priority             PriorityEnum
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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