Skip to content

Conversation

@khanhtc1202
Copy link
Member

@khanhtc1202 khanhtc1202 commented Jan 21, 2021

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.94%. This pull request decreases coverage by -0.53%.

File Function Base Head Diff
pkg/app/piped/cloudprovider/lambda/client.go percentageToPercent -- 0.00% +0.00%
pkg/app/piped/executor/lambda/deploy.go deployExecutor.Execute -- 0.00% +0.00%
pkg/app/piped/executor/lambda/deploy.go deployExecutor.ensureSync -- 0.00% +0.00%
pkg/app/piped/executor/lambda/deploy.go deployExecutor.ensurePromote -- 0.00% +0.00%
pkg/app/piped/executor/lambda/deploy.go deployExecutor.ensureRollout -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go Register -- 80.00% +80.00%
pkg/app/piped/executor/lambda/lambda.go findCloudProvider -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go loadFunctionManifest -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go sync -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go rollout -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go promote -- 0.00% +0.00%
pkg/app/piped/executor/lambda/lambda.go configureTrafficRouting -- 100.00% +100.00%
pkg/app/piped/executor/lambda/lambda.go build -- 0.00% +0.00%
pkg/app/piped/cloudprovider/lambda/client.go client.GetTrafficConfig 0.00% 0.00% +0.00%
pkg/app/piped/cloudprovider/lambda/client.go client.UpdateTrafficConfig 0.00% 0.00% +0.00%
pkg/config/deployment.go PipelineStage.UnmarshalJSON 45.90% 43.75% -2.15%

### Configuring Lambda cloud provider
> TBA
Adding a Lambda provider requires the region name where Lambda service is running. For authorization, the piped agent gets the credential information from environment variables by default or from a credential file provided via the below `credentialsFile` value.
Copy link
Member

Choose a reason for hiding this comment

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

Looks like it eventually uses EC2 Instance Role if both environment variables and credential files aren't given. So it's kinder to mention that. (especially as using EC2 Instance Role is highly recommended at our company) And for those who use IAM, it would be nice to show which IAM policy permission is required.

Besides, now the credential chain is a little bit obscure. Hence it would be also cool to be more clear because Piped provides multiple methods of loading credentials.

https://github.com/pipe-cd/pipe/blob/3207f5b54144d1a4d6cc43aef5ded6f4138a3e51/pkg/app/piped/cloudprovider/lambda/client.go#L64-L75

Copy link
Member

Choose a reason for hiding this comment

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

So, I'd show you example documents for that. You can ignore this and/or partly refer if needed.


You will generally need your AWS credentials to authenticate with Lambda. Piped provides multiple methods of loading these credentials.
It attempts to retrieve credentials in the following order:

  1. From the environment variables. Available environment variables are AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY
  2. From the given credentials file.
  3. From the EC2 Instance Role

Therefore, you don't have to set credentialsFile if you use the environment variables or the EC2 Instance Role. Keep in mind the IAM role/user that you use with your Piped must possess the IAM policy permission for lambda:GetAccountSettings and lambda:ListFunctions and...

Copy link
Member

Choose a reason for hiding this comment

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

This is honestly a modified version of ECR document already deleted 🤣

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice 😂 I will use it 🙏

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The following files are not gofmt-ed. By commenting /golinter fmt, the formatted one will be appended to this pull request automatically.

pkg/app/piped/executor/lambda/lambda_test.go
--- pkg/app/piped/executor/lambda/lambda_test.go.orig
+++ pkg/app/piped/executor/lambda/lambda_test.go
@@ -17,8 +17,9 @@
 import (
 	"testing"
 
-	provider "github.com/pipe-cd/pipe/pkg/app/piped/cloudprovider/lambda"
 	"github.com/stretchr/testify/assert"
+
+	provider "github.com/pipe-cd/pipe/pkg/app/piped/cloudprovider/lambda"
 )
 
 func TestConfigureTrafficRouting(t *testing.T) {

@khanhtc1202 khanhtc1202 force-pushed the lambda-deployment-docs branch from 4061574 to 5065aa0 Compare January 22, 2021 06:20
@nakabonne
Copy link
Member

/lgtm

@nakabonne
Copy link
Member

Thank you!

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.58%. This pull request does not change code coverage.

@nghialv
Copy link
Member

nghialv commented Jan 22, 2021

Great!
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nghialv.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 9c403de into master Jan 22, 2021
@pipecd-bot pipecd-bot deleted the lambda-deployment-docs branch January 22, 2021 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants