From d2e9364e5e1a261009c96bcc3324bce5d81e4e9b Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 12 Feb 2020 09:29:27 +0800 Subject: [PATCH] Put package deploy archive to fix path (#1529) In some cases (#1384), users may want to access the file in the directory of deploy archive, however, we use the function UID name as the directory name and make it difficult for users to use as they don't know the real path of the directory. This PR uses the fix name "deployarchive" to make things easier. --- pkg/fetcher/config/config.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/fetcher/config/config.go b/pkg/fetcher/config/config.go index 9f76285b..e2823256 100644 --- a/pkg/fetcher/config/config.go +++ b/pkg/fetcher/config/config.go @@ -107,12 +107,18 @@ func (cfg *Config) SharedMountPath() string { } func (cfg *Config) NewSpecializeRequest(fn *fv1.Function, env *fv1.Environment) fetcher.FunctionSpecializeRequest { - // for backward compatibility, since most v1 env - // still try to load user function from hard coded - // path /userfunc/user targetFilename := "user" if env.Spec.Version >= 2 { - targetFilename = string(fn.ObjectMeta.UID) + if env.Spec.AllowedFunctionsPerContainer == fv1.AllowedFunctionsPerContainerInfinite { + // workflow loads multiple functions into one function pod, + // we have to use a Function UID to separate the function code + // to avoid overwritting. + targetFilename = string(fn.ObjectMeta.UID) + } else { + // set target file name to fix pattern for + // easy accessing. + targetFilename = "deployarchive" + } } return fetcher.FunctionSpecializeRequest{