mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(lambda): expose the executing version on cold launches (#5523)
* fix(lambda): expose the executing version on cold launches Signed-off-by: Andre Kurait <akurait@amazon.com> * fix(lambda): propagate executing version to Kubernetes pods Signed-off-by: Andre Kurait <akurait@amazon.com> --------- Signed-off-by: Andre Kurait <akurait@amazon.com>
This commit is contained in:
1 parent
431748f740
commit
8565ad837a
6 files changed
+82
-4
No files matched your search
+3
-1
@@ -224,7 +224,6 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
env.add("AWS_LAMBDA_FUNCTION_NAME=" + fn.getFunctionName());
|
||||
env.add("AWS_LAMBDA_FUNCTION_MEMORY_SIZE=" + fn.getMemorySize());
|
||||
env.add("AWS_LAMBDA_FUNCTION_TIMEOUT=" + fn.getTimeout());
|
||||
env.add("AWS_LAMBDA_FUNCTION_VERSION=$LATEST");
|
||||
env.add("AWS_LAMBDA_LOG_GROUP_NAME=" + cwLogGroup);
|
||||
env.add("AWS_LAMBDA_LOG_STREAM_NAME=" + cwLogStream);
|
||||
if (fn.getHandler() != null && !fn.getHandler().isBlank()) {
|
||||
@@ -261,6 +260,9 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
});
|
||||
}
|
||||
|
||||
env.removeIf(value -> value.startsWith("AWS_LAMBDA_FUNCTION_VERSION="));
|
||||
env.add("AWS_LAMBDA_FUNCTION_VERSION=" + fn.getVersion());
|
||||
|
||||
ContainerBuilder.Builder specBuilder = containerBuilder.newContainer(image)
|
||||
.withName(containerName)
|
||||
.withEnv(env)
|
||||
|
||||
+5
-1
@@ -158,6 +158,8 @@ public class KubernetesPodLauncher implements LambdaRuntimeLauncher {
|
||||
LOG.infov("Launching pod for function: {0}", fn.getFunctionName());
|
||||
|
||||
RuntimeApiServer runtimeApiServer = runtimeApiServerFactory.create();
|
||||
runtimeApiServer.setFunctionMetadata(fn.getFunctionName(), fn.getVersion(), fn.getHandler(),
|
||||
fn.getAccountId());
|
||||
|
||||
// Mirrors ContainerLauncher: any failure after the runtime-api server is allocated
|
||||
// must release its port and delete a half-created pod, or cold-start bursts leak
|
||||
@@ -186,7 +188,6 @@ public class KubernetesPodLauncher implements LambdaRuntimeLauncher {
|
||||
env.add("AWS_LAMBDA_FUNCTION_NAME=" + fn.getFunctionName());
|
||||
env.add("AWS_LAMBDA_FUNCTION_MEMORY_SIZE=" + fn.getMemorySize());
|
||||
env.add("AWS_LAMBDA_FUNCTION_TIMEOUT=" + fn.getTimeout());
|
||||
env.add("AWS_LAMBDA_FUNCTION_VERSION=$LATEST");
|
||||
env.add("AWS_LAMBDA_LOG_GROUP_NAME=" + cwLogGroup);
|
||||
env.add("AWS_LAMBDA_LOG_STREAM_NAME=" + cwLogStream);
|
||||
if (fn.getHandler() != null && !fn.getHandler().isBlank()) {
|
||||
@@ -208,6 +209,9 @@ public class KubernetesPodLauncher implements LambdaRuntimeLauncher {
|
||||
});
|
||||
}
|
||||
|
||||
env.removeIf(value -> value.startsWith("AWS_LAMBDA_FUNCTION_VERSION="));
|
||||
env.add("AWS_LAMBDA_FUNCTION_VERSION=" + fn.getVersion());
|
||||
|
||||
LambdaPodSpecFactory.ImageConfig imageConfig = imagePackage
|
||||
? new LambdaPodSpecFactory.ImageConfig(fn.getImageConfigEntryPoint(),
|
||||
fn.getImageConfigCommand(), fn.getImageConfigWorkingDirectory())
|
||||
|
||||
Reference in new issue
Block a user