Skip to content

Commit 656acea

Browse files
authored
chore: remove excessive validation for fargate spot for ARM (#5943)
Address #5934 and #5941 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
1 parent 1d7ec1d commit 656acea

File tree

3 files changed

+0
-153
lines changed

3 files changed

+0
-153
lines changed

internal/pkg/manifest/validate.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,6 @@ func (l LoadBalancedWebServiceConfig) validate() error {
276276
return fmt.Errorf("validate Windows: service connect (`network.connect`) is not supported for Windows")
277277
}
278278
}
279-
if l.TaskConfig.IsARM() {
280-
if err = validateARM(validateARMOpts{
281-
Spot: l.Count.AdvancedCount.Spot,
282-
SpotFrom: l.Count.AdvancedCount.Range.RangeConfig.SpotFrom,
283-
}); err != nil {
284-
return fmt.Errorf("validate ARM: %w", err)
285-
}
286-
}
287279
if err = l.NLBConfig.validate(); err != nil {
288280
return fmt.Errorf(`validate "nlb": %w`, err)
289281
}
@@ -409,14 +401,6 @@ func (b BackendServiceConfig) validate() error {
409401
return fmt.Errorf("validate Windows: service connect (`network.connect`) is not supported for Windows")
410402
}
411403
}
412-
if b.TaskConfig.IsARM() {
413-
if err = validateARM(validateARMOpts{
414-
Spot: b.Count.AdvancedCount.Spot,
415-
SpotFrom: b.Count.AdvancedCount.Range.RangeConfig.SpotFrom,
416-
}); err != nil {
417-
return fmt.Errorf("validate ARM: %w", err)
418-
}
419-
}
420404
return nil
421405
}
422406

@@ -530,14 +514,6 @@ func (w WorkerServiceConfig) validate() error {
530514
return fmt.Errorf(`validate Windows: %w`, err)
531515
}
532516
}
533-
if w.TaskConfig.IsARM() {
534-
if err = validateARM(validateARMOpts{
535-
Spot: w.Count.AdvancedCount.Spot,
536-
SpotFrom: w.Count.AdvancedCount.Range.RangeConfig.SpotFrom,
537-
}); err != nil {
538-
return fmt.Errorf("validate ARM: %w", err)
539-
}
540-
}
541517
return nil
542518
}
543519

@@ -611,14 +587,6 @@ func (s ScheduledJobConfig) validate() error {
611587
return fmt.Errorf(`validate Windows: %w`, err)
612588
}
613589
}
614-
if s.TaskConfig.IsARM() {
615-
if err = validateARM(validateARMOpts{
616-
Spot: s.Count.AdvancedCount.Spot,
617-
SpotFrom: s.Count.AdvancedCount.Range.RangeConfig.SpotFrom,
618-
}); err != nil {
619-
return fmt.Errorf("validate ARM: %w", err)
620-
}
621-
}
622590
return nil
623591
}
624592

@@ -2032,11 +2000,6 @@ type validateWindowsOpts struct {
20322000
efsVolumes map[string]*Volume
20332001
}
20342002

2035-
type validateARMOpts struct {
2036-
Spot *int
2037-
SpotFrom *int
2038-
}
2039-
20402003
func validateHealthCheckPorts(opts validateHealthCheckPortsOpts) error {
20412004
for _, rule := range opts.alb.RoutingRules() {
20422005
healthCheckPort := rule.HealthCheckPort(opts.mainContainerPort)
@@ -2394,13 +2357,6 @@ func validateWindows(opts validateWindowsOpts) error {
23942357
return nil
23952358
}
23962359

2397-
func validateARM(opts validateARMOpts) error {
2398-
if opts.Spot != nil || opts.SpotFrom != nil {
2399-
return errors.New(`'Fargate Spot' is not supported when deploying on ARM architecture`)
2400-
}
2401-
return nil
2402-
}
2403-
24042360
// validate returns nil if ImageLocationOrBuild is configured correctly.
24052361
func (i ImageLocationOrBuild) validate() error {
24062362
if err := i.Build.validate(); err != nil {

internal/pkg/manifest/validate_test.go

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -416,33 +416,6 @@ func TestLoadBalancedWebService_validate(t *testing.T) {
416416
},
417417
wantedErrorMsgPrefix: "validate Windows: service connect (`network.connect`) is not supported for Window",
418418
},
419-
"error if fail to validate ARM": {
420-
lbConfig: LoadBalancedWebService{
421-
Workload: Workload{
422-
Name: aws.String("mockName"),
423-
},
424-
LoadBalancedWebServiceConfig: LoadBalancedWebServiceConfig{
425-
ImageConfig: testImageConfig,
426-
TaskConfig: TaskConfig{
427-
Platform: PlatformArgsOrString{PlatformString: (*PlatformString)(aws.String("linux/arm64"))},
428-
Count: Count{
429-
AdvancedCount: AdvancedCount{
430-
Spot: aws.Int(123),
431-
workloadType: manifestinfo.LoadBalancedWebServiceType,
432-
},
433-
},
434-
},
435-
HTTPOrBool: HTTPOrBool{
436-
HTTP: HTTP{
437-
Main: RoutingRule{
438-
Path: stringP("/"),
439-
},
440-
},
441-
},
442-
},
443-
},
444-
wantedErrorMsgPrefix: `validate ARM: `,
445-
},
446419
"error if neither of http or nlb is enabled": {
447420
lbConfig: LoadBalancedWebService{
448421
Workload: Workload{
@@ -729,26 +702,6 @@ func TestBackendService_validate(t *testing.T) {
729702
},
730703
wantedErrorMsgPrefix: "validate Windows: service connect (`network.connect`) is not supported for Window",
731704
},
732-
"error if fail to validate ARM": {
733-
config: BackendService{
734-
Workload: Workload{
735-
Name: aws.String("mockName"),
736-
},
737-
BackendServiceConfig: BackendServiceConfig{
738-
ImageConfig: testImageConfig,
739-
TaskConfig: TaskConfig{
740-
Platform: PlatformArgsOrString{PlatformString: (*PlatformString)(aws.String("linux/arm64"))},
741-
Count: Count{
742-
AdvancedCount: AdvancedCount{
743-
Spot: aws.Int(123),
744-
workloadType: manifestinfo.BackendServiceType,
745-
},
746-
},
747-
},
748-
},
749-
},
750-
wantedErrorMsgPrefix: `validate ARM: `,
751-
},
752705
"error if fail to validate deployment": {
753706
config: BackendService{
754707
Workload: Workload{
@@ -1177,26 +1130,6 @@ func TestWorkerService_validate(t *testing.T) {
11771130
},
11781131
wantedErrorMsgPrefix: `validate Windows: `,
11791132
},
1180-
"error if fail to validate ARM": {
1181-
config: WorkerService{
1182-
Workload: Workload{
1183-
Name: aws.String("mockName"),
1184-
},
1185-
WorkerServiceConfig: WorkerServiceConfig{
1186-
ImageConfig: testImageConfig,
1187-
TaskConfig: TaskConfig{
1188-
Platform: PlatformArgsOrString{PlatformString: (*PlatformString)(aws.String("linux/arm64"))},
1189-
Count: Count{
1190-
AdvancedCount: AdvancedCount{
1191-
Spot: aws.Int(123),
1192-
workloadType: manifestinfo.WorkerServiceType,
1193-
},
1194-
},
1195-
},
1196-
},
1197-
},
1198-
wantedErrorMsgPrefix: `validate ARM: `,
1199-
},
12001133
"error if fail to validate deployment": {
12011134
config: WorkerService{
12021135
Workload: Workload{
@@ -3925,43 +3858,6 @@ func TestValidateWindows(t *testing.T) {
39253858
}
39263859
}
39273860

3928-
func TestValidateARM(t *testing.T) {
3929-
testCases := map[string]struct {
3930-
in validateARMOpts
3931-
wantedError error
3932-
}{
3933-
"should return an error if Spot specified inline": {
3934-
in: validateARMOpts{
3935-
Spot: aws.Int(2),
3936-
},
3937-
wantedError: fmt.Errorf(`'Fargate Spot' is not supported when deploying on ARM architecture`),
3938-
},
3939-
"should return an error if Spot specified with spot_from": {
3940-
in: validateARMOpts{
3941-
SpotFrom: aws.Int(2),
3942-
},
3943-
wantedError: fmt.Errorf(`'Fargate Spot' is not supported when deploying on ARM architecture`),
3944-
},
3945-
"should return nil if Spot not specified": {
3946-
in: validateARMOpts{
3947-
Spot: nil,
3948-
},
3949-
wantedError: nil,
3950-
},
3951-
}
3952-
for name, tc := range testCases {
3953-
t.Run(name, func(t *testing.T) {
3954-
err := validateARM(tc.in)
3955-
3956-
if tc.wantedError != nil {
3957-
require.EqualError(t, err, tc.wantedError.Error())
3958-
} else {
3959-
require.NoError(t, err)
3960-
}
3961-
})
3962-
}
3963-
}
3964-
39653861
func TestDeploymentConfig_validate(t *testing.T) {
39663862
testCases := map[string]struct {
39673863
deployConfig DeploymentConfig

internal/pkg/manifest/workload_ecs.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,6 @@ func (t TaskConfig) IsWindows() bool {
201201
return isWindowsPlatform(t.Platform)
202202
}
203203

204-
// IsARM returns whether or not the service is building with an ARM Arch.
205-
func (t TaskConfig) IsARM() bool {
206-
return IsArmArch(t.Platform.Arch())
207-
}
208-
209204
// Secret represents an identifier for sensitive data stored in either SSM or SecretsManager.
210205
type Secret struct {
211206
from StringOrFromCFN // SSM Parameter name or ARN to a secret or secret ARN imported from another CloudFormation stack.

0 commit comments

Comments
 (0)