common

package
v0.3.45 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const PodNamePrefix string = "armada-"

Variables

This section is empty.

Functions

func BindCommandlineArguments

func BindCommandlineArguments()

func ConfigureCommandLineLogging

func ConfigureCommandLineLogging()

TODO Move logging-related code out of common into a new package internal/logging

func ConfigureLogging

func ConfigureLogging()

func ContextWithDefaultTimeout

func ContextWithDefaultTimeout() (context.Context, context.CancelFunc)

func LoadConfig

func LoadConfig(config interface{}, defaultPath string, overrideConfigs []string) *viper.Viper

TODO Move code relating to config out of common into a new package internal/serverconfig

func QuantityAsFloat64

func QuantityAsFloat64(q resource.Quantity) float64

QuantityAsFloat64 returns a float64 representation of a quantity. We need our own function because q.AsApproximateFloat64 sometimes returns surprising results. For example, resource.MustParse("5188205838208Ki").AsApproximateFloat64 returns 0.004291583283300088, whereas this function returns 5.312722778324993e+15.

func ServeHttp added in v0.0.5

func ServeHttp(port uint16, mux http.Handler) (shutdown func())

ServeHttp starts an HTTP server listening on the given port.

func ServeMetrics

func ServeMetrics(port uint16) (shutdown func())

func ServeMetricsFor added in v0.1.29

func ServeMetricsFor(port uint16, gatherer prometheus.Gatherer) (shutdown func())

func UnmarshalKey added in v0.1.14

func UnmarshalKey(v *viper.Viper, key string, item interface{}) error

Types

type ComputeResources

type ComputeResources map[string]resource.Quantity

func CalculateTotalResource

func CalculateTotalResource(nodes []*v1.Node) ComputeResources

func CalculateTotalResourceRequest

func CalculateTotalResourceRequest(pods []*v1.Pod) ComputeResources

func FromResourceList

func FromResourceList(list v1.ResourceList) ComputeResources

func TotalJobResourceRequest added in v0.1.23

func TotalJobResourceRequest(job *api.Job) ComputeResources

func TotalPodResourceLimit added in v0.3.35

func TotalPodResourceLimit(podSpec *v1.PodSpec) ComputeResources

func TotalPodResourceRequest added in v0.1.23

func TotalPodResourceRequest(podSpec *v1.PodSpec) ComputeResources

TotalPodResourceRequest represents the resource request for a given pod is the maximum of:

  • sum of all containers
  • any individual init container

This is because:

  • containers run in parallel (so need to sum resources)
  • init containers run sequentially (so only their individual resource need be considered)

So pod resource usage is the max for each resource type (cpu/memory etc) that could be used at any given time

func (ComputeResources) Add

func (ComputeResources) AsFloat

func (ComputeResources) DeepCopy

func (a ComputeResources) DeepCopy() ComputeResources

func (ComputeResources) Dominates added in v0.1.6

func (a ComputeResources) Dominates(b ComputeResources) bool

func (ComputeResources) Equal added in v0.1.6

func (ComputeResources) IsValid added in v0.1.6

func (a ComputeResources) IsValid() bool

func (ComputeResources) Max

func (ComputeResources) Mul

func (ComputeResources) MulByResource added in v0.1.0

func (a ComputeResources) MulByResource(factors map[string]float64) ComputeResourcesFloat

func (ComputeResources) String added in v0.1.9

func (a ComputeResources) String() string

func (ComputeResources) Sub

type ComputeResourcesFloat

type ComputeResourcesFloat map[string]float64

ComputeResourcesFloat is float version of compute resource, prefer calculations with quantity where possible

func (ComputeResourcesFloat) Add

func (ComputeResourcesFloat) DeepCopy

func (ComputeResourcesFloat) IsLessThan

func (ComputeResourcesFloat) IsValid

func (a ComputeResourcesFloat) IsValid() bool

func (ComputeResourcesFloat) LimitToZero added in v0.1.6

func (a ComputeResourcesFloat) LimitToZero()

func (ComputeResourcesFloat) LimitWith added in v0.0.2

func (ComputeResourcesFloat) Max added in v0.1.6

func (ComputeResourcesFloat) MergeWith added in v0.1.6

MergeWith represents the merged in values take precedence and override existing values for the same key

func (ComputeResourcesFloat) Mul added in v0.0.2

func (ComputeResourcesFloat) Sub

type LoginCredentials

type LoginCredentials struct {
	Username string
	Password string
}

func (*LoginCredentials) GetRequestMetadata

func (c *LoginCredentials) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

func (*LoginCredentials) RequireTransportSecurity

func (c *LoginCredentials) RequireTransportSecurity() bool

Directories

Path Synopsis
Package armadaerrors contains generic errors that should be returned by code handling gRPC requests.
Package armadaerrors contains generic errors that should be returned by code handling gRPC requests.

Jump to

Keyboard shortcuts

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