Documentation
¶
Index ¶
- Constants
- Variables
- func AutoGenerateSpotConfig(accessKeyID string, secretAccessKey string, spotConfig *SpotConfig, ...) error
- func CheckCortexSupport(instanceMetadata aws.InstanceMetadata) error
- func CheckSpotInstanceCompatibility(accessKeyID string, secretAccessKey string, target aws.InstanceMetadata, ...) error
- func CompatibleSpotInstances(accessKeyID string, secretAccessKey string, ...) []aws.InstanceMetadata
- func ErrorAtLeastOneInstanceDistribution(instanceType string, suggestions ...string) error
- func ErrorConfigCannotBeChangedOnUpdate(configKey string, prevVal interface{}) error
- func ErrorConfiguredWhenSpotIsNotEnabled(configKey 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 ErrorInstanceTypeNotSupported(instanceType string) error
- func ErrorInstanceTypeNotSupportedInRegion(instanceType string, region string) error
- func ErrorInstanceTypeTooSmall() error
- func ErrorInvalidAWSCredentials() error
- func ErrorInvalidAvailabilityZone(invalidZone string, validAvailabilityZones []string) 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 ErrorSpotPriceGreaterThanTargetOnDemand(suggestedSpotPrice float64, target aws.InstanceMetadata, ...) error
- func InstallPrompt(clusterConfig *Config, awsAccessKeyID string, awsSecretAccessKey string) error
- func SetDefaults(cc *Config) error
- func UpdatePromptValidation(skipPopulatedFields bool, userClusterConfig *Config) *cr.PromptValidation
- type AccessConfig
- type Config
- func (cc *Config) AutoFillSpot(accessKeyID string, secretAccessKey string) error
- func (cc *Config) ToAccessConfig() AccessConfig
- func (cc *Config) UserFacingString() string
- func (cc *Config) UserFacingTable() table.KeyValuePairs
- func (cc *Config) Validate(accessKeyID string, secretAccessKey string) error
- type Error
- type ErrorKind
- type InternalConfig
- 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" AvailabilityZonesKey = "availability_zones" BucketKey = "bucket" LogGroupKey = "log_group" TelemetryKey = "telemetry" ImagePythonServeKey = "image_python_serve" ImagePythonServeGPUKey = "image_python_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" AvailabilityZonesUserFacingKey = "availability zones" 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" ImagePythonServeUserFacingKey = "python serving image" ImagePythonServeGPUUserFacingKey = "python 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 AccessPromptValidation = &cr.PromptValidation{ SkipPopulatedFields: true, PromptItemValidations: []*cr.PromptItemValidation{ { StructField: "ClusterName", PromptOpts: &prompt.Options{ Prompt: ClusterNameUserFacingKey, }, StringPtrValidation: &cr.StringPtrValidation{ Default: pointer.String("cortex"), }, }, { StructField: "Region", PromptOpts: &prompt.Options{ Prompt: RegionUserFacingKey, }, StringPtrValidation: &cr.StringPtrValidation{ AllowedValues: aws.EKSSupportedRegionsSlice, Default: pointer.String("us-west-2"), }, }, }, }
View Source
var AccessValidation = &cr.StructValidation{ AllowExtraFields: true, StructFieldValidations: []*cr.StructFieldValidation{ { StructField: "ClusterName", StringPtrValidation: &cr.StringPtrValidation{}, }, { StructField: "Region", StringPtrValidation: &cr.StringPtrValidation{ AllowedValues: aws.EKSSupportedRegionsSlice, }, }, { StructField: "ImageManager", StringValidation: &cr.StringValidation{ Default: "cortexlabs/manager:" + consts.CortexVersion, }, }, }, }
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(int64(_maxInstancePools)), AllowExplicitNull: true, }, }, }, }, }, { StructField: "ClusterName", StringValidation: &cr.StringValidation{ Default: "cortex", }, }, { StructField: "Region", StringPtrValidation: &cr.StringPtrValidation{ AllowedValues: aws.EKSSupportedRegionsSlice, }, }, { StructField: "AvailabilityZones", StringListValidation: &cr.StringListValidation{ AllowEmpty: true, }, }, { StructField: "Bucket", StringPtrValidation: &cr.StringPtrValidation{}, }, { StructField: "LogGroup", StringValidation: &cr.StringValidation{}, DefaultField: "ClusterName", }, { StructField: "ImagePythonServe", StringValidation: &cr.StringValidation{ Default: "cortexlabs/python-serve:" + consts.CortexVersion, }, }, { StructField: "ImagePythonServeGPU", StringValidation: &cr.StringValidation{ Default: "cortexlabs/python-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, }, }, }
View Source
var Validation = &cr.StructValidation{ StructFieldValidations: append(UserValidation.StructFieldValidations, &cr.StructFieldValidation{ StructField: "Telemetry", BoolValidation: &cr.BoolValidation{ Default: true, }, }, ), }
Functions ¶
func AutoGenerateSpotConfig ¶ added in v0.11.0
func CheckCortexSupport ¶ added in v0.11.0
func CheckCortexSupport(instanceMetadata aws.InstanceMetadata) error
func CheckSpotInstanceCompatibility ¶ added in v0.11.0
func CheckSpotInstanceCompatibility(accessKeyID string, secretAccessKey string, target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func CompatibleSpotInstances ¶ added in v0.11.0
func CompatibleSpotInstances(accessKeyID string, secretAccessKey string, targetInstance aws.InstanceMetadata, numInstances int) []aws.InstanceMetadata
func ErrorAtLeastOneInstanceDistribution ¶ added in v0.11.0
func ErrorConfigCannotBeChangedOnUpdate ¶ added in v0.11.0
func ErrorConfiguredWhenSpotIsNotEnabled ¶ 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 ErrorInstanceTypeNotSupported ¶ added in v0.12.0
func ErrorInstanceTypeNotSupportedInRegion ¶ added in v0.11.0
func ErrorInstanceTypeTooSmall ¶
func ErrorInstanceTypeTooSmall() error
func ErrorInvalidAWSCredentials ¶
func ErrorInvalidAWSCredentials() error
func ErrorInvalidAvailabilityZone ¶ added in v0.12.0
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 ErrorSpotPriceGreaterThanTargetOnDemand ¶ added in v0.12.0
func ErrorSpotPriceGreaterThanTargetOnDemand(suggestedSpotPrice float64, target aws.InstanceMetadata, suggested aws.InstanceMetadata) error
func InstallPrompt ¶ added in v0.11.0
func SetDefaults ¶ added in v0.12.0
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 *Config) *cr.PromptValidation
Types ¶
type AccessConfig ¶ added in v0.12.0
type AccessConfig struct { ClusterName *string `json:"cluster_name" yaml:"cluster_name"` Region *string `json:"region" yaml:"region"` ImageManager string `json:"image_manager" yaml:"image_manager"` }
The bare minimum to identify a cluster
func DefaultAccessConfig ¶ added in v0.12.0
func DefaultAccessConfig() (*AccessConfig, error)
type Config ¶ added in v0.12.0
type Config 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"` AvailabilityZones []string `json:"availability_zones" yaml:"availability_zones"` Bucket *string `json:"bucket" yaml:"bucket"` LogGroup string `json:"log_group" yaml:"log_group"` Telemetry bool `json:"telemetry" yaml:"telemetry"` ImagePythonServe string `json:"image_python_serve" yaml:"image_python_serve"` ImagePythonServeGPU string `json:"image_python_serve_gpu" yaml:"image_python_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 GetDefaults ¶ added in v0.12.0
This does not set defaults for fields that are prompted from the user
func (*Config) AutoFillSpot ¶ added in v0.12.0
func (*Config) ToAccessConfig ¶ added in v0.12.0
func (cc *Config) ToAccessConfig() AccessConfig
func (*Config) UserFacingString ¶ added in v0.12.0
func (*Config) UserFacingTable ¶ added in v0.12.0
func (cc *Config) UserFacingTable() table.KeyValuePairs
type ErrorKind ¶
type ErrorKind int
const ( ErrUnknown ErrorKind = iota ErrInstanceTypeTooSmall ErrInvalidAWSCredentials ErrMinInstancesGreaterThanMax ErrInstanceTypeNotSupportedInRegion ErrIncompatibleSpotInstanceTypeMemory ErrIncompatibleSpotInstanceTypeCPU ErrIncompatibleSpotInstanceTypeGPU ErrSpotPriceGreaterThanTargetOnDemand ErrInstanceTypeNotSupported ErrAtLeastOneInstanceDistribution ErrNoCompatibleSpotInstanceFound ErrConfiguredWhenSpotIsNotEnabled ErrOnDemandBaseCapacityGreaterThanMax ErrConfigCannotBeChangedOnUpdate ErrInvalidAvailabilityZone 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 InternalConfig ¶ added in v0.12.0
type InternalConfig struct { Config // 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 (*InternalConfig) UserFacingString ¶ added in v0.12.0
func (cc *InternalConfig) UserFacingString() string
func (*InternalConfig) UserFacingTable ¶ added in v0.12.0
func (cc *InternalConfig) UserFacingTable() table.KeyValuePairs
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.