Documentation ¶
Index ¶
- Constants
- func ContainsString(slice []string, s string) bool
- func CreateNewAWSSessionFromConfig(cfg aws.Config) *awssession.Session
- func CreateSpecDiffersFromDescriptionErrorMessage(job interface{}, status, differences string) string
- func GetGeneratedJobName(objectMetaUID types.UID, objectMetaName string, maxNameLen int) string
- func GetGeneratedResourceName(required, optional string, maxLen int) string
- func GetOrDefault(str *string, defaultStr string) string
- func HasDeletionTimestamp(obj metav1.ObjectMeta) bool
- func IgnoreNotFound(err error) error
- func NoRequeue() (ctrl.Result, error)
- func Now() *metav1.Time
- func RemoveString(slice []string, s string) (result []string)
- func RequeueAfterInterval(interval time.Duration, err error) (ctrl.Result, error)
- func RequeueIfError(err error) (ctrl.Result, error)
- func RequeueImmediately() (ctrl.Result, error)
- func RequeueImmediatelyUnlessGenerationChanged(prevGeneration, curGeneration int64) (ctrl.Result, error)
- type AWSConfigLoader
- type ApplicationAutoscalingClientProvider
- type ReconcileAction
- type SageMakerClientProvider
Constants ¶
const ( // SageMakerResourceFinalizerName is the name of the finalizer that is installed onto managed etcd resources. SageMakerResourceFinalizerName = "sagemaker-operator-finalizer" // DefaultSageMakerEndpointEnvKey is the environment variable key of the default SageMaker endpoint to use. // If this is set to anything other than the empty string, the controllers // will use its value as the endpoint with which to communicate with SageMaker. DefaultSageMakerEndpointEnvKey = "AWS_DEFAULT_SAGEMAKER_ENDPOINT" // InitializingJobStatus is the status stored on first touch of a job by a controller. // This status is kept until the job has a real status. InitializingJobStatus = "SynchronizingK8sJobWithSageMaker" // ErrorStatus is the status when the operator cannot recover by itself by reconciling or to indicate that an error occurred during reconciliation. ErrorStatus = "Error" )
const SagemakerOnKubernetesUserAgentAddition = "sagemaker-on-kubernetes"
SagemakerOnKubernetesUserAgentAddition is the string that will be added to user agent. This helps to distinguish sagemaker job which has been created from kubernetes.
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶
ContainsString is a helper functions to check and remove string from a slice of strings.
func CreateNewAWSSessionFromConfig ¶ added in v1.2.0
func CreateNewAWSSessionFromConfig(cfg aws.Config) *awssession.Session
CreateNewAWSSessionFromConfig returns an AWS session using AWS Config
func CreateSpecDiffersFromDescriptionErrorMessage ¶
func CreateSpecDiffersFromDescriptionErrorMessage(job interface{}, status, differences string) string
CreateSpecDiffersFromDescriptionErrorMessage returns the error message to use when a spec differs from its SageMaker description.
func GetGeneratedJobName ¶
GetGeneratedJobName generates a Sagemaker name for various Kubernetes objects and subresources. We need a deterministic way to identify SageMaker resources given a Kubernetes object. This generates a name based off of the UID and object meta name. SageMaker requires that names be less than a certain length. For Training and BatchTransform, the maximum name length is 63. For HPO, the maximum name length is 32.
See also: * [CreateTrainingJob#TrainingJobName](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html#SageMaker-CreateTrainingJob-request-TrainingJobName) * [CreateTransformJob#TransformJobName](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTransformJob.html#SageMaker-CreateTransformJob-request-TransformJobName) * [CreateHyperParameterTuningJob#HyperParameterTuningJobName](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateHyperParameterTuningJob.html#SageMaker-CreateHyperParameterTuningJob-request-HyperParameterTuningJobName)
func GetGeneratedResourceName ¶
GetGeneratedResourceName creates a resource name from optional and required substrings given a maximum length constraint. If the resource name length is larger than the maximum length, this will truncate first the optional substring, then, if necessary, it will truncate the required substring.
func GetOrDefault ¶
GetOrDefault is a helper function to return a default value
func HasDeletionTimestamp ¶
func HasDeletionTimestamp(obj metav1.ObjectMeta) bool
HasDeletionTimestamp is a helper method that makes logic easier to read.
func IgnoreNotFound ¶
IgnoreNotFound ignores NotFound errors to prevent reconcile loops.
func RemoveString ¶
RemoveString removes a specific string from a splice and returns the rest.
func RequeueAfterInterval ¶
RequeueAfterInterval requeues after a duration when duration > 0 is specified.
func RequeueIfError ¶
RequeueIfError requeues if an error is found.
func RequeueImmediately ¶
RequeueImmediately requeues immediately when Requeue is True and no duration is specified.
func RequeueImmediatelyUnlessGenerationChanged ¶
func RequeueImmediatelyUnlessGenerationChanged(prevGeneration, curGeneration int64) (ctrl.Result, error)
RequeueImmediatelyUnlessGenerationChanged is a helper function which requeues immediately if the object generation has not changed. Otherwise, since the generation change will trigger an immediate update anyways, this will not requeue. This prevents some cases where two reconciliation loops will occur.
Types ¶
type AWSConfigLoader ¶ added in v1.2.0
AWSConfigLoader is a simple struct to facilitate loading AWS config with region- and endpoint-overrides. This uses venv.Env for mocking in tests.
func NewAWSConfigLoader ¶ added in v1.2.0
func NewAWSConfigLoader() AWSConfigLoader
NewAWSConfigLoader creates an AWSConfigLoader with the default OS environment.
func NewAWSConfigLoaderForEnv ¶ added in v1.2.0
func NewAWSConfigLoaderForEnv(env venv.Env) AWSConfigLoader
NewAWSConfigLoaderForEnv returns a AWSConfigLoader for the specified environment.
func (AWSConfigLoader) LoadAWSConfigWithOverrides ¶ added in v1.2.0
func (l AWSConfigLoader) LoadAWSConfigWithOverrides(regionOverride *string, jobSpecificEndpointOverride *string) (aws.Config, error)
LoadAWSConfigWithOverrides loads default AWS config and apply overrides, like setting the region and using a custom SageMaker endpoint. If specified, jobSpecificEndpointOverride always overrides the endpoint. Otherwise, the environment variable specified by DefaultSageMakerEndpointEnvKey overrides the endpoint if it is set.
type ApplicationAutoscalingClientProvider ¶ added in v1.2.0
type ApplicationAutoscalingClientProvider func(aws.Config) applicationautoscalingiface.ApplicationAutoScalingAPI
ApplicationAutoscalingClientProvider is a Type for function that returns a ApplicationAutoscaling client. Used for mocking.
type ReconcileAction ¶
type ReconcileAction string
ReconcileAction is a helper type that describes the action to perform on a resource.
const ( NeedsCreate ReconcileAction = "NeedsCreate" NeedsDelete ReconcileAction = "NeedsDelete" NeedsNoop ReconcileAction = "NeedsNoop" NeedsUpdate ReconcileAction = "NeedsUpdate" )
Constants for the various reconcile actions.
type SageMakerClientProvider ¶
type SageMakerClientProvider func(aws.Config) sagemakeriface.SageMakerAPI
SageMakerClientProvider is a Type for function that returns a SageMaker client. Used for mocking.