-
Notifications
You must be signed in to change notification settings - Fork 208
Lambda cloud provider #1347
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
Lambda cloud provider #1347
Conversation
pipecd-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // The Amazon Resource Name (ARN) of the function's execution role. | ||
| Role string `json:"role"` | ||
| // Path to the shared credentials file. | ||
| // | ||
| // Piped 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 | ||
| // - AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY | ||
| // 2. from the given credentials file. | ||
| // 3. from the EC2 Instance Role | ||
| CredentialsFile string `json:"credentialsFile"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rfc] not sure this Role configuration should be part of CloudProviderLambdaConfig or FunctionManifest. In my opinion, one lambda cloud provider should strict Role and CredentialsFile config at the same place (since they both for authorization purpose) 👀 What do you think? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FunctionManifest means the configuration of kind: LambdaFunction in the config-repo?
If so, I think it should keep in the PiepdConfig as is because this should be configured by a Piped operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FunctionManifest means the configuration of kind: LambdaFunction in the config-repo?
Yes, it is 👍
| return FunctionManifest{}, err | ||
| } | ||
|
|
||
| imageURI, ok, err := unstructured.NestedString(obj.Object, "spec", "template", "spec", "image") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why we should still use this unstructured package to parse the manifest.
We can parse it directly from the YAML by updating the manifest struct to be like
https://github.com/kubernetes/api/blob/master/apps/v1/types.go#L254-L262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of keep nested struct as the current sample function.yaml we need to define all sub struct to be able to unmarshal yaml content into FunctionManifest struct, I think it the cons 😅
Should we simplify the current LambdaFunction manifest 👀
apiVersion: pipecd.dev/v1beta1
kind: LambdaFunction
metadata:
name: SimpleFunction
spec:
template:
metadata:
tags:
app: simple
spec:
image: ecr.ap-northeast-1.amazonaws.com/lambda-test:v0.0.1There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think we can simplify it. (Just follow our convention in the config package, not Kubernetes')
apiVersion: pipecd.dev/v1beta1
kind: LambdaFunction
spec:
name: SimpleFunction
image: ecr.ap-northeast-1.amazonaws.com/lambda-test:v0.0.1
tags:
app: simpleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thank you 👍
pipecd-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| const ( | ||
| versionV1Beta1 = "pipecd.dev/v1beta1" | ||
| FunctionManifestKind = "LambdaFunction" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do we need to expose this variable?
| return nil | ||
| } | ||
|
|
||
| func loadFunctionManifest(path string) (FunctionManifest, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some tests for this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I forgot to commit that 🙏 actually, I wrote tests for the parseFunctionManifest instead 👀
|
Code coverage for golang is |
| // FunctionManifestSpec contains configuration for LambdaFunction. | ||
| type FunctionManifestSpec struct { | ||
| Name string `json:"name"` | ||
| ImageURI string `json:"image"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be more appropriate to replace it with ImageRef that clearly represents a specific image that has a unique digest. But it's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that name may confuse ( overlap with #1358 ImageRef struct ), besides this name specific exactly what I want to be given from here ( the URI to image on ecr registry ) so I think it's good for me 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, no objection to that 👍
|
/lgtm |
|
/approve |
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: