Documentation
¶
Index ¶
- Constants
- Variables
- func AutoGenerateSpotConfig(spotConfig *SpotConfig, region string, instanceType string) error
- func CheckCortexSupport(instanceMetadata aws.InstanceMetadata) error
- func CheckSpotInstanceCompatibility(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
- func CompatibleSpotInstances(targetInstance aws.InstanceMetadata) []aws.InstanceMetadata
- func ErrorAtLeastOneInstanceDistribution(instanceType string, suggestions ...string) error
- func ErrorConfigCannotBeChangedOnUpdate(configKey string, prevVal interface{}) error
- func ErrorConfiguredWhenSpotIsNotEnabled(configKey string) error
- func ErrorGPUInstanceTypeNotSupported(instanceType string) error
- func ErrorIncompatibleSpotInstanceTypeCPU(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
- func ErrorIncompatibleSpotInstanceTypeGPU(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
- func ErrorIncompatibleSpotInstanceTypeMemory(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
- func ErrorInstanceTypeNotSupportedInRegion(instanceType string, region string) error
- func ErrorInstanceTypeTooSmall() error
- func ErrorInvalidAWSCredentials() error
- func ErrorInvalidInstanceType(instanceType string) error
- func ErrorMinInstancesGreaterThanMax(min int64, max int64) error
- func ErrorNoCompatibleSpotInstanceFound(instanceType string) error
- func ErrorOnDemandBaseCapacityGreaterThanMax(onDemandBaseCapacity int64, max int64) error
- func InstallPrompt(clusterConfig *ClusterConfig, awsAccessKeyID string, awsSecretAccessKey string) error
- func SetFileDefaults(cc *ClusterConfig) error
- func UpdatePromptValidation(skipPopulatedFields bool, userClusterConfig *ClusterConfig) *cr.PromptValidation
- type ClusterConfig
- type Error
- type ErrorKind
- type InternalClusterConfig
- type SpotConfig
Constants ¶
View Source
const ( InstanceTypeKey = "instance_type" MinInstancesKey = "min_instances" MaxInstancesKey = "max_instances" InstanceVolumeSizeKey = "instance_volume_size" SpotKey = "spot" SpotConfigKey = "spot_config" InstanceDistributionKey = "instance_distribution" OnDemandBaseCapacityKey = "on_demand_base_capacity" OnDemandPercentageAboveBaseCapacityKey = "on_demand_percentage_above_base_capacity" MaxPriceKey = "max_price" InstancePoolsKey = "instance_pools" ClusterNameKey = "cluster_name" RegionKey = "region" BucketKey = "bucket" LogGroupKey = "log_group" TelemetryKey = "telemetry" ImagePredictorServeKey = "image_predictor_serve" ImagePredictorServeGPUKey = "image_predictor_serve_gpu" ImageTFServeKey = "image_tf_serve" ImageTFServeGPUKey = "image_tf_serve_gpu" ImageTFAPIKey = "image_tf_api" ImageONNXServeKey = "image_onnx_serve" ImageONNXServeGPUKey = "image_onnx_serve_gpu" ImageOperatorKey = "image_operator" ImageManagerKey = "image_manager" ImageDownloaderKey = "image_downloader" ImageClusterAutoscalerKey = "image_cluster_autoscaler" ImageMetricsServerKey = "image_metrics_server" ImageNvidiaKey = "image_nvidia" ImageFluentdKey = "image_fluentd" ImageStatsdKey = "image_statsd" ImageIstioProxyKey = "image_istio_proxy" ImageIstioPilotKey = "image_istio_pilot" ImageIstioCitadelKey = "image_istio_citadel" ImageIstioGalleyKey = "image_istio_galley" // User facing string APIVersionUserFacingKey = "cluster version" ClusterNameUserFacingKey = "cluster name" RegionUserFacingKey = "aws region" BucketUserFacingKey = "s3 bucket" SpotUserFacingKey = "use spot instances" InstanceTypeUserFacingKey = "instance type" MinInstancesUserFacingKey = "min instances" MaxInstancesUserFacingKey = "max instances" InstanceVolumeSizeUserFacingKey = "instance volume size (Gi)" InstanceDistributionUserFacingKey = "spot instance distribution" OnDemandBaseCapacityUserFacingKey = "spot on demand base capacity" OnDemandPercentageAboveBaseCapacityUserFacingKey = "spot on demand percentage above base capacity" MaxPriceUserFacingKey = "spot max price ($ per hour)" InstancePoolsUserFacingKey = "spot instance pools" LogGroupUserFacingKey = "cloudwatch log group" TelemetryUserFacingKey = "telemetry" ImagePredictorServeUserFacingKey = "predictor serving image" ImagePredictorServeGPUUserFacingKey = "predictor serving gpu image" ImageTFServeUserFacingKey = "tensorflow serving image" ImageTFServeGPUUserFacingKey = "tensorflow serving gpu image" ImageTFAPIUserFacingKey = "tensorflow api image" ImageONNXServeUserFacingKey = "onnx serving image" ImageONNXServeGPUUserFacingKey = "onnx serving gpu image" ImageOperatorUserFacingKey = "operator image" ImageManagerUserFacingKey = "manager image" ImageDownloaderUserFacingKey = "downloader image" ImageClusterAutoscalerUserFacingKey = "cluster autoscaler image" ImageMetricsServerUserFacingKey = "metrics server image" ImageNvidiaUserFacingKey = "nvidia image" ImageFluentdUserFacingKey = "fluentd image" ImageStatsdUserFacingKey = "statsd image" ImageIstioProxyUserFacingKey = "istio proxy image" ImageIstioPilotUserFacingKey = "istio pilot image" ImageIstioCitadelUserFacingKey = "istio citadel image" ImageIstioGalleyUserFacingKey = "istio galley image" )
Variables ¶
View Source
var UserValidation = &cr.StructValidation{ StructFieldValidations: []*cr.StructFieldValidation{ { StructField: "InstanceType", StringPtrValidation: &cr.StringPtrValidation{ Validator: validateInstanceType, }, }, { StructField: "MinInstances", Int64PtrValidation: &cr.Int64PtrValidation{ GreaterThanOrEqualTo: pointer.Int64(0), }, }, { StructField: "MaxInstances", Int64PtrValidation: &cr.Int64PtrValidation{ GreaterThan: pointer.Int64(0), }, }, { StructField: "InstanceVolumeSize", Int64Validation: &cr.Int64Validation{ Default: 50, GreaterThanOrEqualTo: pointer.Int64(20), LessThanOrEqualTo: pointer.Int64(16384), }, }, { StructField: "Spot", BoolPtrValidation: &cr.BoolPtrValidation{ Default: pointer.Bool(false), }, }, { StructField: "SpotConfig", StructValidation: &cr.StructValidation{ DefaultNil: true, AllowExplicitNull: true, StructFieldValidations: []*cr.StructFieldValidation{ { StructField: "InstanceDistribution", StringListValidation: &cr.StringListValidation{ DisallowDups: true, Validator: validateInstanceDistribution, AllowExplicitNull: true, }, }, { StructField: "OnDemandBaseCapacity", Int64PtrValidation: &cr.Int64PtrValidation{ GreaterThanOrEqualTo: pointer.Int64(0), AllowExplicitNull: true, }, }, { StructField: "OnDemandPercentageAboveBaseCapacity", Int64PtrValidation: &cr.Int64PtrValidation{ GreaterThanOrEqualTo: pointer.Int64(0), LessThanOrEqualTo: pointer.Int64(100), AllowExplicitNull: true, }, }, { StructField: "MaxPrice", Float64PtrValidation: &cr.Float64PtrValidation{ GreaterThan: pointer.Float64(0), AllowExplicitNull: true, }, }, { StructField: "InstancePools", Int64PtrValidation: &cr.Int64PtrValidation{ GreaterThanOrEqualTo: pointer.Int64(1), LessThanOrEqualTo: pointer.Int64(20), AllowExplicitNull: true, }, }, }, }, }, { StructField: "ClusterName", StringValidation: &cr.StringValidation{ Default: "cortex", }, }, { StructField: "Region", StringPtrValidation: &cr.StringPtrValidation{ AllowedValues: aws.EKSSupportedRegions.Slice(), }, }, { StructField: "Bucket", StringPtrValidation: &cr.StringPtrValidation{}, }, { StructField: "LogGroup", StringValidation: &cr.StringValidation{ Default: "cortex", }, }, { StructField: "Telemetry", BoolValidation: &cr.BoolValidation{ Default: true, }, }, { StructField: "ImagePredictorServe", StringValidation: &cr.StringValidation{ Default: "cortexlabs/predictor-serve:" + consts.CortexVersion, }, }, { StructField: "ImagePredictorServeGPU", StringValidation: &cr.StringValidation{ Default: "cortexlabs/predictor-serve-gpu:" + consts.CortexVersion, }, }, { StructField: "ImageTFServe", StringValidation: &cr.StringValidation{ Default: "cortexlabs/tf-serve:" + consts.CortexVersion, }, }, { StructField: "ImageTFServeGPU", StringValidation: &cr.StringValidation{ Default: "cortexlabs/tf-serve-gpu:" + consts.CortexVersion, }, }, { StructField: "ImageTFAPI", StringValidation: &cr.StringValidation{ Default: "cortexlabs/tf-api:" + consts.CortexVersion, }, }, { StructField: "ImageONNXServe", StringValidation: &cr.StringValidation{ Default: "cortexlabs/onnx-serve:" + consts.CortexVersion, }, }, { StructField: "ImageONNXServeGPU", StringValidation: &cr.StringValidation{ Default: "cortexlabs/onnx-serve-gpu:" + consts.CortexVersion, }, }, { StructField: "ImageOperator", StringValidation: &cr.StringValidation{ Default: "cortexlabs/operator:" + consts.CortexVersion, }, }, { StructField: "ImageManager", StringValidation: &cr.StringValidation{ Default: "cortexlabs/manager:" + consts.CortexVersion, }, }, { StructField: "ImageDownloader", StringValidation: &cr.StringValidation{ Default: "cortexlabs/downloader:" + consts.CortexVersion, }, }, { StructField: "ImageClusterAutoscaler", StringValidation: &cr.StringValidation{ Default: "cortexlabs/cluster-autoscaler:" + consts.CortexVersion, }, }, { StructField: "ImageMetricsServer", StringValidation: &cr.StringValidation{ Default: "cortexlabs/metrics-server:" + consts.CortexVersion, }, }, { StructField: "ImageNvidia", StringValidation: &cr.StringValidation{ Default: "cortexlabs/nvidia:" + consts.CortexVersion, }, }, { StructField: "ImageFluentd", StringValidation: &cr.StringValidation{ Default: "cortexlabs/fluentd:" + consts.CortexVersion, }, }, { StructField: "ImageStatsd", StringValidation: &cr.StringValidation{ Default: "cortexlabs/statsd:" + consts.CortexVersion, }, }, { StructField: "ImageIstioProxy", StringValidation: &cr.StringValidation{ Default: "cortexlabs/istio-proxy:" + consts.CortexVersion, }, }, { StructField: "ImageIstioPilot", StringValidation: &cr.StringValidation{ Default: "cortexlabs/istio-pilot:" + consts.CortexVersion, }, }, { StructField: "ImageIstioCitadel", StringValidation: &cr.StringValidation{ Default: "cortexlabs/istio-citadel:" + consts.CortexVersion, }, }, { StructField: "ImageIstioGalley", StringValidation: &cr.StringValidation{ Default: "cortexlabs/istio-galley:" + consts.CortexVersion, }, }, { Key: "aws_access_key_id", Nil: true, }, { Key: "aws_secret_access_key", Nil: true, }, { Key: "cortex_aws_access_key_id", Nil: true, }, { Key: "cortex_aws_secret_access_key", Nil: true, }, }, }
Functions ¶
func AutoGenerateSpotConfig ¶ added in v0.11.0
func AutoGenerateSpotConfig(spotConfig *SpotConfig, region string, instanceType string) error
func CheckCortexSupport ¶ added in v0.11.0
func CheckCortexSupport(instanceMetadata aws.InstanceMetadata) error
func CheckSpotInstanceCompatibility ¶ added in v0.11.0
func CheckSpotInstanceCompatibility(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func CompatibleSpotInstances ¶ added in v0.11.0
func CompatibleSpotInstances(targetInstance aws.InstanceMetadata) []aws.InstanceMetadata
func ErrorAtLeastOneInstanceDistribution ¶ added in v0.11.0
func ErrorConfigCannotBeChangedOnUpdate ¶ added in v0.11.0
func ErrorConfiguredWhenSpotIsNotEnabled ¶ added in v0.11.0
func ErrorGPUInstanceTypeNotSupported ¶ added in v0.11.0
func ErrorIncompatibleSpotInstanceTypeCPU ¶ added in v0.11.0
func ErrorIncompatibleSpotInstanceTypeCPU(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func ErrorIncompatibleSpotInstanceTypeGPU ¶ added in v0.11.0
func ErrorIncompatibleSpotInstanceTypeGPU(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func ErrorIncompatibleSpotInstanceTypeMemory ¶ added in v0.11.0
func ErrorIncompatibleSpotInstanceTypeMemory(target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func ErrorInstanceTypeNotSupportedInRegion ¶ added in v0.11.0
func ErrorInstanceTypeTooSmall ¶
func ErrorInstanceTypeTooSmall() error
func ErrorInvalidAWSCredentials ¶
func ErrorInvalidAWSCredentials() error
func ErrorInvalidInstanceType ¶ added in v0.11.0
func ErrorMinInstancesGreaterThanMax ¶ added in v0.11.0
func ErrorNoCompatibleSpotInstanceFound ¶ added in v0.11.0
func ErrorOnDemandBaseCapacityGreaterThanMax ¶ added in v0.11.0
func InstallPrompt ¶ added in v0.11.0
func InstallPrompt(clusterConfig *ClusterConfig, awsAccessKeyID string, awsSecretAccessKey string) error
func SetFileDefaults ¶
func SetFileDefaults(cc *ClusterConfig) error
This does not set defaults for fields that are prompted from the user
func UpdatePromptValidation ¶ added in v0.11.0
func UpdatePromptValidation(skipPopulatedFields bool, userClusterConfig *ClusterConfig) *cr.PromptValidation
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { InstanceType *string `json:"instance_type" yaml:"instance_type"` MinInstances *int64 `json:"min_instances" yaml:"min_instances"` MaxInstances *int64 `json:"max_instances" yaml:"max_instances"` InstanceVolumeSize int64 `json:"instance_volume_size" yaml:"instance_volume_size"` Spot *bool `json:"spot" yaml:"spot"` SpotConfig *SpotConfig `json:"spot_config" yaml:"spot_config"` ClusterName string `json:"cluster_name" yaml:"cluster_name"` Region *string `json:"region" yaml:"region"` Bucket *string `json:"bucket" yaml:"bucket"` LogGroup string `json:"log_group" yaml:"log_group"` Telemetry bool `json:"telemetry" yaml:"telemetry"` ImagePredictorServe string `json:"image_predictor_serve" yaml:"image_predictor_serve"` ImagePredictorServeGPU string `json:"image_predictor_serve_gpu" yaml:"image_predictor_serve_gpu"` ImageTFServe string `json:"image_tf_serve" yaml:"image_tf_serve"` ImageTFServeGPU string `json:"image_tf_serve_gpu" yaml:"image_tf_serve_gpu"` ImageTFAPI string `json:"image_tf_api" yaml:"image_tf_api"` ImageONNXServe string `json:"image_onnx_serve" yaml:"image_onnx_serve"` ImageONNXServeGPU string `json:"image_onnx_serve_gpu" yaml:"image_onnx_serve_gpu"` ImageOperator string `json:"image_operator" yaml:"image_operator"` ImageManager string `json:"image_manager" yaml:"image_manager"` ImageDownloader string `json:"image_downloader" yaml:"image_downloader"` ImageClusterAutoscaler string `json:"image_cluster_autoscaler" yaml:"image_cluster_autoscaler"` ImageMetricsServer string `json:"image_metrics_server" yaml:"image_metrics_server"` ImageNvidia string `json:"image_nvidia" yaml:"image_nvidia"` ImageFluentd string `json:"image_fluentd" yaml:"image_fluentd"` ImageStatsd string `json:"image_statsd" yaml:"image_statsd"` ImageIstioProxy string `json:"image_istio_proxy" yaml:"image_istio_proxy"` ImageIstioPilot string `json:"image_istio_pilot" yaml:"image_istio_pilot"` ImageIstioCitadel string `json:"image_istio_citadel" yaml:"image_istio_citadel"` ImageIstioGalley string `json:"image_istio_galley" yaml:"image_istio_galley"` }
func GetFileDefaults ¶
func GetFileDefaults() (*ClusterConfig, error)
This does not set defaults for fields that are prompted from the user
func (*ClusterConfig) AutoFillSpot ¶ added in v0.11.0
func (cc *ClusterConfig) AutoFillSpot() error
func (*ClusterConfig) UserFacingString ¶ added in v0.11.0
func (cc *ClusterConfig) UserFacingString() string
func (*ClusterConfig) UserFacingTable ¶ added in v0.11.0
func (cc *ClusterConfig) UserFacingTable() []table.KV
func (*ClusterConfig) Validate ¶ added in v0.11.0
func (cc *ClusterConfig) Validate() error
type ErrorKind ¶
type ErrorKind int
const ( ErrUnknown ErrorKind = iota ErrInstanceTypeTooSmall ErrInvalidAWSCredentials ErrMinInstancesGreaterThanMax ErrInstanceTypeNotSupportedInRegion ErrIncompatibleSpotInstanceTypeMemory ErrIncompatibleSpotInstanceTypeCPU ErrIncompatibleSpotInstanceTypeGPU ErrGPUInstanceTypeNotSupported ErrAtLeastOneInstanceDistribution ErrNoCompatibleSpotInstanceFound ErrConfiguredWhenSpotIsNotEnabled ErrOnDemandBaseCapacityGreaterThanMax ErrConfigCannotBeChangedOnUpdate ErrInvalidInstanceType )
func (ErrorKind) MarshalBinary ¶
MarshalBinary satisfies BinaryMarshaler
func (ErrorKind) MarshalText ¶
MarshalText satisfies TextMarshaler
func (*ErrorKind) UnmarshalBinary ¶
UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack
func (*ErrorKind) UnmarshalText ¶
UnmarshalText satisfies TextUnmarshaler
type InternalClusterConfig ¶
type InternalClusterConfig struct { ClusterConfig // Populated by operator ID string `json:"id"` APIVersion string `json:"api_version"` OperatorInCluster bool `json:"operator_in_cluster"` InstanceMetadata aws.InstanceMetadata `json:"instance_metadata"` }
func (*InternalClusterConfig) UserFacingString ¶ added in v0.11.0
func (cc *InternalClusterConfig) UserFacingString() string
func (*InternalClusterConfig) UserFacingTable ¶ added in v0.11.0
func (cc *InternalClusterConfig) UserFacingTable() []table.KV
type SpotConfig ¶ added in v0.11.0
type SpotConfig struct { InstanceDistribution []string `json:"instance_distribution" yaml:"instance_distribution"` OnDemandBaseCapacity *int64 `json:"on_demand_base_capacity" yaml:"on_demand_base_capacity"` OnDemandPercentageAboveBaseCapacity *int64 `json:"on_demand_percentage_above_base_capacity" yaml:"on_demand_percentage_above_base_capacity"` MaxPrice *float64 `json:"max_price" yaml:"max_price"` InstancePools *int64 `json:"instance_pools" yaml:"instance_pools"` }
Click to show internal directories.
Click to hide internal directories.