Add a test to validate changing code and env vars - #204
Conversation
|
Hi @willthames. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
493c1c8 to
04634c5
Compare
|
@a-hilaly @aws-controllers-k8s/lambda-maintainer can this PR get a |
Add setup.sh, pickle.sh and teardown.sh scripts to help manage test infrastructure Update all configuration to allow flexible regions (no longer hard-coding to us-west-2) Update S3 object hash management to store checksum alongside S3 object and use that to validate lambda hashes.
Create a test that updates both function code and environment variables at the same time. In theory, both should work, but there is currently a bug that means that only the code gets updated. This test should allow validation of any fix.
04634c5 to
2fb62b9
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: willthames The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Superseded by #237 - once that's merged, this can be closed |
…nger left partially unapplied (#237) Issue #, if available: [1968](aws-controllers-k8s/community#1968) Description of changes: **Problem** When a single kubectl apply updates both a Function's code (spec.code.sha256 / architectures / code.imageURI) and its configuration (e.g. spec.environment), only the code change was applied. The configuration change was silently dropped until the next full resync (~10h) or the next manual spec edit, even though the resource reported ACK.ResourceSynced=True. **Root cause** customUpdateFunction intentionally issues either UpdateFunctionCode or UpdateFunctionConfiguration in a single reconcile, never both, because either async call puts the function into an updating state and Lambda rejects a second concurrent update. After issuing the code update the Function's status is read as Active which is considered a synced state by the controller. As a result the controller failed to requeue to apply the configuration updates and instead waited the default re-sync duration. **Fix** Derive whether both a code and a configuration change were requested directly from the delta passed into customUpdateFunction, and requeue only in that combined case: - Reconcile 1 applies the code change and requeues after 30s (keeping ResourceSynced=False). - Reconcile 2 sees the code has settled (code delta gone) and applies the deferred configuration change; no requeue. - Reconcile 3 has an empty delta → ResourceSynced=True. Code-only, config-only, and architectures-only updates each apply everything in a single call and do not requeue, so their behavior is unchanged. Fix is similar to work done in #151 **Testing** Added e2e regression test test_function_update_code_and_environment_variable, which patches code.sha256 + code.s3Key + environment in one update and waits on ACK.ResourceSynced=True (long enough to span the 30s requeue) before asserting both the new CodeSha256 and the environment variables are applied. This test fails on main (env var dropped) and passes with the fix. Test is based on #204 work done by @willthames By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description of changes:
Create a test that updates both function code and environment variables at the same time.
In theory, both should work, but there is currently a bug that means that only the code gets updated. This test should allow validation of any fix.
Issue #, if available: aws-controllers-k8s/community#1968
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.