Skip to content

fix(function): handle code signing config unavailable in unsupported regions - #230

Open
gobos12 wants to merge 5 commits into
aws-controllers-k8s:mainfrom
gobos12:main
Open

fix(function): handle code signing config unavailable in unsupported regions#230
gobos12 wants to merge 5 commits into
aws-controllers-k8s:mainfrom
gobos12:main

Conversation

@gobos12

@gobos12 gobos12 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available: community#2971

Description of changes:

  • Add new error ErrCodeSigningNotAvailable for regions without AWS Signer support
  • Handle AccessDeniedException in setFunctionCodeSigningConfig with graceful fallback when no CSC ARN is specified
  • Add e2e test test_function_code_signing_in_unsupported_region to verify code signing behavior

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…regions

- Add new error `ErrCodeSigningNotAvailable` for regions without AWS Signer support
- Handle `AccessDeniedException` in `setFunctionCodeSigningConfig` with graceful fallback when no CSC ARN is specified
- Add e2e test `test_function_code_signing_in_unsupported_region` to verify code signing behavior
@ack-prow
ack-prow Bot requested review from knottnt and sapphirew July 31, 2026 17:38
@ack-prow

ack-prow Bot commented Jul 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gobos12
Once this PR has been reviewed and has the lgtm label, please assign a-hilaly for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Comment thread pkg/resource/function/hooks.go
odobos added 3 commits August 3, 2026 17:01
'assert_condition_state_message' compares the full message (not substrings), so update assertion to read substring within AWS response instead
@gobos12
gobos12 requested a review from knottnt August 3, 2026 18:40
rm.metrics.RecordAPICall("UPDATE", "PutFunctionCodeSigningConfig", err)
if err != nil {
if awsErr, ok := ackerr.AWSError(err); ok && awsErr.ErrorCode() == "AccessDeniedException" {
return ackerr.NewTerminalError(err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gobos12 this change does address the concern about the reported error message being misleading, but thinking about it treating AccessDenied as Terminal in every case could be problematic. Generally, we don't consider AccessDenied to be a Terminal condition as it usually means the controller doesn't have the necessary IAM permissions. In that case if the user updates the ACK controller's role with corrected permissions we don't want to force them to bump the Function' spec just for the controller to retry with the new permissions.

If we do want to use a Terminal condition here to prevent unnecessary retries when this is used in a opt-in region we can check for an error message specific to that failure mode. Although I'm not sure that this protection is necessary the error will still be reported to the user as an ACK.Recoverable condition.

if err != nil {
if awsErr, ok := ackerr.AWSError(err); ok && awsErr.ErrorCode() == "AccessDeniedException" {
if ko.Spec.CodeSigningConfigARN != nil && *ko.Spec.CodeSigningConfigARN != "" {
return ackerr.NewTerminalError(err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the above comment. We probably don't want to treat this as a Terminal condition if the we're not sure this is due to the region being unsupported. Otherwise, we could be forcing a user to bump the Functions spec to unwedge an IAM permission issue.

rm.metrics.RecordAPICall("GET", "GetFunctionCodeSigningConfig", err)
if err != nil {
if awsErr, ok := ackerr.AWSError(err); ok && awsErr.ErrorCode() == "AccessDeniedException" {
if ko.Spec.CodeSigningConfigARN != nil && *ko.Spec.CodeSigningConfigARN != "" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, while this will prevent improper updates of CodeSigningConfig it could lead to the out of band additions of a CodeSigningConfig being silently ignored where they would normally be deleted when the controller's role is not granted the GetFunctionCodeSigningConfig read permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants