Skip to content

Commit d6fd1b7

Browse files
committed
Prevent the controller from calling GetFunctionCodeSigningConfig when a functions packageType is Image
Functions code signing config should only be called when a function is created using an s3bucket and a key. Functions created using a container image cannot get a code signing configuration.
1 parent 597e948 commit d6fd1b7

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

pkg/resource/function/hooks.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -500,17 +500,19 @@ func (rm *resourceManager) setResourceAdditionalFields(
500500
}
501501
ko.Spec.ReservedConcurrentExecutions = getFunctionConcurrencyOutput.ReservedConcurrentExecutions
502502

503-
var getFunctionCodeSigningConfigOutput *svcsdk.GetFunctionCodeSigningConfigOutput
504-
getFunctionCodeSigningConfigOutput, err = rm.sdkapi.GetFunctionCodeSigningConfigWithContext(
505-
ctx,
506-
&svcsdk.GetFunctionCodeSigningConfigInput{
507-
FunctionName: ko.Spec.Name,
508-
},
509-
)
510-
rm.metrics.RecordAPICall("GET", "GetFunctionCodeSigningConfig", err)
511-
if err != nil {
512-
return err
503+
if ko.Spec.PackageType != nil && *ko.Spec.PackageType == "Zip" {
504+
var getFunctionCodeSigningConfigOutput *svcsdk.GetFunctionCodeSigningConfigOutput
505+
getFunctionCodeSigningConfigOutput, err = rm.sdkapi.GetFunctionCodeSigningConfigWithContext(
506+
ctx,
507+
&svcsdk.GetFunctionCodeSigningConfigInput{
508+
FunctionName: ko.Spec.Name,
509+
},
510+
)
511+
rm.metrics.RecordAPICall("GET", "GetFunctionCodeSigningConfig", err)
512+
if err != nil {
513+
return err
514+
}
515+
ko.Spec.CodeSigningConfigARN = getFunctionCodeSigningConfigOutput.CodeSigningConfigArn
513516
}
514-
ko.Spec.CodeSigningConfigARN = getFunctionCodeSigningConfigOutput.CodeSigningConfigArn
515517
return nil
516518
}

0 commit comments

Comments
 (0)