Skip to content

fix: Update support for Layers #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

Vandita2020
Copy link
Member

Description:
This PR adds the missing update feature for Layers property in Function resource.

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

@ack-prow ack-prow bot requested review from a-hilaly and valerena April 18, 2024 22:57
@ack-prow ack-prow bot added the approved label Apr 18, 2024
Comment on lines +182 to +212
if delta.DifferentAt("Spec.Environment") {
environment := &svcsdk.Environment{}
if dspec.Environment != nil {
environment.Variables = dspec.Environment.DeepCopy().Variables
}
input.Environment = environment
}

if delta.DifferentAt("Spec.EphemeralStorage") {
ephemeralStorage := &svcsdk.EphemeralStorage{}
if dspec.EphemeralStorage != nil {
ephemeralStorageCopy := dspec.EphemeralStorage.DeepCopy()
ephemeralStorage.Size = ephemeralStorageCopy.Size
}
input.EphemeralStorage = ephemeralStorage
}

if delta.DifferentAt("Spec.FileSystemConfigs") {
fileSystemConfigs := []*svcsdk.FileSystemConfig{}
if len(dspec.FileSystemConfigs) > 0 {
for _, elem := range dspec.FileSystemConfigs {
elemCopy := elem.DeepCopy()
fscElem := &svcsdk.FileSystemConfig{
Arn: elemCopy.ARN,
LocalMountPath: elemCopy.LocalMountPath,
}
fileSystemConfigs = append(fileSystemConfigs, fscElem)
}
input.FileSystemConfigs = fileSystemConfigs
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Thanks @Vandita2020 ! How are environement/ephemeralStorage/FileSystemConfigs/Timeouts affecting to layers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey, I have just rearranged them according to the order in the API. Please ignore them, no changes for them.

}
ko.Spec.Layers = layer
Copy link
Member

Choose a reason for hiding this comment

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

Can we have some smoke tests around layers updates?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@Vandita2020 Vandita2020 force-pushed the update_layers branch 3 times, most recently from f1956ac to 2a6c3db Compare April 22, 2024 21:41
@aws-controllers-k8s aws-controllers-k8s deleted a comment from ack-prow bot Apr 22, 2024
@Vandita2020
Copy link
Member Author

/test lambda-kind-e2e

@Vandita2020 Vandita2020 force-pushed the update_layers branch 2 times, most recently from 10fb31e to 74df9d2 Compare April 22, 2024 22:50
assert lambda_validator.function_exists(resource_name)

# Update cr
layers_list = ["arn:aws:lambda:us-west-2:017000801446:layer:AWSLambdaPowertoolsPythonV2:68", "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:52"]
Copy link
Member

Choose a reason for hiding this comment

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

qq: I guess those are official layers that anybody can reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, those are from the list of layers provided by AWS.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Thank you @Vandita2020 !
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2024
Copy link

ack-prow bot commented Apr 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, Vandita2020

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Vandita2020,a-hilaly]

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

@ack-prow ack-prow bot merged commit bedf901 into aws-controllers-k8s:main Apr 23, 2024
ack-prow bot pushed a commit that referenced this pull request Apr 23, 2024
**Description:**
This PR corrects a small mistake made in [this PR](#136). 

**Acknowledgement:**
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants