v1

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Overview

Copyright 2020 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

+kubebuilder:object:generate=true +groupName=config.com.netflix.titus

Copyright 2020 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SchemeBuilder initializes a scheme builder
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme is a global function that registers this API group & version to a scheme
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: resourcepool.GroupName, Version: "v1"}

SchemeGroupVersion is group version used to register these objects

View Source
var (
	Zero = ComputeResource{}
)

Functions

func Kind added in v0.0.10

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource added in v0.0.10

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type ComputeResource

type ComputeResource struct {
	CPU int64 `json:"cpu"`

	GPU int64 `json:"gpu"`

	MemoryMB int64 `json:"memoryMB"`

	DiskMB int64 `json:"diskMB"`

	NetworkMBPS int64 `json:"networkMBPS"`
}

Data structure representing compute resources. We use uint64 type as aggregated resources may amount to very large values.

func (ComputeResource) Add

func (ComputeResource) AlignResourceRatios added in v0.0.3

func (r ComputeResource) AlignResourceRatios(reference ComputeResource) ComputeResource

Align resource ratios to be the same as in the reference. The resulting ComputeResource is the smallest value that is >= the original, with the resource ratios identical to the reference.

func (ComputeResource) CanSplitBy

func (r ComputeResource) CanSplitBy(second ComputeResource) bool

Check if can computes how many times the argument fully fits into the give resource.

func (*ComputeResource) DeepCopy

func (in *ComputeResource) DeepCopy() *ComputeResource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeResource.

func (*ComputeResource) DeepCopyInto

func (in *ComputeResource) DeepCopyInto(out *ComputeResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ComputeResource) Divide added in v0.0.3

func (r ComputeResource) Divide(divider int64) ComputeResource

func (ComputeResource) FractionalMultiply added in v0.0.15

func (r ComputeResource) FractionalMultiply(multiplier float64) ComputeResource

func (ComputeResource) GreaterThan

func (r ComputeResource) GreaterThan(second ComputeResource) bool

For a compute resource to be greater than the other one, all individual resources (CPU, memory, etc) must not be smaller than their counterparts, and at least one of them must be bigger.

func (ComputeResource) GreaterThanOrEqual added in v0.0.13

func (r ComputeResource) GreaterThanOrEqual(second ComputeResource) bool

For a compute resource to be greater than or equal the other one, all individual resources (CPU, memory, etc) must not be smaller than their counterparts.

func (ComputeResource) IsAnyAboveZero added in v0.0.9

func (r ComputeResource) IsAnyAboveZero() bool

func (ComputeResource) IsAnyBelowZero added in v0.0.9

func (r ComputeResource) IsAnyBelowZero() bool

func (ComputeResource) LessThan

func (r ComputeResource) LessThan(second ComputeResource) bool

For a compute resource to be less than the other one, all individual resources (CPU, memory, etc) must not be greater than their counterparts, and at least one of them must be smaller.

func (ComputeResource) LessThanOrEqual added in v0.0.13

func (r ComputeResource) LessThanOrEqual(second ComputeResource) bool

For a compute resource to be less than or equal the other one, all individual resources (CPU, memory, etc) must not be greater than their counterparts.

func (ComputeResource) MaxRatio added in v0.0.6

func (r ComputeResource) MaxRatio(divider ComputeResource) float64

Compute a ratio for each resource pair (left.cpu / divider.cpu, etc), and return the maximum value. Return -1, if there is any pair such that left > 0 and divider == 0.

func (ComputeResource) MaxRatioIgnoreZeros added in v0.0.7

func (r ComputeResource) MaxRatioIgnoreZeros(divider ComputeResource) float64

Similar to ComputeResource.MaxRatio, but ignoring dimensions for which divider value is 0. For example, if r={cpu:4, memory=100} and divider={cpu:2, memory:0}, the result is 2. ComputeResource.MaxRatio would return for this case -1.

func (ComputeResource) Multiply

func (r ComputeResource) Multiply(multiplier int64) ComputeResource

func (ComputeResource) SetAbove added in v0.0.12

func (r ComputeResource) SetAbove(lowerBound int64) ComputeResource

func (ComputeResource) SplitBy

func (r ComputeResource) SplitBy(second ComputeResource) int64

Computes how many times the argument fully fits into the give resource.

func (ComputeResource) SplitByWithCeil

func (r ComputeResource) SplitByWithCeil(second ComputeResource) int64

Similar to SplitBy, but with rounding up.

func (ComputeResource) StrictlyGreaterThan

func (r ComputeResource) StrictlyGreaterThan(second ComputeResource) bool

For a compute resource to be strictly greater than the other one, all individual resources (CPU, memory, etc) must be greater.

func (ComputeResource) StrictlyLessThan

func (r ComputeResource) StrictlyLessThan(second ComputeResource) bool

For a compute resource to be strictly less than the other one, all individual resources (CPU, memory, etc) must be smaller.

func (ComputeResource) String added in v0.0.12

func (r ComputeResource) String() string

func (ComputeResource) Sub

func (ComputeResource) SubWithLimit

func (r ComputeResource) SubWithLimit(second ComputeResource, lowerBound int64) ComputeResource

