-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor(aws-lambda): refactor aws-lambda plugin code with lua-resty-aws #11350
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ab3f7d4
refactor(aws-lambda): add lua-resty-aws library and libexpat dependen…
windmgc 641573a
refactor(aws-lambda): use lua-resty-aws and rewrite fetch credential
windmgc b024cf5
refactor(aws-lambda): refactor aws-lambda plugin
windmgc 1d6ce58
style(*): remove useless lua file
windmgc d3b6e06
fix(cd): fix explain manifest for libexpat
windmgc 4b01d1a
fix(cd): fix buildifier style
windmgc b9e5538
fix(*): try to fix lambda plugin init_worker
windmgc 3b9e667
fix(*): fix http proxy & sts regional endpoint config
windmgc e6efe72
fix(*): execute plugin init code correctly
windmgc 3859e19
fix(*): remove lambda returned content length
windmgc 5c62561
chore(*): move libexpat from cross_deps to standalone repo
windmgc 75f4c21
fix(*): do not override global config credential
windmgc c4b2f4f
chore(*): remove non-debug flag
windmgc 3867bfe
chore(*): bump lua-resty-aws version to 1.3.0
windmgc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
|
||
exports_files( | ||
[ | ||
"BUILD.libexpat.bazel", | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
build_test( | ||
name = "build", | ||
targets = [ | ||
"@libexpat//:libexpat", | ||
], | ||
visibility = ["//:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
load("@kong_bindings//:variables.bzl", "KONG_VAR") | ||
|
||
filegroup( | ||
name = "all_srcs", | ||
srcs = glob( | ||
include = ["**"], | ||
exclude = ["*.bazel"], | ||
), | ||
) | ||
|
||
configure_make( | ||
name = "libexpat", | ||
configure_command = "configure", | ||
configure_in_place = True, | ||
configure_options = [ | ||
# configure a miminal feature set at first so that we don't | ||
# end up depend to a lot of dependencies; do not when turning | ||
# on any of the feature below, we need to add it o kong package's | ||
# dependencies, and compile it (under build/cross_deps) for | ||
# cross build platforms | ||
"--enable-static=no", | ||
"--without-xmlwf", | ||
"--without-examples", | ||
"--without-docbook", | ||
] + select({ | ||
"@kong//:aarch64-linux-anylibc-cross": [ | ||
"--host=aarch64-linux", | ||
], | ||
"@kong//:x86_64-linux-musl-cross": [ | ||
"--host=x86_64-linux-musl", | ||
], | ||
"//conditions:default": [], | ||
}), | ||
env = select({ | ||
"@platforms//os:macos": { | ||
# don't use rule_foreign_cc's libtool as archiver as it seems to be a bug | ||
# see https://github.com/bazelbuild/rules_foreign_cc/issues/947 | ||
"AR": "/usr/bin/ar", | ||
}, | ||
"//conditions:default": {}, | ||
}), | ||
lib_source = ":all_srcs", | ||
# out_lib_dir = "lib", | ||
out_shared_libs = select({ | ||
"@platforms//os:macos": [ | ||
"libexpat.1.dylib", | ||
], | ||
"//conditions:default": [ | ||
"libexpat.so.1", | ||
], | ||
}), | ||
targets = [ | ||
"-j" + KONG_VAR["NPROC"], | ||
"install -j" + KONG_VAR["NPROC"], | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""A module defining the third party dependency OpenResty""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@kong_bindings//:variables.bzl", "KONG_VAR") | ||
|
||
def libexpat_repositories(): | ||
"""Defines the libexpat repository""" | ||
|
||
version = KONG_VAR["LIBEXPAT"] | ||
tag = "R_" + version.replace(".", "_") | ||
|
||
maybe( | ||
http_archive, | ||
name = "libexpat", | ||
url = "https://github.com/libexpat/libexpat/releases/download/" + tag + "/expat-" + version + ".tar.gz", | ||
sha256 = "6b902ab103843592be5e99504f846ec109c1abb692e85347587f237a4ffa1033", | ||
strip_prefix = "expat-" + version, | ||
build_file = "//build/libexpat:BUILD.libexpat.bazel", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@bungle I'm trying to add support for plugins executing their own code in the
init
phase, so that plugins can do things that may contain yield which cannot be done inside arequire
. I'm adding anexecute_plugin_init
function to achieve that. How do you feel about this? Is it a proper way or any advice?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.
my 2cts: in the "global patches", replace
require
with a pure-Lua version. Since this has been a recurring theme for a long time. That would solve a bunch of initialization problems due to "yield across C-boundary" issues.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.
#11177 (review)
Leaving a note here: this is the discussion on the same topic. Apparently needs some works to be done to achieve that. If we can achieve that it'll be a painkiller for the restriction of not able to do any yield-able thing in module level