Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

feat(lambda-function-url): URL releaser component #3187

Merged
merged 18 commits into from
May 6, 2022

Conversation

thiskevinwang
Copy link
Contributor

@thiskevinwang thiskevinwang commented Apr 7, 2022

Description

This is adds a lambda-function-url plugin (with Releaser component only) that leverages the new Lambda Function URLs.

This approach only releases a function URL for the unpublished Lambda function, and does not leverage URLs for aliases of specific function versions

Note, from AWS:

You can add a function URL only to the unpublished function version, or to an alias. To configure a function URL, go to the unpublished function page, or choose an alias from the Aliases tab.

This leaves the CORs configuration as a TODO for the near future.

Closes #3184

Usage

#...
  release {
    use "lambda-function-url" {
    }
  }
}

Screenshots

image

Waypoint UI

image

go.mod Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Looking good Kevin. I know this is still in draft, and it looks like there's some todos, but figured I'd drop a few comments as you work on it. Excited to see this land! 🎉

builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved
builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved
@thiskevinwang thiskevinwang force-pushed the kevin/lambda-function-url branch from de8dce4 to 5e4d743 Compare April 11, 2022 12:51
@thiskevinwang thiskevinwang changed the title WIP: lambda releaser w/ function url feat(aws-lambda): add releaser component Apr 13, 2022
@thiskevinwang thiskevinwang marked this pull request as ready for review April 13, 2022 13:52
@briancain briancain self-requested a review April 13, 2022 17:08
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Overall looks pretty great! Just a few comments and requests from me 👍🏻

builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved
builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved
builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved

// check the function url status
log.Info("Checking function url status...", "url", release.Url)
if resp, err := http.Get(release.Url); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Is there an AWS SDK function here we could use instead to validate the creation/existence of a lamba url instead of http.Get?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there's a healthcheck-like API for Lambda 🤔. (Makes sense the its ephemeral nature)

  1. I'm now realizing that AWS_IAM auth type would cause this unsigned http.Get to be return a 503
    Maybe
  2. Maybe wait or invoke are viable options...

Copy link
Member

Choose a reason for hiding this comment

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

Does the lambda get-function help at all? I don't know if it has any kind of health or status in the return response. Otherwise yeah maybe the way to go is an http.Get. Might be another good question to ask the team this week and see what they say.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get-function doesn't return any useful status information. I'll shoot a message to the Waypoint team slack for some opinions!

builtin/aws/lambda/releaser.go Outdated Show resolved Hide resolved
@thiskevinwang thiskevinwang changed the title feat(aws-lambda): add releaser component feat(aws-lambda): add URL releaser component Apr 16, 2022
@thiskevinwang thiskevinwang requested a review from briancain April 18, 2022 21:31
@thiskevinwang thiskevinwang force-pushed the kevin/lambda-function-url branch from 74995be to a059506 Compare April 22, 2022 23:39
@thiskevinwang
Copy link
Contributor Author

@evanphx Moved the releaser into a new plugin folder, and the usage is now as you suggested:

app "blah" {
   release {
      use "lambda-function-url" {
           ....
      }
  }
}

Copy link
Contributor

@evanphx evanphx left a comment

Choose a reason for hiding this comment

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

A couple minor things!

builtin/aws/lambda/function_url/releaser.go Outdated Show resolved Hide resolved
builtin/aws/lambda/function_url/releaser.go Outdated Show resolved Hide resolved
@thiskevinwang thiskevinwang requested a review from evanphx May 4, 2022 22:40
Copy link
Member

@briancain briancain 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 Kevin!! This looks great ✨

@evanphx evanphx merged commit 56fa792 into main May 6, 2022
@evanphx evanphx deleted the kevin/lambda-function-url branch May 6, 2022 22:13
@thiskevinwang thiskevinwang changed the title feat(aws-lambda): add URL releaser component feat(lambda-function-url): URL releaser component May 7, 2022
@thiskevinwang
Copy link
Contributor Author

thiskevinwang commented May 27, 2022

Hey @evanphx / @briancain belated question:

Is this PR's changes expected to be included in v0.8.x, or will it be available in the next v0.9.x minor line?

I spent an hour or so trying to debug why my remote runner (k8s) was responding with...

! 1 error occurred:
        * plugin "lambda-function-url" not found

...only to realize that this PR's changes weren't in the in the v0.8.2 release


Update:

I think I figured out how to update my server & runner with the latest code from main

waypoint server upgrade \
  -auto-approve \
  -k8s-server-image=ghcr.io/hashicorp/waypoint/alpha:02952e297 \
  -k8s-odr-image=ghcr.io/hashicorp/waypoint/alpha-odr:02952e297

@briancain
Copy link
Member

@thiskevinwang - looks like this pull request wasn't backported, so it didn't make it into the 0.8.2 release. We can post backport this PR now and it will go out in the next release. Sorry about that!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Support for AWS Lambda Function URLs
3 participants