Subtraction with resource minimum value set to the provided lower bound.

type ResourceDemandStatus

type ResourceDemandStatus struct {
	// Resource provisioning status (Pending, Rejected, Fulfilled)
	Status string `json:"status"`

	// Human readable message.
	StatusMessage string `json:"statusMessage"`

	// Time at which the report was made.
	ReportedAt int64 `json:"reportedAt"`
}

func (*ResourceDemandStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDemandStatus.

func (*ResourceDemandStatus) DeepCopyInto

func (in *ResourceDemandStatus) DeepCopyInto(out *ResourceDemandStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourcePoolConfig

type ResourcePoolConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ResourcePoolSpec   `json:"spec,omitempty"`
	Status            ResourcePoolStatus `json:"status,omitempty"`
}

+kubebuilder:object:root=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ResourcePoolConfig) DeepCopy

func (in *ResourcePoolConfig) DeepCopy() *ResourcePoolConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolConfig.

func (*ResourcePoolConfig) DeepCopyInto

func (in *ResourcePoolConfig) DeepCopyInto(out *ResourcePoolConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourcePoolConfig) DeepCopyObject

func (in *ResourcePoolConfig) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourcePoolConfigList

type ResourcePoolConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ResourcePoolConfig `json:"items"`
}

+kubebuilder:object:root=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ResourcePoolConfigList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolConfigList.

func (*ResourcePoolConfigList) DeepCopyInto

func (in *ResourcePoolConfigList) DeepCopyInto(out *ResourcePoolConfigList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourcePoolConfigList) DeepCopyObject

func (in *ResourcePoolConfigList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourcePoolScalingRules added in v0.0.5

type ResourcePoolScalingRules struct {
	// Minimum idle capacity measured in number of shapes.
	MinIdle int64 `json:"minIdle"`

	// Maximum idle capacity measured in number of shapes.
	MaxIdle int64 `json:"maxIdle"`

	// Resource pool minimum size limit (minimum number of shapes that can be ever allocated).
	MinSize int64 `json:"minSize"`

	// Resource pool maximum size limit (maximum number of shapes that can be ever allocated).
	MaxSize int64 `json:"maxSize"`

	// Set to true to enable auto scaling of this resource pool.
	AutoScalingEnabled bool `json:"autoScalingEnabled"`

	// Minimum scale up step. The valid value range is between 1 and MaxIdle. If MaxIdle is zero, MinimumScaleUpStep should be 1.
	MinimumScaleUpStep int64 `json:"minimumScaleUpStep"`
}

func (*ResourcePoolScalingRules) DeepCopy added in v0.0.5

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolScalingRules.

func (*ResourcePoolScalingRules) DeepCopyInto added in v0.0.5

func (in *ResourcePoolScalingRules) DeepCopyInto(out *ResourcePoolScalingRules)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourcePoolSpec

type ResourcePoolSpec struct {
	// Resource pool name (for example 'critical', 'elastic', 'gpu.p4', etc).
	Name string `json:"name"`

	// Preferential machine shape (minimum size and resource ratio). A total amount of requested resource is
	// defined as resource_shape * resource_count.
	ResourceShape ResourceShape `json:"resourceShape"`

	// Resource pool scaling rules.
	ScalingRules ResourcePoolScalingRules `json:"scalingRules"`

	// Number of resource shapes requested. A total amount of requested resource is
	// defined as resource_shape * resource_count.
	ResourceCount int64 `json:"resourceCount"`

	// Time at which the last resource request was made.
	RequestedAt int64 `json:"requestedAt"`

	// [DEPRECATED] Resource demand fulfillment report.
	Status ResourceDemandStatus `json:"resourceDemandStatus"`

	// Primary instance type for the resource pool.
	PrimaryInstanceType string `json:"primaryInstanceType"`
}

func (*ResourcePoolSpec) DeepCopy

func (in *ResourcePoolSpec) DeepCopy() *ResourcePoolSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolSpec.

func (*ResourcePoolSpec) DeepCopyInto

func (in *ResourcePoolSpec) DeepCopyInto(out *ResourcePoolSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourcePoolStatus added in v0.0.16

type ResourcePoolStatus struct {
	// Resource provisioning status (Pending, Rejected, Fulfilled)
	Status string `json:"status"`

	// Human readable message.
	StatusMessage string `json:"statusMessage"`

	// Time at which the report was made.
	ReportedAt int64 `json:"reportedAt"`
}

func (*ResourcePoolStatus) DeepCopy added in v0.0.16

func (in *ResourcePoolStatus) DeepCopy() *ResourcePoolStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolStatus.

func (*ResourcePoolStatus) DeepCopyInto added in v0.0.16

func (in *ResourcePoolStatus) DeepCopyInto(out *ResourcePoolStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceShape

type ResourceShape struct {
	ComputeResource `json:",inline"`

	Labels map[string]string `json:"labels,omitempty"`
}

func (*ResourceShape) DeepCopy

func (in *ResourceShape) DeepCopy() *ResourceShape

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceShape.

func (*ResourceShape) DeepCopyInto

func (in *ResourceShape) DeepCopyInto(out *ResourceShape)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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