Skip to content

ACK Lambda Function code is not updated for zipFile #2551

@itaiatu

Description

@itaiatu

Describe the bug
Lambda function code is not updated when updating spec.code.zipFile

Steps to reproduce
Create a Function object from lambda.services.k8s.aws group

apiVersion: lambda.services.k8s.aws/v1alpha1
kind: Function
metadata:
  annotations:
    services.k8s.aws/region: us-east-1
  labels:
    environment: dev
  name: test-function-itaiatu
  namespace: ethos103-dev-va6
spec:
  architectures:
  - x86_64
  code:
    zipFile: <REDACTED>
  environment:
    variables:
      ...
  ephemeralStorage:
    size: 512
  handler: splunk_logger/index.handler
  loggingConfig:
    logFormat: Text
    logGroup: /aws/lambda/ethos103-dev-va6-cw2splunk
  memorySize: 128
  name: test-function-itaiatu
  packageType: Zip
  runtime: nodejs18.x
  ...

Update the spec.code.zipFile with another base64-encoded lambda function code

zip -r splunk_logger.zip splunk_logger
base64 -i splunk_logger.zip | pbcopy
`k -n ethos103-dev-va6 edit function test-function-itaiatu`
Change the `spec.code.zipFile`

Controller doesn't react on this change (maybe ack delta says that there is no difference)

I have also tried to add the code.sha256 field as mentioned in aws-controllers-k8s/lambda-controller#88 and #1689 (those issue & PR are for S3 Bucket alternative)

code:
  sha256: <REDACTED>

but the controller logged

{"level":"info","ts":"2025-07-11T13:54:07.761Z","logger":"ackrt","msg":"desired resource state has changed","kind":"Function","namespace":"ethos103-dev-va6","name":"test-function-itaiatu","account":"164592617289","role":"arn:aws:iam::164592617289:role/ethos-core-ethos996-stage-or2-ack-lambda-assumedrole","region":"us-east-1","is_adopted":false,"generation":3,"diff":[{"Path":{"Parts":["Spec","Code","SHA256"]},"A":"YmZiNzJhZDBiN2VmZGY5ZjE4ZjU0YzExZjFmODNhMmEyNWExYmY2NGNiOTM1ODhkNjNmM2NmZTA4YmRlY2QxNA==","B":"P0TqxO/LRAWxNgaIMXxfZiK66jhzzP7TTpsR+wWvR3o="}]}
{"level":"error","ts":"2025-07-11T13:54:07.896Z","msg":"Reconciler error","controller":"function","controllerGroup":"lambda.services.k8s.aws","controllerKind":"Function","Function":{"name":"test-function-itaiatu","namespace":"ethos103-dev-va6"},"namespace":"ethos103-dev-va6","name":"test-function-itaiatu","reconcileID":"2cc144d8-e65c-405d-bb9b-688be83e8534","error":"operation error Lambda: UpdateFunctionCode, https response error StatusCode: 400, RequestID: f3172054-41a5-4a6a-b949-a3aa83ced4dc, InvalidParameterValueException: Please provide a source for function code.","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:347\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:294\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:255"}

Expected outcome
Update the code of the Lambda Function

Environment

  • Kubernetes version: 1.31
  • Using EKS (yes/no), if so version? EKS 1.31
  • AWS service targeted (S3, RDS, etc.) Lambda

Metadata

Metadata

Labels

kind/supportCategorizes issue or PR as a support question.service/lambdaIndicates issues or PRs that are related to lambda-controller.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions