diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 7de77aad..75af4907 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2023-01-04T22:46:39Z" - build_hash: 12246c7da82841b351ec7a9e1f139f9338f2784b + build_date: "2023-01-19T03:37:00Z" + build_hash: 1b20baf45a0b73a11b296050322a384c705fa897 go_version: go1.17.13 - version: v0.21.0 -api_directory_checksum: 19b63f2ee6b7e14b2f6d254a6caff0b9867539e5 + version: v0.22.0 +api_directory_checksum: c38df824c3c6e41cd4eaa559dccc4c05c7e8d075 api_version: v1alpha1 aws_sdk_go_version: v1.44.117 generator_config_info: - file_checksum: fd845048bf7dc84ecd3ea1ed1784b831d8f42645 + file_checksum: e3688a5487a10dccd7a5e488de025d9489043f7d original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 1e85be54..06acacb6 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -57,6 +57,9 @@ resources: Tags: compare: is_ignored: true + hooks: + delta_pre_compare: + code: customSetDefaults(a, b) Endpoint: reconcile: requeue_on_success_seconds: 30 @@ -1017,7 +1020,6 @@ ignore: shape_names: # RSessionAppSettings is an empty struct that causes generation errors - RSessionAppSettings - - ProductionVariantServerlessConfig - ExecutionRoleIdentityConfig - HyperParameterTuningResourceConfig - InstanceMetadataServiceConfiguration diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 088c7d6e..47d87c28 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -2305,15 +2305,19 @@ type PendingDeploymentSummary struct { // the VariantStatus , weight and capacity for a production variant associated // with an endpoint. type PendingProductionVariantSummary struct { - AcceleratorType *string `json:"acceleratorType,omitempty"` - CurrentInstanceCount *int64 `json:"currentInstanceCount,omitempty"` - CurrentWeight *float64 `json:"currentWeight,omitempty"` - DeployedImages []*DeployedImage `json:"deployedImages,omitempty"` - DesiredInstanceCount *int64 `json:"desiredInstanceCount,omitempty"` - DesiredWeight *float64 `json:"desiredWeight,omitempty"` - InstanceType *string `json:"instanceType,omitempty"` - VariantName *string `json:"variantName,omitempty"` - VariantStatus []*ProductionVariantStatus `json:"variantStatus,omitempty"` + AcceleratorType *string `json:"acceleratorType,omitempty"` + CurrentInstanceCount *int64 `json:"currentInstanceCount,omitempty"` + // Specifies the serverless configuration for an endpoint variant. + CurrentServerlessConfig *ProductionVariantServerlessConfig `json:"currentServerlessConfig,omitempty"` + CurrentWeight *float64 `json:"currentWeight,omitempty"` + DeployedImages []*DeployedImage `json:"deployedImages,omitempty"` + DesiredInstanceCount *int64 `json:"desiredInstanceCount,omitempty"` + // Specifies the serverless configuration for an endpoint variant. + DesiredServerlessConfig *ProductionVariantServerlessConfig `json:"desiredServerlessConfig,omitempty"` + DesiredWeight *float64 `json:"desiredWeight,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + VariantName *string `json:"variantName,omitempty"` + VariantStatus []*ProductionVariantStatus `json:"variantStatus,omitempty"` } // The location of the pipeline definition stored in Amazon S3. @@ -2564,8 +2568,10 @@ type ProductionVariant struct { InstanceType *string `json:"instanceType,omitempty"` ModelDataDownloadTimeoutInSeconds *int64 `json:"modelDataDownloadTimeoutInSeconds,omitempty"` ModelName *string `json:"modelName,omitempty"` - VariantName *string `json:"variantName,omitempty"` - VolumeSizeInGB *int64 `json:"volumeSizeInGB,omitempty"` + // Specifies the serverless configuration for an endpoint variant. + ServerlessConfig *ProductionVariantServerlessConfig `json:"serverlessConfig,omitempty"` + VariantName *string `json:"variantName,omitempty"` + VolumeSizeInGB *int64 `json:"volumeSizeInGB,omitempty"` } // Specifies configuration for a core dump from the model container when the @@ -2575,6 +2581,12 @@ type ProductionVariantCoreDumpConfig struct { KMSKeyID *string `json:"kmsKeyID,omitempty"` } +// Specifies the serverless configuration for an endpoint variant. +type ProductionVariantServerlessConfig struct { + MaxConcurrency *int64 `json:"maxConcurrency,omitempty"` + MemorySizeInMB *int64 `json:"memorySizeInMB,omitempty"` +} + // Describes the status of the production variant. type ProductionVariantStatus struct { StartTime *metav1.Time `json:"startTime,omitempty"` @@ -2587,13 +2599,17 @@ type ProductionVariantStatus struct { // API and the endpoint status is Updating, you get different desired and current // values. type ProductionVariantSummary struct { - CurrentInstanceCount *int64 `json:"currentInstanceCount,omitempty"` - CurrentWeight *float64 `json:"currentWeight,omitempty"` - DeployedImages []*DeployedImage `json:"deployedImages,omitempty"` - DesiredInstanceCount *int64 `json:"desiredInstanceCount,omitempty"` - DesiredWeight *float64 `json:"desiredWeight,omitempty"` - VariantName *string `json:"variantName,omitempty"` - VariantStatus []*ProductionVariantStatus `json:"variantStatus,omitempty"` + CurrentInstanceCount *int64 `json:"currentInstanceCount,omitempty"` + // Specifies the serverless configuration for an endpoint variant. + CurrentServerlessConfig *ProductionVariantServerlessConfig `json:"currentServerlessConfig,omitempty"` + CurrentWeight *float64 `json:"currentWeight,omitempty"` + DeployedImages []*DeployedImage `json:"deployedImages,omitempty"` + DesiredInstanceCount *int64 `json:"desiredInstanceCount,omitempty"` + // Specifies the serverless configuration for an endpoint variant. + DesiredServerlessConfig *ProductionVariantServerlessConfig `json:"desiredServerlessConfig,omitempty"` + DesiredWeight *float64 `json:"desiredWeight,omitempty"` + VariantName *string `json:"variantName,omitempty"` + VariantStatus []*ProductionVariantStatus `json:"variantStatus,omitempty"` } // Configuration information for Debugger system monitoring, framework profiling, diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index f3dc3b17..04e9a5ca 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -10275,6 +10275,11 @@ func (in *PendingProductionVariantSummary) DeepCopyInto(out *PendingProductionVa *out = new(int64) **out = **in } + if in.CurrentServerlessConfig != nil { + in, out := &in.CurrentServerlessConfig, &out.CurrentServerlessConfig + *out = new(ProductionVariantServerlessConfig) + (*in).DeepCopyInto(*out) + } if in.CurrentWeight != nil { in, out := &in.CurrentWeight, &out.CurrentWeight *out = new(float64) @@ -10296,6 +10301,11 @@ func (in *PendingProductionVariantSummary) DeepCopyInto(out *PendingProductionVa *out = new(int64) **out = **in } + if in.DesiredServerlessConfig != nil { + in, out := &in.DesiredServerlessConfig, &out.DesiredServerlessConfig + *out = new(ProductionVariantServerlessConfig) + (*in).DeepCopyInto(*out) + } if in.DesiredWeight != nil { in, out := &in.DesiredWeight, &out.DesiredWeight *out = new(float64) @@ -11714,6 +11724,11 @@ func (in *ProductionVariant) DeepCopyInto(out *ProductionVariant) { *out = new(string) **out = **in } + if in.ServerlessConfig != nil { + in, out := &in.ServerlessConfig, &out.ServerlessConfig + *out = new(ProductionVariantServerlessConfig) + (*in).DeepCopyInto(*out) + } if in.VariantName != nil { in, out := &in.VariantName, &out.VariantName *out = new(string) @@ -11761,6 +11776,31 @@ func (in *ProductionVariantCoreDumpConfig) DeepCopy() *ProductionVariantCoreDump return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProductionVariantServerlessConfig) DeepCopyInto(out *ProductionVariantServerlessConfig) { + *out = *in + if in.MaxConcurrency != nil { + in, out := &in.MaxConcurrency, &out.MaxConcurrency + *out = new(int64) + **out = **in + } + if in.MemorySizeInMB != nil { + in, out := &in.MemorySizeInMB, &out.MemorySizeInMB + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProductionVariantServerlessConfig. +func (in *ProductionVariantServerlessConfig) DeepCopy() *ProductionVariantServerlessConfig { + if in == nil { + return nil + } + out := new(ProductionVariantServerlessConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProductionVariantStatus) DeepCopyInto(out *ProductionVariantStatus) { *out = *in @@ -11798,6 +11838,11 @@ func (in *ProductionVariantSummary) DeepCopyInto(out *ProductionVariantSummary) *out = new(int64) **out = **in } + if in.CurrentServerlessConfig != nil { + in, out := &in.CurrentServerlessConfig, &out.CurrentServerlessConfig + *out = new(ProductionVariantServerlessConfig) + (*in).DeepCopyInto(*out) + } if in.CurrentWeight != nil { in, out := &in.CurrentWeight, &out.CurrentWeight *out = new(float64) @@ -11819,6 +11864,11 @@ func (in *ProductionVariantSummary) DeepCopyInto(out *ProductionVariantSummary) *out = new(int64) **out = **in } + if in.DesiredServerlessConfig != nil { + in, out := &in.DesiredServerlessConfig, &out.DesiredServerlessConfig + *out = new(ProductionVariantServerlessConfig) + (*in).DeepCopyInto(*out) + } if in.DesiredWeight != nil { in, out := &in.DesiredWeight, &out.DesiredWeight *out = new(float64) diff --git a/config/crd/bases/sagemaker.services.k8s.aws_endpointconfigs.yaml b/config/crd/bases/sagemaker.services.k8s.aws_endpointconfigs.yaml index 31dbed79..a3a37156 100644 --- a/config/crd/bases/sagemaker.services.k8s.aws_endpointconfigs.yaml +++ b/config/crd/bases/sagemaker.services.k8s.aws_endpointconfigs.yaml @@ -167,6 +167,17 @@ spec: type: integer modelName: type: string + serverlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object variantName: type: string volumeSizeInGB: diff --git a/config/crd/bases/sagemaker.services.k8s.aws_endpoints.yaml b/config/crd/bases/sagemaker.services.k8s.aws_endpoints.yaml index 30bad35d..00f554b4 100644 --- a/config/crd/bases/sagemaker.services.k8s.aws_endpoints.yaml +++ b/config/crd/bases/sagemaker.services.k8s.aws_endpoints.yaml @@ -268,6 +268,17 @@ spec: currentInstanceCount: format: int64 type: integer + currentServerlessConfig: + description: Specifies the serverless configuration for + an endpoint variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object currentWeight: type: number deployedImages: @@ -295,6 +306,17 @@ spec: desiredInstanceCount: format: int64 type: integer + desiredServerlessConfig: + description: Specifies the serverless configuration for + an endpoint variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object desiredWeight: type: number instanceType: @@ -332,6 +354,17 @@ spec: currentInstanceCount: format: int64 type: integer + currentServerlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object currentWeight: type: number deployedImages: @@ -359,6 +392,17 @@ spec: desiredInstanceCount: format: int64 type: integer + desiredServerlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object desiredWeight: type: number variantName: diff --git a/generator.yaml b/generator.yaml index 1e85be54..06acacb6 100644 --- a/generator.yaml +++ b/generator.yaml @@ -57,6 +57,9 @@ resources: Tags: compare: is_ignored: true + hooks: + delta_pre_compare: + code: customSetDefaults(a, b) Endpoint: reconcile: requeue_on_success_seconds: 30 @@ -1017,7 +1020,6 @@ ignore: shape_names: # RSessionAppSettings is an empty struct that causes generation errors - RSessionAppSettings - - ProductionVariantServerlessConfig - ExecutionRoleIdentityConfig - HyperParameterTuningResourceConfig - InstanceMetadataServiceConfiguration diff --git a/helm/crds/sagemaker.services.k8s.aws_endpointconfigs.yaml b/helm/crds/sagemaker.services.k8s.aws_endpointconfigs.yaml index 31dbed79..a3a37156 100644 --- a/helm/crds/sagemaker.services.k8s.aws_endpointconfigs.yaml +++ b/helm/crds/sagemaker.services.k8s.aws_endpointconfigs.yaml @@ -167,6 +167,17 @@ spec: type: integer modelName: type: string + serverlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object variantName: type: string volumeSizeInGB: diff --git a/helm/crds/sagemaker.services.k8s.aws_endpoints.yaml b/helm/crds/sagemaker.services.k8s.aws_endpoints.yaml index 30bad35d..00f554b4 100644 --- a/helm/crds/sagemaker.services.k8s.aws_endpoints.yaml +++ b/helm/crds/sagemaker.services.k8s.aws_endpoints.yaml @@ -268,6 +268,17 @@ spec: currentInstanceCount: format: int64 type: integer + currentServerlessConfig: + description: Specifies the serverless configuration for + an endpoint variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object currentWeight: type: number deployedImages: @@ -295,6 +306,17 @@ spec: desiredInstanceCount: format: int64 type: integer + desiredServerlessConfig: + description: Specifies the serverless configuration for + an endpoint variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object desiredWeight: type: number instanceType: @@ -332,6 +354,17 @@ spec: currentInstanceCount: format: int64 type: integer + currentServerlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object currentWeight: type: number deployedImages: @@ -359,6 +392,17 @@ spec: desiredInstanceCount: format: int64 type: integer + desiredServerlessConfig: + description: Specifies the serverless configuration for an endpoint + variant. + properties: + maxConcurrency: + format: int64 + type: integer + memorySizeInMB: + format: int64 + type: integer + type: object desiredWeight: type: number variantName: diff --git a/pkg/resource/endpoint/sdk.go b/pkg/resource/endpoint/sdk.go index 1b09705e..06f25c7b 100644 --- a/pkg/resource/endpoint/sdk.go +++ b/pkg/resource/endpoint/sdk.go @@ -200,29 +200,49 @@ func (rm *resourceManager) sdkFind( if f10f1iter.CurrentInstanceCount != nil { f10f1elem.CurrentInstanceCount = f10f1iter.CurrentInstanceCount } + if f10f1iter.CurrentServerlessConfig != nil { + f10f1elemf2 := &svcapitypes.ProductionVariantServerlessConfig{} + if f10f1iter.CurrentServerlessConfig.MaxConcurrency != nil { + f10f1elemf2.MaxConcurrency = f10f1iter.CurrentServerlessConfig.MaxConcurrency + } + if f10f1iter.CurrentServerlessConfig.MemorySizeInMB != nil { + f10f1elemf2.MemorySizeInMB = f10f1iter.CurrentServerlessConfig.MemorySizeInMB + } + f10f1elem.CurrentServerlessConfig = f10f1elemf2 + } if f10f1iter.CurrentWeight != nil { f10f1elem.CurrentWeight = f10f1iter.CurrentWeight } if f10f1iter.DeployedImages != nil { - f10f1elemf3 := []*svcapitypes.DeployedImage{} - for _, f10f1elemf3iter := range f10f1iter.DeployedImages { - f10f1elemf3elem := &svcapitypes.DeployedImage{} - if f10f1elemf3iter.ResolutionTime != nil { - f10f1elemf3elem.ResolutionTime = &metav1.Time{*f10f1elemf3iter.ResolutionTime} + f10f1elemf4 := []*svcapitypes.DeployedImage{} + for _, f10f1elemf4iter := range f10f1iter.DeployedImages { + f10f1elemf4elem := &svcapitypes.DeployedImage{} + if f10f1elemf4iter.ResolutionTime != nil { + f10f1elemf4elem.ResolutionTime = &metav1.Time{*f10f1elemf4iter.ResolutionTime} } - if f10f1elemf3iter.ResolvedImage != nil { - f10f1elemf3elem.ResolvedImage = f10f1elemf3iter.ResolvedImage + if f10f1elemf4iter.ResolvedImage != nil { + f10f1elemf4elem.ResolvedImage = f10f1elemf4iter.ResolvedImage } - if f10f1elemf3iter.SpecifiedImage != nil { - f10f1elemf3elem.SpecifiedImage = f10f1elemf3iter.SpecifiedImage + if f10f1elemf4iter.SpecifiedImage != nil { + f10f1elemf4elem.SpecifiedImage = f10f1elemf4iter.SpecifiedImage } - f10f1elemf3 = append(f10f1elemf3, f10f1elemf3elem) + f10f1elemf4 = append(f10f1elemf4, f10f1elemf4elem) } - f10f1elem.DeployedImages = f10f1elemf3 + f10f1elem.DeployedImages = f10f1elemf4 } if f10f1iter.DesiredInstanceCount != nil { f10f1elem.DesiredInstanceCount = f10f1iter.DesiredInstanceCount } + if f10f1iter.DesiredServerlessConfig != nil { + f10f1elemf6 := &svcapitypes.ProductionVariantServerlessConfig{} + if f10f1iter.DesiredServerlessConfig.MaxConcurrency != nil { + f10f1elemf6.MaxConcurrency = f10f1iter.DesiredServerlessConfig.MaxConcurrency + } + if f10f1iter.DesiredServerlessConfig.MemorySizeInMB != nil { + f10f1elemf6.MemorySizeInMB = f10f1iter.DesiredServerlessConfig.MemorySizeInMB + } + f10f1elem.DesiredServerlessConfig = f10f1elemf6 + } if f10f1iter.DesiredWeight != nil { f10f1elem.DesiredWeight = f10f1iter.DesiredWeight } @@ -233,21 +253,21 @@ func (rm *resourceManager) sdkFind( f10f1elem.VariantName = f10f1iter.VariantName } if f10f1iter.VariantStatus != nil { - f10f1elemf8 := []*svcapitypes.ProductionVariantStatus{} - for _, f10f1elemf8iter := range f10f1iter.VariantStatus { - f10f1elemf8elem := &svcapitypes.ProductionVariantStatus{} - if f10f1elemf8iter.StartTime != nil { - f10f1elemf8elem.StartTime = &metav1.Time{*f10f1elemf8iter.StartTime} + f10f1elemf10 := []*svcapitypes.ProductionVariantStatus{} + for _, f10f1elemf10iter := range f10f1iter.VariantStatus { + f10f1elemf10elem := &svcapitypes.ProductionVariantStatus{} + if f10f1elemf10iter.StartTime != nil { + f10f1elemf10elem.StartTime = &metav1.Time{*f10f1elemf10iter.StartTime} } - if f10f1elemf8iter.Status != nil { - f10f1elemf8elem.Status = f10f1elemf8iter.Status + if f10f1elemf10iter.Status != nil { + f10f1elemf10elem.Status = f10f1elemf10iter.Status } - if f10f1elemf8iter.StatusMessage != nil { - f10f1elemf8elem.StatusMessage = f10f1elemf8iter.StatusMessage + if f10f1elemf10iter.StatusMessage != nil { + f10f1elemf10elem.StatusMessage = f10f1elemf10iter.StatusMessage } - f10f1elemf8 = append(f10f1elemf8, f10f1elemf8elem) + f10f1elemf10 = append(f10f1elemf10, f10f1elemf10elem) } - f10f1elem.VariantStatus = f10f1elemf8 + f10f1elem.VariantStatus = f10f1elemf10 } f10f1 = append(f10f1, f10f1elem) } @@ -267,29 +287,49 @@ func (rm *resourceManager) sdkFind( if f11iter.CurrentInstanceCount != nil { f11elem.CurrentInstanceCount = f11iter.CurrentInstanceCount } + if f11iter.CurrentServerlessConfig != nil { + f11elemf1 := &svcapitypes.ProductionVariantServerlessConfig{} + if f11iter.CurrentServerlessConfig.MaxConcurrency != nil { + f11elemf1.MaxConcurrency = f11iter.CurrentServerlessConfig.MaxConcurrency + } + if f11iter.CurrentServerlessConfig.MemorySizeInMB != nil { + f11elemf1.MemorySizeInMB = f11iter.CurrentServerlessConfig.MemorySizeInMB + } + f11elem.CurrentServerlessConfig = f11elemf1 + } if f11iter.CurrentWeight != nil { f11elem.CurrentWeight = f11iter.CurrentWeight } if f11iter.DeployedImages != nil { - f11elemf2 := []*svcapitypes.DeployedImage{} - for _, f11elemf2iter := range f11iter.DeployedImages { - f11elemf2elem := &svcapitypes.DeployedImage{} - if f11elemf2iter.ResolutionTime != nil { - f11elemf2elem.ResolutionTime = &metav1.Time{*f11elemf2iter.ResolutionTime} + f11elemf3 := []*svcapitypes.DeployedImage{} + for _, f11elemf3iter := range f11iter.DeployedImages { + f11elemf3elem := &svcapitypes.DeployedImage{} + if f11elemf3iter.ResolutionTime != nil { + f11elemf3elem.ResolutionTime = &metav1.Time{*f11elemf3iter.ResolutionTime} } - if f11elemf2iter.ResolvedImage != nil { - f11elemf2elem.ResolvedImage = f11elemf2iter.ResolvedImage + if f11elemf3iter.ResolvedImage != nil { + f11elemf3elem.ResolvedImage = f11elemf3iter.ResolvedImage } - if f11elemf2iter.SpecifiedImage != nil { - f11elemf2elem.SpecifiedImage = f11elemf2iter.SpecifiedImage + if f11elemf3iter.SpecifiedImage != nil { + f11elemf3elem.SpecifiedImage = f11elemf3iter.SpecifiedImage } - f11elemf2 = append(f11elemf2, f11elemf2elem) + f11elemf3 = append(f11elemf3, f11elemf3elem) } - f11elem.DeployedImages = f11elemf2 + f11elem.DeployedImages = f11elemf3 } if f11iter.DesiredInstanceCount != nil { f11elem.DesiredInstanceCount = f11iter.DesiredInstanceCount } + if f11iter.DesiredServerlessConfig != nil { + f11elemf5 := &svcapitypes.ProductionVariantServerlessConfig{} + if f11iter.DesiredServerlessConfig.MaxConcurrency != nil { + f11elemf5.MaxConcurrency = f11iter.DesiredServerlessConfig.MaxConcurrency + } + if f11iter.DesiredServerlessConfig.MemorySizeInMB != nil { + f11elemf5.MemorySizeInMB = f11iter.DesiredServerlessConfig.MemorySizeInMB + } + f11elem.DesiredServerlessConfig = f11elemf5 + } if f11iter.DesiredWeight != nil { f11elem.DesiredWeight = f11iter.DesiredWeight } @@ -297,21 +337,21 @@ func (rm *resourceManager) sdkFind( f11elem.VariantName = f11iter.VariantName } if f11iter.VariantStatus != nil { - f11elemf6 := []*svcapitypes.ProductionVariantStatus{} - for _, f11elemf6iter := range f11iter.VariantStatus { - f11elemf6elem := &svcapitypes.ProductionVariantStatus{} - if f11elemf6iter.StartTime != nil { - f11elemf6elem.StartTime = &metav1.Time{*f11elemf6iter.StartTime} + f11elemf8 := []*svcapitypes.ProductionVariantStatus{} + for _, f11elemf8iter := range f11iter.VariantStatus { + f11elemf8elem := &svcapitypes.ProductionVariantStatus{} + if f11elemf8iter.StartTime != nil { + f11elemf8elem.StartTime = &metav1.Time{*f11elemf8iter.StartTime} } - if f11elemf6iter.Status != nil { - f11elemf6elem.Status = f11elemf6iter.Status + if f11elemf8iter.Status != nil { + f11elemf8elem.Status = f11elemf8iter.Status } - if f11elemf6iter.StatusMessage != nil { - f11elemf6elem.StatusMessage = f11elemf6iter.StatusMessage + if f11elemf8iter.StatusMessage != nil { + f11elemf8elem.StatusMessage = f11elemf8iter.StatusMessage } - f11elemf6 = append(f11elemf6, f11elemf6elem) + f11elemf8 = append(f11elemf8, f11elemf8elem) } - f11elem.VariantStatus = f11elemf6 + f11elem.VariantStatus = f11elemf8 } f11 = append(f11, f11elem) } diff --git a/pkg/resource/endpoint_config/custom_delta.go b/pkg/resource/endpoint_config/custom_delta.go new file mode 100644 index 00000000..7bf49228 --- /dev/null +++ b/pkg/resource/endpoint_config/custom_delta.go @@ -0,0 +1,38 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file 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. + +package endpoint_config + +import ( + ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" +) + +func customSetDefaults( + a *resource, + b *resource, +) { + // The Sagemaker Service returns a value for VolumeSizeInGB for a Serverless endpoint, despite the user not being able + // to specify it. + // TODO: Use Late Initialization instead whenever the code generator supports it for slices/arrays. + + if ackcompare.IsNotNil(a.ko.Spec.ProductionVariants) && ackcompare.IsNotNil(a.ko.Spec.ProductionVariants) { + if len(a.ko.Spec.ProductionVariants) == len(b.ko.Spec.ProductionVariants) { + for i, _ := range a.ko.Spec.ProductionVariants { + if a.ko.Spec.ProductionVariants[i].ServerlessConfig != nil && a.ko.Spec.ProductionVariants[i].VolumeSizeInGB == nil && + b.ko.Spec.ProductionVariants[i].VolumeSizeInGB != nil { + a.ko.Spec.ProductionVariants[i].VolumeSizeInGB = b.ko.Spec.ProductionVariants[i].VolumeSizeInGB + } + } + } + } +} diff --git a/pkg/resource/endpoint_config/delta.go b/pkg/resource/endpoint_config/delta.go index dce98247..564f258c 100644 --- a/pkg/resource/endpoint_config/delta.go +++ b/pkg/resource/endpoint_config/delta.go @@ -40,6 +40,7 @@ func newResourceDelta( delta.Add("", a, b) return delta } + customSetDefaults(a, b) if ackcompare.HasNilDifference(a.ko.Spec.AsyncInferenceConfig, b.ko.Spec.AsyncInferenceConfig) { delta.Add("Spec.AsyncInferenceConfig", a.ko.Spec.AsyncInferenceConfig, b.ko.Spec.AsyncInferenceConfig) diff --git a/pkg/resource/endpoint_config/sdk.go b/pkg/resource/endpoint_config/sdk.go index d35aaf7e..21618fff 100644 --- a/pkg/resource/endpoint_config/sdk.go +++ b/pkg/resource/endpoint_config/sdk.go @@ -223,6 +223,16 @@ func (rm *resourceManager) sdkFind( if f6iter.ModelName != nil { f6elem.ModelName = f6iter.ModelName } + if f6iter.ServerlessConfig != nil { + f6elemf8 := &svcapitypes.ProductionVariantServerlessConfig{} + if f6iter.ServerlessConfig.MaxConcurrency != nil { + f6elemf8.MaxConcurrency = f6iter.ServerlessConfig.MaxConcurrency + } + if f6iter.ServerlessConfig.MemorySizeInMB != nil { + f6elemf8.MemorySizeInMB = f6iter.ServerlessConfig.MemorySizeInMB + } + f6elem.ServerlessConfig = f6elemf8 + } if f6iter.VariantName != nil { f6elem.VariantName = f6iter.VariantName } @@ -433,6 +443,16 @@ func (rm *resourceManager) newCreateRequestPayload( if f4iter.ModelName != nil { f4elem.SetModelName(*f4iter.ModelName) } + if f4iter.ServerlessConfig != nil { + f4elemf8 := &svcsdk.ProductionVariantServerlessConfig{} + if f4iter.ServerlessConfig.MaxConcurrency != nil { + f4elemf8.SetMaxConcurrency(*f4iter.ServerlessConfig.MaxConcurrency) + } + if f4iter.ServerlessConfig.MemorySizeInMB != nil { + f4elemf8.SetMemorySizeInMB(*f4iter.ServerlessConfig.MemorySizeInMB) + } + f4elem.SetServerlessConfig(f4elemf8) + } if f4iter.VariantName != nil { f4elem.SetVariantName(*f4iter.VariantName) } diff --git a/pkg/resource/endpoint_config/testdata/sdkapi/describe/sucess_serverless.json b/pkg/resource/endpoint_config/testdata/sdkapi/describe/sucess_serverless.json new file mode 100644 index 00000000..2814f204 --- /dev/null +++ b/pkg/resource/endpoint_config/testdata/sdkapi/describe/sucess_serverless.json @@ -0,0 +1,27 @@ +{ + "AsyncInferenceConfig": null, + "CreationTime": "0001-01-01T00:00:00Z", + "DataCaptureConfig": null, + "EndpointConfigArn": "arn:aws:sagemaker:us-west-2:123456789012:endpoint-config/single-variant-config", + "EndpointConfigName": "single-variant-config", + "ExplainerConfig": null, + "KmsKeyId": null, + "ProductionVariants": [ + { + "AcceleratorType": null, + "ContainerStartupHealthCheckTimeoutInSeconds": null, + "CoreDumpConfig": null, + "InitialInstanceCount": null, + "InitialVariantWeight": 1, + "InstanceType": null, + "ModelDataDownloadTimeoutInSeconds": null, + "ModelName": "single-variant-config-model", + "ServerlessConfig": { + "MaxConcurrency": 20, + "MemorySizeInMB": 1024 + }, + "VariantName": "AllTraffic", + "VolumeSizeInGB": 5 + } + ] + } \ No newline at end of file diff --git a/pkg/resource/endpoint_config/testdata/test_suite.yaml b/pkg/resource/endpoint_config/testdata/test_suite.yaml index 4e384d58..f091c4d3 100644 --- a/pkg/resource/endpoint_config/testdata/test_suite.yaml +++ b/pkg/resource/endpoint_config/testdata/test_suite.yaml @@ -90,6 +90,17 @@ invoke: ReadOne expect: latest_state: "v1alpha1/readone/observed/conditions_clear_on_success.yaml" + - name: "ReadOne=SuccessServerless" + description: "Testing a successful reconciliation of a Serverless Endpoint" + given: + desired_state: "v1alpha1/readone/desired/serverless_endpoint_create.yaml" + svc_api: + - operation: DescribeEndpointConfigWithContext + output_fixture: "sdkapi/describe/sucess_serverless.json" + invoke: ReadOne + expect: + latest_state: "v1alpha1/readone/observed/serverless_endpoint_on_success.yaml" + - name: "Endpoint config update tests" description: "Testing the update operation" scenarios: diff --git a/pkg/resource/endpoint_config/testdata/v1alpha1/readone/desired/serverless_endpoint_create.yaml b/pkg/resource/endpoint_config/testdata/v1alpha1/readone/desired/serverless_endpoint_create.yaml new file mode 100644 index 00000000..659cffd4 --- /dev/null +++ b/pkg/resource/endpoint_config/testdata/v1alpha1/readone/desired/serverless_endpoint_create.yaml @@ -0,0 +1,20 @@ +apiVersion: sagemaker.services.k8s.aws/v1alpha1 +kind: EndpointConfig +metadata: + creationTimestamp: null + name: single-variant-config +spec: + endpointConfigName: single-variant-config + productionVariants: + - initialVariantWeight: 1 + modelName: single-variant-config-model + variantName: AllTraffic + serverlessConfig: + maxConcurrency: 20 + memorySizeInMB: 1024 +status: + ackResourceMetadata: + arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint-config/single-variant-config + ownerAccountID: "" + region: "" + conditions: [] diff --git a/pkg/resource/endpoint_config/testdata/v1alpha1/readone/observed/serverless_endpoint_on_success.yaml b/pkg/resource/endpoint_config/testdata/v1alpha1/readone/observed/serverless_endpoint_on_success.yaml new file mode 100644 index 00000000..300655f8 --- /dev/null +++ b/pkg/resource/endpoint_config/testdata/v1alpha1/readone/observed/serverless_endpoint_on_success.yaml @@ -0,0 +1,20 @@ +apiVersion: sagemaker.services.k8s.aws/v1alpha1 +kind: EndpointConfig +metadata: + creationTimestamp: null + name: single-variant-config +spec: + endpointConfigName: single-variant-config + productionVariants: + - initialVariantWeight: 1 + modelName: single-variant-config-model + variantName: AllTraffic + serverlessConfig: + maxConcurrency: 20 + memorySizeInMB: 1024 +status: + ackResourceMetadata: + arn: arn:aws:sagemaker:us-west-2:123456789012:endpoint-config/single-variant-config + ownerAccountID: "" + region: "" + conditions: [] \ No newline at end of file