Documentation ¶
Index ¶
- Constants
- Variables
- func BuildGCE(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, ...) cloudprovider.CloudProvider
- func BuildGenericLabels(ref GceRef, machineType string, nodeName string, os OperatingSystem, ...) (map[string]string, error)
- func EphemeralStorageOnLocalSSDFilesystemOverheadInBytes(diskCount int64, osDistribution OperatingSystemDistribution) int64
- func GenerateInstanceUrl(domainUrl string, ref GceRef) string
- func GenerateMigUrl(domainUrl string, ref GceRef) string
- func GetErrorInfo(errorCode, errorMessage, instanceStatus string, ...) *cloudprovider.InstanceErrorInfo
- func GetKubeletEvictionHardForEphemeralStorage(diskSize int64, evictionHard *EvictionHard) float64
- func GetKubeletEvictionHardForMemory(evictionHard *EvictionHard) int64
- func GetLabelsFromKubeEnv(kubeEnv KubeEnv) (map[string]string, error)
- func GetMachineFamily(machineType string) (string, error)
- func GetTaintsFromKubeEnv(kubeEnv KubeEnv) ([]apiv1.Taint, error)
- func IsCustomMachine(machineType string) bool
- func IsInstanceTemplateRegional(templateUrl string) (bool, error)
- func NewAutoscalingGceClientV1(client *http.Client, projectId string, userAgent string) (*autoscalingGceClientV1, error)
- func NewAutoscalingGceClientV1WithTimeout(client *http.Client, projectId string, userAgent string, ...) (*autoscalingGceClientV1, error)
- func NewCustomAutoscalingGceClientV1(client *http.Client, projectId, serverUrl, userAgent, domainUrl string, ...) (*autoscalingGceClientV1, error)
- func NewMigLister(cache *GceCache) *migLister
- func ParseIgmUrl(url string) (project string, zone string, name string, err error)
- func ParseInstanceUrl(url string) (project string, zone string, name string, err error)
- func ParseMigUrl(url string) (project string, zone string, name string, err error)
- func RegisterMetrics()
- type AutoscalingGceClient
- type EvictionHard
- type GceCache
- func (gc *GceCache) AddMachine(machineType MachineType, zone string)
- func (gc *GceCache) GetAutoscalingOptions(ref GceRef) map[string]string
- func (gc *GceCache) GetListManagedInstancesResults(migRef GceRef) (string, bool)
- func (gc *GceCache) GetMachine(machineTypeName string, zone string) (MachineType, bool)
- func (gc *GceCache) GetMig(migRef GceRef) (Mig, bool)
- func (gc *GceCache) GetMigBasename(migRef GceRef) (basename string, found bool)
- func (gc *GceCache) GetMigForInstance(instanceRef GceRef) (GceRef, bool)
- func (gc *GceCache) GetMigInstanceTemplate(ref GceRef) (*gce.InstanceTemplate, bool)
- func (gc *GceCache) GetMigInstanceTemplateName(ref GceRef) (InstanceTemplateName, bool)
- func (gc *GceCache) GetMigInstances(migRef GceRef) ([]GceInstance, bool)
- func (gc *GceCache) GetMigInstancesStateCount(migRef GceRef) (instanceState map[cloudprovider.InstanceState]int64, found bool)
- func (gc *GceCache) GetMigInstancesUpdateTime(migRef GceRef) (time.Time, bool)
- func (gc *GceCache) GetMigKubeEnv(ref GceRef) (KubeEnv, bool)
- func (gc *GceCache) GetMigTargetSize(ref GceRef) (int64, bool)
- func (gc *GceCache) GetMigs() []Mig
- func (gc *GceCache) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (gc *GceCache) InvalidateAllInstancesToMig()
- func (gc *GceCache) InvalidateAllListManagedInstancesResults()
- func (gc *GceCache) InvalidateAllMachines()
- func (gc *GceCache) InvalidateAllMigBasenames()
- func (gc *GceCache) InvalidateAllMigInstanceTemplateNames()
- func (gc *GceCache) InvalidateAllMigInstanceTemplates()
- func (gc *GceCache) InvalidateAllMigInstances()
- func (gc *GceCache) InvalidateAllMigKubeEnvs()
- func (gc *GceCache) InvalidateAllMigTargetSizes()
- func (gc *GceCache) InvalidateInstancesToMig(migRef GceRef)
- func (gc *GceCache) InvalidateMigBasename(migRef GceRef)
- func (gc *GceCache) InvalidateMigInstanceTemplate(ref GceRef)
- func (gc *GceCache) InvalidateMigInstanceTemplateName(ref GceRef)
- func (gc *GceCache) InvalidateMigInstances(migRef GceRef)
- func (gc *GceCache) InvalidateMigInstancesStateCount()
- func (gc *GceCache) InvalidateMigKubeEnv(ref GceRef)
- func (gc *GceCache) InvalidateMigTargetSize(ref GceRef)
- func (gc *GceCache) IsMigUnknownForInstance(instanceRef GceRef) bool
- func (gc *GceCache) MarkInstanceMigUnknown(instanceRef GceRef)
- func (gc *GceCache) RegisterMig(newMig Mig) bool
- func (gc *GceCache) SetAutoscalingOptions(ref GceRef, options map[string]string)
- func (gc *GceCache) SetListManagedInstancesResults(migRef GceRef, listManagedInstancesResults string)
- func (gc *GceCache) SetMachines(machinesCache map[MachineTypeKey]MachineType)
- func (gc *GceCache) SetMigBasename(migRef GceRef, basename string)
- func (gc *GceCache) SetMigInstanceTemplate(ref GceRef, instanceTemplate *gce.InstanceTemplate)
- func (gc *GceCache) SetMigInstanceTemplateName(ref GceRef, instanceTemplateName InstanceTemplateName)
- func (gc *GceCache) SetMigInstances(migRef GceRef, instances []GceInstance, timeNow time.Time) error
- func (gc *GceCache) SetMigInstancesStateCount(migRef GceRef, instanceState map[cloudprovider.InstanceState]int64)
- func (gc *GceCache) SetMigKubeEnv(ref GceRef, kubeEnv KubeEnv)
- func (gc *GceCache) SetMigTargetSize(ref GceRef, size int64)
- func (gc *GceCache) SetResourceLimiter(resourceLimiter *cloudprovider.ResourceLimiter)
- func (gc *GceCache) UnregisterMig(toBeRemoved Mig) bool
- type GceCloudProvider
- func (gce *GceCloudProvider) Cleanup() error
- func (gce *GceCloudProvider) GPULabel() string
- func (gce *GceCloudProvider) GetAvailableGPUTypes() map[string]struct{}
- func (gce *GceCloudProvider) GetAvailableMachineTypes() ([]string, error)
- func (gce *GceCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
- func (gce *GceCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
- func (gce *GceCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
- func (gce *GceCloudProvider) Name() string
- func (gce *GceCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, ...) (cloudprovider.NodeGroup, error)
- func (gce *GceCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
- func (gce *GceCloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (gce *GceCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
- func (gce *GceCloudProvider) Refresh() error
- type GceInstance
- type GceManager
- type GceMigOsInfo
- type GcePriceInfo
- func (g *GcePriceInfo) BaseCpuPricePerHour() float64
- func (g *GcePriceInfo) BaseGpuPricePerHour() float64
- func (g *GcePriceInfo) BaseMemoryPricePerHourPerGb() float64
- func (g *GcePriceInfo) BasePreemptibleDiscount() float64
- func (g *GcePriceInfo) BootDiskPricePerHour() map[string]float64
- func (g *GcePriceInfo) CustomCpuPricePerHour() map[string]float64
- func (g *GcePriceInfo) CustomMemoryPricePerHourPerGb() map[string]float64
- func (g *GcePriceInfo) CustomPreemptibleDiscount() map[string]float64
- func (g *GcePriceInfo) GpuPrices() map[string]float64
- func (g *GcePriceInfo) InstancePrices() map[string]float64
- func (g *GcePriceInfo) LocalSsdPricePerHour() float64
- func (g *GcePriceInfo) PredefinedCpuPricePerHour() map[string]float64
- func (g *GcePriceInfo) PredefinedMemoryPricePerHourPerGb() map[string]float64
- func (g *GcePriceInfo) PredefinedPreemptibleDiscount() map[string]float64
- func (g *GcePriceInfo) PreemptibleGpuPrices() map[string]float64
- func (g *GcePriceInfo) PreemptibleInstancePrices() map[string]float64
- func (g *GcePriceInfo) SpotLocalSsdPricePerHour() float64
- type GcePriceModel
- type GceRef
- type GceReserved
- type GceTemplateBuilder
- func (t *GceTemplateBuilder) BuildAllocatableFromKubeEnv(capacity apiv1.ResourceList, kubeEnv KubeEnv, evictionHard *EvictionHard) (apiv1.ResourceList, error)
- func (t *GceTemplateBuilder) BuildCapacity(m MigOsInfo, cpu int64, mem int64, accelerators []*gce.AcceleratorConfig, ...) (apiv1.ResourceList, error)
- func (t *GceTemplateBuilder) BuildNodeFromTemplate(mig Mig, migOsInfo MigOsInfo, template *gce.InstanceTemplate, kubeEnv KubeEnv, ...) (*apiv1.Node, error)
- func (t *GceTemplateBuilder) CalculateAllocatable(capacity apiv1.ResourceList, kubeReserved apiv1.ResourceList, ...) apiv1.ResourceList
- func (t *GceTemplateBuilder) MigOsInfo(migId string, kubeEnv KubeEnv) (MigOsInfo, error)
- type InstanceTemplateName
- type KubeEnv
- type MachineType
- type MachineTypeKey
- type Mig
- type MigInfoProvider
- type MigLister
- type MigOsInfo
- type OperatingSystem
- type OperatingSystemDistribution
- type OperatingSystemImage
- type OsReservedCalculator
- type PriceInfo
- type SystemArchitecture
Constants ¶
const ( // ErrorCodeQuotaExceeded is an error code used in InstanceErrorInfo if quota exceeded error occurs. ErrorCodeQuotaExceeded = "QUOTA_EXCEEDED" // ErrorCodeResourcePoolExhausted is an error code used in InstanceErrorInfo if requested resources // cannot be provisioned by cloud provider. ErrorCodeResourcePoolExhausted = "RESOURCE_POOL_EXHAUSTED" // ErrorIPSpaceExhausted is an error code used in InstanceErrorInfo if the IP space has been // exhausted. ErrorIPSpaceExhausted = "IP_SPACE_EXHAUSTED" // ErrorCodePermissions is an error code used in InstanceErrorInfo if the user is facing // permissions error ErrorCodePermissions = "PERMISSIONS_ERROR" // ErrorCodeVmExternalIpAccessPolicyConstraint is an error code in InstanceErrorInfo if the user // is facing errors caused by vmExternalIpAccess policy constraint misconfiguration. ErrorCodeVmExternalIpAccessPolicyConstraint = "VM_EXTERNAL_IP_ACCESS_POLICY_CONSTRAINT" // ErrorInvalidReservation is an error code for InstanceErrorInfo if the node group couldn't // be scaled up because the reservation associated with the MIG was invalid. ErrorInvalidReservation = "INVALID_RESERVATION" // ErrorReservationNotFound is an error code for InstanceErrorInfo if the node group couldn't // be scaled up because no reservation was found, or the reservation was in different location, // or the reservation was incorrectly shared. ErrorReservationNotFound = "RESERVATION_NOT_FOUND" // ErrorReservationNotReady is an error code for InstanceErrorInfo if the node group couldn't // be scaled up because the associated reservation was not ready. ErrorReservationNotReady = "RESERVATION_NOT_READY" // ErrorReservationCapacityExceeded is an error code for InstanceErrorInfo if the node group couldn't // be scaled up because the associated reservation's capacity has been exceeded. ErrorReservationCapacityExceeded = "RESERVATION_CAPACITY_EXCEEDED" // ErrorReservationIncompatible is an error code for InstanceErrorInfo if the node group couldn't // be scaled up because the associated reservation is not compatible with the node group. ErrorReservationIncompatible = "RESERVATION_INCOMPATIBLE" // ErrorUnsupportedTpuConfiguration is an error code for InstanceErrorInfo if the // node group couldn't be scaled up because of invalid TPU configuration. ErrorUnsupportedTpuConfiguration = "UNSUPPORTED_TPU_CONFIGURATION" // ErrorCodeOther is an error code used in InstanceErrorInfo if other error occurs. ErrorCodeOther = "OTHER" // MaxInstancesLogged is the maximum number of instances for which we will // log detailed information for each Instance.List API call MaxInstancesLogged = 20 )
const ( // KiB - KibiByte size (2^10) KiB = 1024 // MiB - MebiByte size (2^20) MiB = 1024 * 1024 // GiB - GibiByte size (2^30) GiB = 1024 * 1024 * 1024 // MemoryEvictionHardTag tag passed by kubelet used to determine evictionHard values MemoryEvictionHardTag = "memory.available" // EphemeralStorageEvictionHardTag tag passed by kubelet used to determine evictionHard values EphemeralStorageEvictionHardTag = "nodefs.available" )
const ( // LocalSsdCountAnnotation is the annotation for number of attached local SSDs to the node. LocalSsdCountAnnotation = "cluster-autoscaler/gce/local-ssd-count" // BootDiskTypeAnnotation is the annotation for boot disk type of the node. BootDiskTypeAnnotation = "cluster-autoscaler/gce/boot-disk-type" // BootDiskSizeAnnotation is the annotation for boot disk sise of the node/ BootDiskSizeAnnotation = "cluster-autoscaler/gce/boot-disk-size" // EphemeralStorageLocalSsdAnnotation is the annotation for nodes where ephemeral storage is backed up by local SSDs. EphemeralStorageLocalSsdAnnotation = "cluster-autoscaler/gce/ephemeral-storage-local-ssd" )
These annotations are used internally only to store information in node temlate and use it later in CA, the actuall nodes won't have these annotations.
const DefaultBootDiskSizeGB = 100
DefaultBootDiskSizeGB is 100 GB.
const (
// GPULabel is the label added to nodes with GPU resource.
GPULabel = "cloud.google.com/gke-accelerator"
)
Variables ¶
var ( // DefaultBootDiskType is pd-balanced disk type. // ref: https://cloud.google.com/kubernetes-engine/docs/how-to/custom-boot-disks#specify DefaultBootDiskType = "pd-balanced" )
Functions ¶
func BuildGCE ¶
func BuildGCE(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider
BuildGCE builds GCE cloud provider, manager etc.
func BuildGenericLabels ¶
func BuildGenericLabels(ref GceRef, machineType string, nodeName string, os OperatingSystem, arch SystemArchitecture) (map[string]string, error)
BuildGenericLabels builds basic labels that should be present on every GCE node, including hostname, zone etc.
func EphemeralStorageOnLocalSSDFilesystemOverheadInBytes ¶
func EphemeralStorageOnLocalSSDFilesystemOverheadInBytes(diskCount int64, osDistribution OperatingSystemDistribution) int64
EphemeralStorageOnLocalSSDFilesystemOverheadInBytes estimates the difference between the total physical capacity of the local SSDs and the ephemeral storage filesystem capacity. It uses experimental values measured for all possible disk counts in GKE. Custom Kubernetes on GCE may allow intermediate counts, attaching the measured count, but not using it all for ephemeral storage. In that case, the difference in overhead between GKE and custom node images may be higher than the difference in overhead between two disk counts, so interpolating wouldn't make much sense. Instead, we use the next count for which we measured a filesystem overhead, which is a safer approximation (better to reserve more and not scale up than not enough and not schedule).
func GenerateInstanceUrl ¶
GenerateInstanceUrl generates url for instance.
func GenerateMigUrl ¶
GenerateMigUrl generates url for instance.
func GetErrorInfo ¶
func GetErrorInfo(errorCode, errorMessage, instanceStatus string, previousErrorInfo *cloudprovider.InstanceErrorInfo) *cloudprovider.InstanceErrorInfo
GetErrorInfo maps the error code, error message and instance status to CA instance error info
func GetKubeletEvictionHardForEphemeralStorage ¶
func GetKubeletEvictionHardForEphemeralStorage(diskSize int64, evictionHard *EvictionHard) float64
GetKubeletEvictionHardForEphemeralStorage calculates the evictionHard value for Ephemeral Storage.
func GetKubeletEvictionHardForMemory ¶
func GetKubeletEvictionHardForMemory(evictionHard *EvictionHard) int64
GetKubeletEvictionHardForMemory calculates the evictionHard value for Memory.
func GetLabelsFromKubeEnv ¶
GetLabelsFromKubeEnv returns labels from kube-env
func GetMachineFamily ¶
GetMachineFamily gets the machine family from the machine type. Machine family is determined as everything before the first dash character, unless this first part is "custom", which actually means "n1": https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#gcloud.
func GetTaintsFromKubeEnv ¶
GetTaintsFromKubeEnv returns labels from kube-env
func IsCustomMachine ¶
IsCustomMachine checks if a machine type is custom or predefined.
func IsInstanceTemplateRegional ¶
IsInstanceTemplateRegional determines whether or not an instance template is regional based on the url
func NewAutoscalingGceClientV1 ¶
func NewAutoscalingGceClientV1(client *http.Client, projectId string, userAgent string) (*autoscalingGceClientV1, error)
NewAutoscalingGceClientV1 creates a new client for communicating with GCE v1 API.
func NewAutoscalingGceClientV1WithTimeout ¶
func NewAutoscalingGceClientV1WithTimeout(client *http.Client, projectId string, userAgent string, waitTimeout time.Duration, pollInterval time.Duration) (*autoscalingGceClientV1, error)
NewAutoscalingGceClientV1WithTimeout creates a new client with custom timeouts for communicating with GCE v1 API
func NewCustomAutoscalingGceClientV1 ¶
func NewCustomAutoscalingGceClientV1(client *http.Client, projectId, serverUrl, userAgent, domainUrl string, waitTimeout time.Duration, pollInterval time.Duration) (*autoscalingGceClientV1, error)
NewCustomAutoscalingGceClientV1 creates a new client using custom server url and timeouts for communicating with GCE v1 API.
func NewMigLister ¶
func NewMigLister(cache *GceCache) *migLister
NewMigLister returns an instance of migLister
func ParseIgmUrl ¶
ParseIgmUrl expects url in format: https://.*/<project-id>/zones/<zone>/instanceGroupManagers/<name>
func ParseInstanceUrl ¶
ParseInstanceUrl expects url in format: https://.*/<project-id>/zones/<zone>/instances/<name>
func ParseMigUrl ¶
ParseMigUrl expects url in format: https://.*/projects/<project-id>/zones/<zone>/instanceGroups/<name>
Types ¶
type AutoscalingGceClient ¶
type AutoscalingGceClient interface { // reading resources FetchMachineType(zone, machineType string) (*gce.MachineType, error) FetchMachineTypes(zone string) ([]*gce.MachineType, error) FetchAllMigs(zone string) ([]*gce.InstanceGroupManager, error) FetchAllInstances(project, zone string, filter string) ([]GceInstance, error) FetchMigTargetSize(GceRef) (int64, error) FetchMigBasename(GceRef) (string, error) FetchMigInstances(GceRef) ([]GceInstance, error) FetchMigTemplateName(migRef GceRef) (InstanceTemplateName, error) FetchMigTemplate(migRef GceRef, templateName string, regional bool) (*gce.InstanceTemplate, error) FetchMigsWithName(zone string, filter *regexp.Regexp) ([]string, error) FetchZones(region string) ([]string, error) FetchAvailableCpuPlatforms() (map[string][]string, error) FetchAvailableDiskTypes() (map[string][]string, error) FetchReservations() ([]*gce.Reservation, error) FetchReservationsInProject(projectId string) ([]*gce.Reservation, error) FetchListManagedInstancesResults(migRef GceRef) (string, error) // modifying resources ResizeMig(GceRef, int64) error DeleteInstances(migRef GceRef, instances []GceRef) error CreateInstances(GceRef, string, int64, []string) error // WaitForOperation can be used to poll GCE operations until completion/timeout using WAIT calls. // Calling this is normally not needed when interacting with the client, other methods should call it internally. // Can be used to extend the interface with more methods outside of this package. WaitForOperation(operationName, operationType, project, zone string) error }
AutoscalingGceClient is used for communicating with GCE API.
type EvictionHard ¶
EvictionHard is the struct used to keep parsed values for eviction
func ParseEvictionHardOrGetDefault ¶
func ParseEvictionHardOrGetDefault(evictionHard map[string]string) *EvictionHard
ParseEvictionHardOrGetDefault tries to parse evictionHard map, else fills defaults to be used.
type GceCache ¶
type GceCache struct {
// contains filtered or unexported fields
}
GceCache is used for caching cluster resources state.
It is needed to: - keep track of MIGs in the cluster, - keep track of instances in the cluster, - keep track of MIGs to instances mapping, - keep track of MIGs configuration such as target size and basename, - keep track of resource limiters and machine types, - limit repetitive GCE API calls.
Cache keeps these values and gives access to getters, setters and invalidators all guarded with mutex. Cache does not refresh the data by itself - it just provides an interface enabling access to this data.
The caches maintained here differ in terms of expected lifetime. Mig instance, basename, target size and instance template name caches need to be refreshed each loop to guarantee their freshness. Other values like Migs and instance templates are cached for longer periods of time and are refreshed either periodically or in response to detecting cluster state changes.
func (*GceCache) AddMachine ¶
func (gc *GceCache) AddMachine(machineType MachineType, zone string)
AddMachine adds machine to cache under lock.
func (*GceCache) GetAutoscalingOptions ¶
GetAutoscalingOptions return autoscaling options strings obtained from IT.
func (*GceCache) GetListManagedInstancesResults ¶
GetListManagedInstancesResults gets listManagedInstancesResults for a given mig from cache.
func (*GceCache) GetMachine ¶
func (gc *GceCache) GetMachine(machineTypeName string, zone string) (MachineType, bool)
GetMachine retrieves machine type from cache under lock.
func (*GceCache) GetMigBasename ¶
GetMigBasename get basename for given mig from cache.
func (*GceCache) GetMigForInstance ¶
GetMigForInstance returns the cached MIG for instance GceRef
func (*GceCache) GetMigInstanceTemplate ¶
func (gc *GceCache) GetMigInstanceTemplate(ref GceRef) (*gce.InstanceTemplate, bool)
GetMigInstanceTemplate returns the cached gce.InstanceTemplate for a mig GceRef
func (*GceCache) GetMigInstanceTemplateName ¶
func (gc *GceCache) GetMigInstanceTemplateName(ref GceRef) (InstanceTemplateName, bool)
GetMigInstanceTemplateName returns the cached instance template ref for a mig GceRef
func (*GceCache) GetMigInstances ¶
func (gc *GceCache) GetMigInstances(migRef GceRef) ([]GceInstance, bool)
GetMigInstances returns the cached instances for a given MIG GceRef
func (*GceCache) GetMigInstancesStateCount ¶
func (gc *GceCache) GetMigInstancesStateCount(migRef GceRef) (instanceState map[cloudprovider.InstanceState]int64, found bool)
GetMigInstancesStateCount returns counts of instances in different states for the given mig from cache.
func (*GceCache) GetMigInstancesUpdateTime ¶
GetMigInstancesUpdateTime returns the timestamp when the cached instances were updated for a given MIG GceRef
func (*GceCache) GetMigKubeEnv ¶
GetMigKubeEnv returns the cached KubeEnv for a mig GceRef
func (*GceCache) GetMigTargetSize ¶
GetMigTargetSize returns the cached targetSize for a GceRef
func (*GceCache) GetResourceLimiter ¶
func (gc *GceCache) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns resource limiter.
func (*GceCache) InvalidateAllInstancesToMig ¶
func (gc *GceCache) InvalidateAllInstancesToMig()
InvalidateAllInstancesToMig clears the instance to mig cache
func (*GceCache) InvalidateAllListManagedInstancesResults ¶
func (gc *GceCache) InvalidateAllListManagedInstancesResults()
InvalidateAllListManagedInstancesResults invalidates all listManagedInstancesResults entries.
func (*GceCache) InvalidateAllMachines ¶
func (gc *GceCache) InvalidateAllMachines()
InvalidateAllMachines invalidates the machines cache under lock.
func (*GceCache) InvalidateAllMigBasenames ¶
func (gc *GceCache) InvalidateAllMigBasenames()
InvalidateAllMigBasenames invalidates all basename entries.
func (*GceCache) InvalidateAllMigInstanceTemplateNames ¶
func (gc *GceCache) InvalidateAllMigInstanceTemplateNames()
InvalidateAllMigInstanceTemplateNames clears the instance template ref cache
func (*GceCache) InvalidateAllMigInstanceTemplates ¶
func (gc *GceCache) InvalidateAllMigInstanceTemplates()
InvalidateAllMigInstanceTemplates clears the instance template cache
func (*GceCache) InvalidateAllMigInstances ¶
func (gc *GceCache) InvalidateAllMigInstances()
InvalidateAllMigInstances clears the mig instances cache
func (*GceCache) InvalidateAllMigKubeEnvs ¶
func (gc *GceCache) InvalidateAllMigKubeEnvs()
InvalidateAllMigKubeEnvs clears the kube-env cache
func (*GceCache) InvalidateAllMigTargetSizes ¶
func (gc *GceCache) InvalidateAllMigTargetSizes()
InvalidateAllMigTargetSizes clears the target size cache
func (*GceCache) InvalidateInstancesToMig ¶
InvalidateInstancesToMig clears the instance to mig mapping for a GceRef
func (*GceCache) InvalidateMigBasename ¶
InvalidateMigBasename invalidates basename entry for given mig.
func (*GceCache) InvalidateMigInstanceTemplate ¶
InvalidateMigInstanceTemplate clears the instance template cache for a mig GceRef
func (*GceCache) InvalidateMigInstanceTemplateName ¶
InvalidateMigInstanceTemplateName clears the instance template ref cache for a mig GceRef
func (*GceCache) InvalidateMigInstances ¶
InvalidateMigInstances clears the mig instances cache for a given Mig
func (*GceCache) InvalidateMigInstancesStateCount ¶
func (gc *GceCache) InvalidateMigInstancesStateCount()
InvalidateMigInstancesStateCount invalidates all migInstancesStateCountCache entries.
func (*GceCache) InvalidateMigKubeEnv ¶
InvalidateMigKubeEnv clears the kube-env cache for a mig GceRef
func (*GceCache) InvalidateMigTargetSize ¶
InvalidateMigTargetSize clears the target size cache
func (*GceCache) IsMigUnknownForInstance ¶
IsMigUnknownForInstance checks if MIG was marked as unknown for instance, meaning that a Mig to which this instance should belong does not list it as one of its instances.
func (*GceCache) MarkInstanceMigUnknown ¶
MarkInstanceMigUnknown sets instance MIG to unknown, meaning that a Mig to which this instance should belong does not list it as one of its instances.
func (*GceCache) RegisterMig ¶
RegisterMig returns true if the node group wasn't in cache before, or its config was updated.
func (*GceCache) SetAutoscalingOptions ¶
SetAutoscalingOptions stores autoscaling options strings obtained from IT.
func (*GceCache) SetListManagedInstancesResults ¶
func (gc *GceCache) SetListManagedInstancesResults(migRef GceRef, listManagedInstancesResults string)
SetListManagedInstancesResults sets listManagedInstancesResults for a given mig in cache
func (*GceCache) SetMachines ¶
func (gc *GceCache) SetMachines(machinesCache map[MachineTypeKey]MachineType)
SetMachines sets the machines cache under lock.
func (*GceCache) SetMigBasename ¶
SetMigBasename sets basename for given mig in cache
func (*GceCache) SetMigInstanceTemplate ¶
func (gc *GceCache) SetMigInstanceTemplate(ref GceRef, instanceTemplate *gce.InstanceTemplate)
SetMigInstanceTemplate sets gce.InstanceTemplate for a mig GceRef
func (*GceCache) SetMigInstanceTemplateName ¶
func (gc *GceCache) SetMigInstanceTemplateName(ref GceRef, instanceTemplateName InstanceTemplateName)
SetMigInstanceTemplateName sets instance template ref for a mig GceRef
func (*GceCache) SetMigInstances ¶
func (gc *GceCache) SetMigInstances(migRef GceRef, instances []GceInstance, timeNow time.Time) error
SetMigInstances sets instances for a given Mig ref
func (*GceCache) SetMigInstancesStateCount ¶
func (gc *GceCache) SetMigInstancesStateCount(migRef GceRef, instanceState map[cloudprovider.InstanceState]int64)
SetMigInstancesStateCount sets the counts of instances in different states for a given mig in cache.
func (*GceCache) SetMigKubeEnv ¶
SetMigKubeEnv sets KubeEnv for a mig GceRef
func (*GceCache) SetMigTargetSize ¶
SetMigTargetSize sets targetSize for a GceRef
func (*GceCache) SetResourceLimiter ¶
func (gc *GceCache) SetResourceLimiter(resourceLimiter *cloudprovider.ResourceLimiter)
SetResourceLimiter sets resource limiter.
func (*GceCache) UnregisterMig ¶
UnregisterMig returns true if the node group has been removed, and false if it was already missing from cache.
type GceCloudProvider ¶
type GceCloudProvider struct {
// contains filtered or unexported fields
}
GceCloudProvider implements CloudProvider interface.
func BuildGceCloudProvider ¶
func BuildGceCloudProvider(gceManager GceManager, resourceLimiter *cloudprovider.ResourceLimiter, pricingModel cloudprovider.PricingModel) (*GceCloudProvider, error)
BuildGceCloudProvider builds CloudProvider implementation for GCE.
func (*GceCloudProvider) Cleanup ¶
func (gce *GceCloudProvider) Cleanup() error
Cleanup cleans up all resources before the cloud provider is removed
func (*GceCloudProvider) GPULabel ¶
func (gce *GceCloudProvider) GPULabel() string
GPULabel returns the label added to nodes with GPU resource.
func (*GceCloudProvider) GetAvailableGPUTypes ¶
func (gce *GceCloudProvider) GetAvailableGPUTypes() map[string]struct{}
GetAvailableGPUTypes return all available GPU types cloud provider supports
func (*GceCloudProvider) GetAvailableMachineTypes ¶
func (gce *GceCloudProvider) GetAvailableMachineTypes() ([]string, error)
GetAvailableMachineTypes get all machine types that can be requested from the cloud provider.
func (*GceCloudProvider) GetNodeGpuConfig ¶
func (gce *GceCloudProvider) GetNodeGpuConfig(node *apiv1.Node) *cloudprovider.GpuConfig
GetNodeGpuConfig returns the label, type and resource name for the GPU added to node. If node doesn't have any GPUs, it returns nil.
func (*GceCloudProvider) GetResourceLimiter ¶
func (gce *GceCloudProvider) GetResourceLimiter() (*cloudprovider.ResourceLimiter, error)
GetResourceLimiter returns struct containing limits (max, min) for resources (cores, memory etc.).
func (*GceCloudProvider) HasInstance ¶
func (gce *GceCloudProvider) HasInstance(node *apiv1.Node) (bool, error)
HasInstance returns whether a given node has a corresponding instance in this cloud provider
func (*GceCloudProvider) Name ¶
func (gce *GceCloudProvider) Name() string
Name returns name of the cloud provider.
func (*GceCloudProvider) NewNodeGroup ¶
func (gce *GceCloudProvider) NewNodeGroup(machineType string, labels map[string]string, systemLabels map[string]string, taints []apiv1.Taint, extraResources map[string]resource.Quantity) (cloudprovider.NodeGroup, error)
NewNodeGroup builds a theoretical node group based on the node definition provided. The node group is not automatically created on the cloud provider side. The node group is not returned by NodeGroups() until it is created.
func (*GceCloudProvider) NodeGroupForNode ¶
func (gce *GceCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.NodeGroup, error)
NodeGroupForNode returns the node group for the given node.
func (*GceCloudProvider) NodeGroups ¶
func (gce *GceCloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups returns all node groups configured for this cloud provider.
func (*GceCloudProvider) Pricing ¶
func (gce *GceCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError)
Pricing returns pricing model for this cloud provider or error if not available.
func (*GceCloudProvider) Refresh ¶
func (gce *GceCloudProvider) Refresh() error
Refresh is called before every main loop and can be used to dynamically update cloud provider state. In particular the list of node groups returned by NodeGroups can change as a result of CloudProvider.Refresh().
type GceInstance ¶
type GceInstance struct { cloudprovider.Instance NumericId uint64 Igm GceRef InstanceTemplateName string }
GceInstance extends cloudprovider.Instance with GCE specific numeric id.
type GceManager ¶
type GceManager interface { // Refresh triggers refresh of cached resources. Refresh() error // Cleanup cleans up open resources before the cloud provider is destroyed, i.e. go routines etc. Cleanup() error // GetMigs returns list of registered MIGs. GetMigs() []Mig // GetMigNodes returns mig nodes. GetMigNodes(mig Mig) ([]GceInstance, error) // GetMigForInstance returns MIG to which the given instance belongs. GetMigForInstance(instance GceRef) (Mig, error) // GetMigTemplateNode returns a template node for MIG. GetMigTemplateNode(mig Mig) (*apiv1.Node, error) // GetResourceLimiter returns resource limiter. GetResourceLimiter() (*cloudprovider.ResourceLimiter, error) // GetMigSize gets MIG size. GetMigSize(mig Mig) (int64, error) // GetMigOptions returns MIG's NodeGroupAutoscalingOptions GetMigOptions(mig Mig, defaults config.NodeGroupAutoscalingOptions) *config.NodeGroupAutoscalingOptions // SetMigSize sets MIG size. SetMigSize(mig Mig, size int64) error // DeleteInstances deletes the given instances. All instances must be controlled by the same MIG. DeleteInstances(instances []GceRef) error // CreateInstances creates delta new instances in a given mig. CreateInstances(mig Mig, delta int64) error }
GceManager handles GCE communication and data caching.
func CreateGceManager ¶
func CreateGceManager(configReader io.Reader, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions, localSSDDiskSizeProvider localssdsize.LocalSSDSizeProvider, regional, bulkGceMigInstancesListingEnabled bool, concurrentGceRefreshes int, userAgent, domainUrl string, migInstancesMinRefreshWaitTime time.Duration) (GceManager, error)
CreateGceManager constructs GceManager object.
type GceMigOsInfo ¶
type GceMigOsInfo struct {
// contains filtered or unexported fields
}
GceMigOsInfo contains os details of nodes in gce mig.
func (*GceMigOsInfo) Arch ¶
func (m *GceMigOsInfo) Arch() SystemArchitecture
Arch return system architecture.
func (*GceMigOsInfo) OsDistribution ¶
func (m *GceMigOsInfo) OsDistribution() OperatingSystemDistribution
OsDistribution return operating system distribution.
type GcePriceInfo ¶
type GcePriceInfo struct {
// contains filtered or unexported fields
}
GcePriceInfo is the GCE specific implementation of the PricingInfo.
func NewGcePriceInfo ¶
func NewGcePriceInfo() *GcePriceInfo
NewGcePriceInfo returns a new instance of the GcePriceInfo.
func (*GcePriceInfo) BaseCpuPricePerHour ¶
func (g *GcePriceInfo) BaseCpuPricePerHour() float64
BaseCpuPricePerHour gets the base cpu price per hour
func (*GcePriceInfo) BaseGpuPricePerHour ¶
func (g *GcePriceInfo) BaseGpuPricePerHour() float64
BaseGpuPricePerHour gets the base gpu price per hour
func (*GcePriceInfo) BaseMemoryPricePerHourPerGb ¶
func (g *GcePriceInfo) BaseMemoryPricePerHourPerGb() float64
BaseMemoryPricePerHourPerGb gets the base memory price per hour per Gb
func (*GcePriceInfo) BasePreemptibleDiscount ¶
func (g *GcePriceInfo) BasePreemptibleDiscount() float64
BasePreemptibleDiscount gets the base preemptible discount applicable
func (*GcePriceInfo) BootDiskPricePerHour ¶
func (g *GcePriceInfo) BootDiskPricePerHour() map[string]float64
BootDiskPricePerHour gets the price of boot disk.
func (*GcePriceInfo) CustomCpuPricePerHour ¶
func (g *GcePriceInfo) CustomCpuPricePerHour() map[string]float64
CustomCpuPricePerHour gets the cpu price per hour for custom machine of a machine family
func (*GcePriceInfo) CustomMemoryPricePerHourPerGb ¶
func (g *GcePriceInfo) CustomMemoryPricePerHourPerGb() map[string]float64
CustomMemoryPricePerHourPerGb gets the memory price per hour per Gb for custom machine of a machine family
func (*GcePriceInfo) CustomPreemptibleDiscount ¶
func (g *GcePriceInfo) CustomPreemptibleDiscount() map[string]float64
CustomPreemptibleDiscount gets the preemptible discount of a machine family
func (*GcePriceInfo) GpuPrices ¶
func (g *GcePriceInfo) GpuPrices() map[string]float64
GpuPrices gets the price of GPUs
func (*GcePriceInfo) InstancePrices ¶
func (g *GcePriceInfo) InstancePrices() map[string]float64
InstancePrices gets the prices for standard machine types
func (*GcePriceInfo) LocalSsdPricePerHour ¶
func (g *GcePriceInfo) LocalSsdPricePerHour() float64
LocalSsdPricePerHour gets the price of boot disk.
func (*GcePriceInfo) PredefinedCpuPricePerHour ¶
func (g *GcePriceInfo) PredefinedCpuPricePerHour() map[string]float64
PredefinedCpuPricePerHour gets the predefined cpu price per hour for machine family
func (*GcePriceInfo) PredefinedMemoryPricePerHourPerGb ¶
func (g *GcePriceInfo) PredefinedMemoryPricePerHourPerGb() map[string]float64
PredefinedMemoryPricePerHourPerGb gets the predefined memory price per hour per Gb for machine family
func (*GcePriceInfo) PredefinedPreemptibleDiscount ¶
func (g *GcePriceInfo) PredefinedPreemptibleDiscount() map[string]float64
PredefinedPreemptibleDiscount gets the predefined preemptible discount for machine family
func (*GcePriceInfo) PreemptibleGpuPrices ¶
func (g *GcePriceInfo) PreemptibleGpuPrices() map[string]float64
PreemptibleGpuPrices gets the price of preemptible GPUs
func (*GcePriceInfo) PreemptibleInstancePrices ¶
func (g *GcePriceInfo) PreemptibleInstancePrices() map[string]float64
PreemptibleInstancePrices gets the preemptible prices for standard machine types
func (*GcePriceInfo) SpotLocalSsdPricePerHour ¶
func (g *GcePriceInfo) SpotLocalSsdPricePerHour() float64
SpotLocalSsdPricePerHour gets the price of boot disk.
type GcePriceModel ¶
type GcePriceModel struct { PriceInfo PriceInfo // contains filtered or unexported fields }
GcePriceModel implements PriceModel interface for GCE.
func NewGcePriceModel ¶
func NewGcePriceModel(info PriceInfo, localSSDSizeProvider localssdsize.LocalSSDSizeProvider) *GcePriceModel
NewGcePriceModel gets a new instance of GcePriceModel
type GceRef ¶
GceRef contains s reference to some entity in GCE world.
func GceRefFromProviderId ¶
GceRefFromProviderId creates InstanceConfig object from provider id which must be in format: gce://<project-id>/<zone>/<name> TODO(piosz): add better check whether the id is correct
func ParseIgmUrlRef ¶
ParseIgmUrlRef expects url in format: projects/<project-id>/zones/<zone>/instanceGroupManagers/<name> and returns a GceRef struct for it.
func ParseInstanceUrlRef ¶
ParseInstanceUrlRef expects url in format: https://.*/projects/<project-id>/zones/<zone>/instances/<name> and returns a GceRef struct for it.
func (GceRef) ToProviderId ¶
ToProviderId converts GceRef to string in format used as ProviderId in Node object.
type GceReserved ¶
type GceReserved struct{}
GceReserved implement Reserved interface
func (*GceReserved) CalculateKernelReserved ¶
func (r *GceReserved) CalculateKernelReserved(m MigOsInfo, physicalMemory int64) int64
CalculateKernelReserved computes how much memory Linux kernel will reserve. TODO(jkaniuk): account for crashkernel reservation on RHEL / CentOS
func (*GceReserved) CalculateOSReservedEphemeralStorage ¶
func (r *GceReserved) CalculateOSReservedEphemeralStorage(m MigOsInfo, diskSize int64) int64
CalculateOSReservedEphemeralStorage estimates how much ephemeral storage OS will reserve and eviction threshold
type GceTemplateBuilder ¶
type GceTemplateBuilder struct{}
GceTemplateBuilder builds templates for GCE nodes.
func (*GceTemplateBuilder) BuildAllocatableFromKubeEnv ¶
func (t *GceTemplateBuilder) BuildAllocatableFromKubeEnv(capacity apiv1.ResourceList, kubeEnv KubeEnv, evictionHard *EvictionHard) (apiv1.ResourceList, error)
BuildAllocatableFromKubeEnv builds node allocatable based on capacity of the node and value of kubeEnv.
func (*GceTemplateBuilder) BuildCapacity ¶
func (t *GceTemplateBuilder) BuildCapacity(m MigOsInfo, cpu int64, mem int64, accelerators []*gce.AcceleratorConfig, ephemeralStorage int64, ephemeralStorageLocalSSDCount int64, pods *int64, r OsReservedCalculator, extendedResources apiv1.ResourceList) (apiv1.ResourceList, error)
BuildCapacity builds a list of resource capacities given list of hardware.
func (*GceTemplateBuilder) BuildNodeFromTemplate ¶
func (t *GceTemplateBuilder) BuildNodeFromTemplate(mig Mig, migOsInfo MigOsInfo, template *gce.InstanceTemplate, kubeEnv KubeEnv, cpu int64, mem int64, pods *int64, reserved OsReservedCalculator, localSSDSizeProvider localssdsize.LocalSSDSizeProvider) (*apiv1.Node, error)
BuildNodeFromTemplate builds node from provided GCE template.
func (*GceTemplateBuilder) CalculateAllocatable ¶
func (t *GceTemplateBuilder) CalculateAllocatable(capacity apiv1.ResourceList, kubeReserved apiv1.ResourceList, evictionHard *EvictionHard) apiv1.ResourceList
CalculateAllocatable computes allocatable resources subtracting kube reserved values and kubelet eviction memory buffer from corresponding capacity.
type InstanceTemplateName ¶
InstanceTemplateName is used to store the name, and whether or not the instance template is regional
func InstanceTemplateNameFromUrl ¶
func InstanceTemplateNameFromUrl(instanceTemplateLink string) (InstanceTemplateName, error)
InstanceTemplateNameFromUrl retrieves name of the Instance Template from the url.
type KubeEnv ¶
type KubeEnv struct {
// contains filtered or unexported fields
}
KubeEnv stores kube-env information from InstanceTemplate
func ExtractKubeEnv ¶
func ExtractKubeEnv(template *gce.InstanceTemplate) (KubeEnv, error)
ExtractKubeEnv extracts kube-env from InstanceTemplate
func ParseKubeEnv ¶
ParseKubeEnv parses kube-env from its string representation
type MachineType ¶
type MachineType struct { // Name is the name of the particular MachineType (ex. e2-standard-4) Name string // CPU is the number of cores the machine has. CPU int64 // Memory is the memory capacity of the machine in bytes. Memory int64 // MaxDisk is the maximum total persistent disks size (GB) allowed. MaxDiskSizeGb int64 }
MachineType represents information about underlying GCE machine used by one or more MIGs.
func NewCustomMachineType ¶
func NewCustomMachineType(name string) (MachineType, error)
NewCustomMachineType creates a MachineType object describing a custom GCE machine. CPU and Memory are based on parsing custom machine name.
func NewMachineTypeFromAPI ¶
func NewMachineTypeFromAPI(name string, mt *gce_api.MachineType) (MachineType, error)
NewMachineTypeFromAPI creates a MachineType object based on machine type representation from GCE API client.
type MachineTypeKey ¶
MachineTypeKey is used to identify MachineType.
type Mig ¶
type Mig interface { cloudprovider.NodeGroup GceRef() GceRef }
Mig implements NodeGroup interface.
type MigInfoProvider ¶
type MigInfoProvider interface { // GetMigInstances returns instances for a given MIG ref GetMigInstances(migRef GceRef) ([]GceInstance, error) // GetMigForInstance returns MIG ref for a given instance GetMigForInstance(instanceRef GceRef) (Mig, error) // RegenerateMigInstancesCache regenerates MIGs to instances mapping cache RegenerateMigInstancesCache() error // GetMigTargetSize returns target size for given MIG ref GetMigTargetSize(migRef GceRef) (int64, error) // GetMigBasename returns basename for given MIG ref GetMigBasename(migRef GceRef) (string, error) // GetMigInstanceTemplateName returns instance template name for given MIG ref GetMigInstanceTemplateName(migRef GceRef) (InstanceTemplateName, error) // GetMigInstanceTemplate returns instance template for given MIG ref GetMigInstanceTemplate(migRef GceRef) (*gce.InstanceTemplate, error) // GetMigKubeEnv returns kube-env for given MIG ref GetMigKubeEnv(migRef GceRef) (KubeEnv, error) // GetMigMachineType returns machine type used by a MIG. // For custom machines cpu and memory information is based on parsing // machine name. For standard types it's retrieved from GCE API. GetMigMachineType(migRef GceRef) (MachineType, error) // Returns the pagination behavior of the listManagedInstances API method for a given MIG ref GetListManagedInstancesResults(migRef GceRef) (string, error) }
MigInfoProvider allows obtaining information about MIGs
func NewCachingMigInfoProvider ¶
func NewCachingMigInfoProvider(cache *GceCache, migLister MigLister, gceClient AutoscalingGceClient, projectId string, concurrentGceRefreshes int, migInstancesMinRefreshWaitTime time.Duration, bulkGceMigInstancesListingEnabled bool) MigInfoProvider
NewCachingMigInfoProvider creates an instance of caching MigInfoProvider
type MigLister ¶
type MigLister interface { // GetMigs returns the list of migs GetMigs() []Mig // HandleMigIssue handles an issue with a given mig HandleMigIssue(migRef GceRef, err error) }
MigLister is a mig listing interface
type MigOsInfo ¶
type MigOsInfo interface { // Os return operating system. Os() OperatingSystem // OsDistribution return operating system distribution. OsDistribution() OperatingSystemDistribution // Arch return system architecture. Arch() SystemArchitecture }
MigOsInfo store os parameters.
func NewMigOsInfo ¶
func NewMigOsInfo(os OperatingSystem, osDistribution OperatingSystemDistribution, arch SystemArchitecture) MigOsInfo
NewMigOsInfo return gce implementation of MigOsInfo interface.
type OperatingSystem ¶
type OperatingSystem string
OperatingSystem denotes operating system used by nodes coming from node group
const ( // OperatingSystemUnknown is used if operating system is unknown OperatingSystemUnknown OperatingSystem = "" // OperatingSystemLinux is used if operating system is Linux OperatingSystemLinux OperatingSystem = "linux" // OperatingSystemWindows is used if operating system is Windows OperatingSystemWindows OperatingSystem = "windows" // OperatingSystemDefault defines which operating system will be assumed if not explicitly passed via AUTOSCALER_ENV_VARS OperatingSystemDefault = OperatingSystemLinux )
type OperatingSystemDistribution ¶
type OperatingSystemDistribution string
OperatingSystemDistribution denotes distribution of the operating system used by nodes coming from node group
const ( // OperatingSystemDistributionUnknown is used if operating distribution system is unknown OperatingSystemDistributionUnknown OperatingSystemDistribution = "" // OperatingSystemDistributionUbuntu is used if operating distribution system is Ubuntu OperatingSystemDistributionUbuntu OperatingSystemDistribution = "ubuntu" // OperatingSystemDistributionWindowsLTSC is used if operating distribution system is Windows LTSC OperatingSystemDistributionWindowsLTSC OperatingSystemDistribution = "windows_ltsc" // OperatingSystemDistributionWindowsSAC is used if operating distribution system is Windows SAC OperatingSystemDistributionWindowsSAC OperatingSystemDistribution = "windows_sac" // OperatingSystemDistributionCOS is used if operating distribution system is COS OperatingSystemDistributionCOS OperatingSystemDistribution = "cos" // OperatingSystemDistributionDefault defines which operating system will be assumed if not explicitly passed via AUTOSCALER_ENV_VARS OperatingSystemDistributionDefault = OperatingSystemDistributionCOS )
type OperatingSystemImage ¶
type OperatingSystemImage string
OperatingSystemImage denotes image of the operating system used by nodes coming from node group
const ( // OperatingSystemImageUnknown is used if operating distribution system is unknown OperatingSystemImageUnknown OperatingSystemImage = "" // OperatingSystemImageUbuntu is used if operating distribution system is Ubuntu OperatingSystemImageUbuntu OperatingSystemImage = "ubuntu" // OperatingSystemImageWindowsLTSC is used if operating distribution system is Windows LTSC OperatingSystemImageWindowsLTSC OperatingSystemImage = "windows_ltsc" // OperatingSystemImageWindowsSAC is used if operating distribution system is Windows SAC OperatingSystemImageWindowsSAC OperatingSystemImage = "windows_sac" // OperatingSystemImageCOS is used if operating distribution system is COS OperatingSystemImageCOS OperatingSystemImage = "cos" // OperatingSystemImageCOSContainerd is used if operating distribution system is COS Containerd OperatingSystemImageCOSContainerd OperatingSystemImage = "cos_containerd" // OperatingSystemImageUbuntuContainerd is used if operating distribution system is Ubuntu Containerd OperatingSystemImageUbuntuContainerd OperatingSystemImage = "ubuntu_containerd" // OperatingSystemImageWindowsLTSCContainerd is used if operating distribution system is Windows LTSC Containerd OperatingSystemImageWindowsLTSCContainerd OperatingSystemImage = "windows_ltsc_containerd" // OperatingSystemImageWindowsSACContainerd is used if operating distribution system is Windows SAC Containerd OperatingSystemImageWindowsSACContainerd OperatingSystemImage = "windows_sac_containerd" // OperatingSystemImageDefault defines which operating system will be assumed as default. OperatingSystemImageDefault = OperatingSystemImageCOSContainerd )
type OsReservedCalculator ¶
type OsReservedCalculator interface { // CalculateKernelReserved computes how much memory OS kernel will reserve. // NodeVersion parameter is optional. If empty string is passed a result calculated using default node version will be returned. CalculateKernelReserved(m MigOsInfo, physicalMemory int64) int64 // CalculateOSReservedEphemeralStorage estimates how much ephemeral storage OS will reserve and eviction threshold. // NodeVersion parameter is optional. If empty string is passed a result calculated using default node version will be returned. CalculateOSReservedEphemeralStorage(m MigOsInfo, diskSize int64) int64 }
OsReservedCalculator calculates the OS reserved values.
type PriceInfo ¶
type PriceInfo interface { // BaseCpuPricePerHour gets the base cpu price per hour. BaseCpuPricePerHour() float64 // BaseMemoryPricePerHourPerGb gets the base memory price per hour per Gb. BaseMemoryPricePerHourPerGb() float64 // BasePreemptibleDiscount gets the base preemptible discount applicable. BasePreemptibleDiscount() float64 // BaseGpuPricePerHour gets the base gpu price per hour. BaseGpuPricePerHour() float64 // PredefinedCpuPricePerHour gets the predefined cpu price per hour for machine family. PredefinedCpuPricePerHour() map[string]float64 // PredefinedMemoryPricePerHourPerGb gets the predefined memory price per hour per Gb for machine family. PredefinedMemoryPricePerHourPerGb() map[string]float64 // PredefinedPreemptibleDiscount gets the predefined preemptible discount for machine family. PredefinedPreemptibleDiscount() map[string]float64 // CustomCpuPricePerHour gets the cpu price per hour for custom machine of a machine family. CustomCpuPricePerHour() map[string]float64 // CustomMemoryPricePerHourPerGb gets the memory price per hour per Gb for custom machine of a machine family. CustomMemoryPricePerHourPerGb() map[string]float64 CustomPreemptibleDiscount() map[string]float64 InstancePrices() map[string]float64 PreemptibleInstancePrices() map[string]float64 GpuPrices() map[string]float64 // PreemptibleGpuPrices gets the price of preemptible GPUs. PreemptibleGpuPrices() map[string]float64 // BootDiskPricePerHour returns the map of the prices per Gb of boot disk per hour. BootDiskPricePerHour() map[string]float64 // LocalSsdPricePerHour returns the price per Gb of local SSD per hour. LocalSsdPricePerHour() float64 // LocalSsdPricePerHour returns the price per Gb of local SSD per hour for Spot VMs. SpotLocalSsdPricePerHour() float64 }
PriceInfo is the interface to fetch the pricing information needed for gce pricing.
type SystemArchitecture ¶
type SystemArchitecture string
SystemArchitecture denotes distribution of the System Architecture used by nodes coming from node group
const ( // UnknownArch is used if the Architecture is Unknown UnknownArch SystemArchitecture = "" // Amd64 is used if the Architecture is x86_64 Amd64 SystemArchitecture = "amd64" // Arm64 is used if the Architecture is ARM Arm64 SystemArchitecture = "arm64" // DefaultArch is used if the Architecture is used as a fallback if not passed by AUTOSCALER_ENV_VARS DefaultArch SystemArchitecture = Amd64 )
func ToSystemArchitecture ¶
func ToSystemArchitecture(arch string) SystemArchitecture
ToSystemArchitecture parses a string to SystemArchitecture. Returns UnknownArch if the string doesn't represent a valid architecture.
func (SystemArchitecture) Name ¶
func (s SystemArchitecture) Name() string
Name returns the string value for SystemArchitecture