Skip to content

Lambda Update Function Code w/ Annotation #2714

@urton

Description

@urton

Is your feature request related to a problem?
I need a "better" way to update function code when a S3 file prefix is reused for new code. Currently, we are using the .spec.code.sha256 key and iterating with an arbitrary value. This works fine until we also have to update some part of the function configuration (e.g. ENV VARs or memory). If we need to do both a code update and a config update, we run into a race condition where only the code is updated. This is discussed in #2294. In order to do both, via the function CR, we have to either remove the sha256 key, or update it to match the SHA from the function status.

Describe the solution you'd like
I would like to be able to update function code with an annotation:

kubectl annotate function my-function lambda.services.k8s.aws/update-function-code="true"

Describe alternatives you've considered
As mentioned, we use a "double deploy" method utilizing the .spec.code.sha256. We have also discussed ditching the sha256 method and utilizing the aws cli with aws lambda update-function-code, but we'd prefer to keep this all in K8s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.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