services

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 30 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

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

func NewCacheService added in v0.0.7

func NewCacheService(innerCache *cache.Cache, redisClient *redis.Client) *CacheService

func (*CacheService) AddCacheItem

func (c *CacheService) AddCacheItem(key string, value interface{}, d time.Duration) error

func (*CacheService) GetAllComputeConfigurations

func (c *CacheService) GetAllComputeConfigurations() ([]ultron.ComputeConfiguration, error)

func (*CacheService) GetCacheItem

func (c *CacheService) GetCacheItem(key string) (interface{}, error)

func (*CacheService) GetDurableComputeConfigurations

func (c *CacheService) GetDurableComputeConfigurations() ([]ultron.ComputeConfiguration, error)

func (*CacheService) GetEphemeralComputeConfigurations

func (c *CacheService) GetEphemeralComputeConfigurations() ([]ultron.ComputeConfiguration, error)

func (*CacheService) GetWeightedInteruptionRates

func (c *CacheService) GetWeightedInteruptionRates() ([]ultron.WeightedInteruptionRate, error)

func (*CacheService) GetWeightedLatencyRates

func (c *CacheService) GetWeightedLatencyRates() ([]ultron.WeightedLatencyRate, error)

func (*CacheService) GetWeightedNodes

func (c *CacheService) GetWeightedNodes() ([]ultron.WeightedNode, error)

type CertificateService added in v0.0.3

type CertificateService struct {
}

func NewCertificateService added in v0.0.7

func NewCertificateService() *CertificateService

func (*CertificateService) ExportCACert added in v0.0.3

func (cs *CertificateService) ExportCACert(caCert []byte, filePath string) error

func (*CertificateService) GenerateSelfSignedCert added in v0.0.3

func (cs *CertificateService) GenerateSelfSignedCert(organization string, commonName string, dnsNames []string, ipAddresses []net.IP) (tls.Certificate, error)

type ComputeService

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

func NewComputeService added in v0.0.7

func NewComputeService(algorithm algorithm.IAlgorithm, cacheService ICacheService, mapper mapper.IMapper) *ComputeService

func (*ComputeService) CalculateWeightedNodeMedianPrice

func (cs *ComputeService) CalculateWeightedNodeMedianPrice(wNode *ultron.WeightedNode) (float64, error)

func (*ComputeService) ComputeConfigurationMatchesWeightedNodeRequirements

func (cs *ComputeService) ComputeConfigurationMatchesWeightedNodeRequirements(computeConfiguration *ultron.ComputeConfiguration, wNode *ultron.WeightedNode) bool

func (*ComputeService) ComputeConfigurationMatchesWeightedPodRequirements

func (cs *ComputeService) ComputeConfigurationMatchesWeightedPodRequirements(computeConfiguration *ultron.ComputeConfiguration, wPod *ultron.WeightedPod) bool

func (*ComputeService) GetInteruptionRateForWeightedNode added in v0.0.7

func (cs *ComputeService) GetInteruptionRateForWeightedNode(wNode *ultron.WeightedNode) (match *ultron.WeightedInteruptionRate, err error)

func (*ComputeService) GetLatencyRateForWeightedNode added in v0.0.7

func (cs *ComputeService) GetLatencyRateForWeightedNode(wNode *ultron.WeightedNode) (match *ultron.WeightedLatencyRate, err error)

func (*ComputeService) MatchPodSpec

func (cs *ComputeService) MatchPodSpec(pod *corev1.Pod) (*ultron.WeightedNode, error)

func (*ComputeService) MatchWeightedNodeToComputeConfiguration

func (cs *ComputeService) MatchWeightedNodeToComputeConfiguration(wNode *ultron.WeightedNode) (*ultron.ComputeConfiguration, error)

func (*ComputeService) MatchWeightedPodToComputeConfiguration

func (cs *ComputeService) MatchWeightedPodToComputeConfiguration(wPod *ultron.WeightedPod) (*ultron.ComputeConfiguration, error)

func (*ComputeService) MatchWeightedPodToWeightedNode

func (cs *ComputeService) MatchWeightedPodToWeightedNode(pod *ultron.WeightedPod) (*ultron.WeightedNode, error)

type ICacheService

type ICacheService interface {
	AddCacheItem(key string, value interface{}, d time.Duration) error
	GetCacheItem(key string) (interface{}, error)
	GetAllComputeConfigurations() ([]ultron.ComputeConfiguration, error)
	GetEphemeralComputeConfigurations() ([]ultron.ComputeConfiguration, error)
	GetDurableComputeConfigurations() ([]ultron.ComputeConfiguration, error)
	GetWeightedNodes() ([]ultron.WeightedNode, error)
	GetWeightedInteruptionRates() ([]ultron.WeightedInteruptionRate, error)
	GetWeightedLatencyRates() ([]ultron.WeightedLatencyRate, error)
}

type ICertificateService added in v0.0.3

type ICertificateService interface {
	GenerateSelfSignedCert(organization string, commonName string, dnsNames []string, ipAddresses []net.IP) (tls.Certificate, error)
	ExportCACert(caCert []byte, filePath string) error
}

type IComputeService

type IComputeService interface {
	MatchPodSpec(pod *corev1.Pod) (*ultron.WeightedNode, error)
	MatchWeightedPodToComputeConfiguration(wPod *ultron.WeightedPod) (*ultron.ComputeConfiguration, error)
	MatchWeightedNodeToComputeConfiguration(wNode *ultron.WeightedNode) (*ultron.ComputeConfiguration, error)
	MatchWeightedPodToWeightedNode(wPod *ultron.WeightedPod) (*ultron.WeightedNode, error)
	CalculateWeightedNodeMedianPrice(wNode *ultron.WeightedNode) (float64, error)
	ComputeConfigurationMatchesWeightedNodeRequirements(computeConfiguration *ultron.ComputeConfiguration, wNode *ultron.WeightedNode) bool
	ComputeConfigurationMatchesWeightedPodRequirements(computeConfiguration *ultron.ComputeConfiguration, wPod *ultron.WeightedPod) bool
	GetInteruptionRateForWeightedNode(wNode *ultron.WeightedNode) (*ultron.WeightedInteruptionRate, error)
	GetLatencyRateForWeightedNode(wNode *ultron.WeightedNode) (*ultron.WeightedLatencyRate, error)
}

type ICoreClient added in v0.2.0

type ICoreClient interface {
	ListPods(ctx context.Context, namespace string, opts metav1.ListOptions) (*corev1.PodList, error)
	ListNodes(ctx context.Context, opts metav1.ListOptions) (*corev1.NodeList, error)
	ListNamespaces(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error)
}

type IKubernetesService added in v0.1.2

type IKubernetesService interface {
	GetPods(ctx context.Context, options metav1.ListOptions) ([]corev1.Pod, error)
	GetNodes(ctx context.Context, options metav1.ListOptions) ([]corev1.Node, error)
	GetNodeMetrics(ctx context.Context, options metav1.ListOptions) (map[string]map[string]string, error)
	GetPodMetrics(ctx context.Context, options metav1.ListOptions) (map[string]map[string]string, error)
}

type IMetricsClient added in v0.2.0

type IMetricsClient interface {
	ListNodeMetrics(ctx context.Context, opts metav1.ListOptions) (*ultron.MetricsNodeList, error)
	ListPodMetrics(ctx context.Context, namespace string, opts metav1.ListOptions) (*ultron.MetricsPodList, error)
}

type KubernetesService added in v0.1.2

type KubernetesService struct {
	K8sClient     ICoreClient
	MetricsClient IMetricsClient
	// contains filtered or unexported fields
}

func NewKubernetesService added in v0.1.4

func NewKubernetesService(kubernetesMasterUrl string, kubernetesConfigPath string, insecure bool) (*KubernetesService, error)

func (*KubernetesService) GetNodeMetrics added in v0.1.2

func (ks *KubernetesService) GetNodeMetrics(ctx context.Context, options metav1.ListOptions) (map[string]map[string]string, error)

func (*KubernetesService) GetNodes added in v0.1.2

func (ks *KubernetesService) GetNodes(ctx context.Context, options metav1.ListOptions) ([]corev1.Node, error)

func (*KubernetesService) GetPodMetrics added in v0.1.2

func (ks *KubernetesService) GetPodMetrics(ctx context.Context, options metav1.ListOptions) (map[string]map[string]string, error)

func (*KubernetesService) GetPods added in v0.3.1

func (ks *KubernetesService) GetPods(ctx context.Context, options metav1.ListOptions) ([]corev1.Pod, error)

Jump to

Keyboard shortcuts

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