Skip to content

Commit

Permalink
Add vpc and architectures option to the creation of lambda from source (
Browse files Browse the repository at this point in the history
#4723)

* add config option to CreateFunctionFromSource

Signed-off-by: nnnkkk7 <[email protected]>

* preallocate the 'architectures' slice

Signed-off-by: nnnkkk7 <[email protected]>
Co-authored-by: Khanh Tran <[email protected]>

---------

Signed-off-by: nnnkkk7 <[email protected]>
Co-authored-by: Khanh Tran <[email protected]>
  • Loading branch information
nnnkkk7 and khanhtc1202 authored Dec 18, 2023
1 parent 847b578 commit c16bca3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/app/piped/platformprovider/lambda/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,24 @@ func (c *client) CreateFunctionFromSource(ctx context.Context, fm FunctionManife
Variables: fm.Spec.Environments,
},
}
if len(fm.Spec.Architectures) != 0 {
architectures := make([]types.Architecture, 0, len(fm.Spec.Architectures))
for _, arch := range fm.Spec.Architectures {
architectures = append(architectures, types.Architecture(arch.Name))
}
input.Architectures = architectures
}
if fm.Spec.EphemeralStorage != nil {
input.EphemeralStorage = &types.EphemeralStorage{
Size: aws.Int32(fm.Spec.EphemeralStorage.Size),
}
}
if fm.Spec.VPCConfig != nil {
input.VpcConfig = &types.VpcConfig{
SecurityGroupIds: fm.Spec.VPCConfig.SecurityGroupIDs,
SubnetIds: fm.Spec.VPCConfig.SubnetIDs,
}
}
_, err = c.client.CreateFunction(ctx, input)
if err != nil {
return fmt.Errorf("failed to create Lambda function %s: %w", fm.Spec.Name, err)
Expand Down

0 comments on commit c16bca3

Please sign in to comment.