Functions have access to secrets/configmaps specified by the user (#399)
This commit solves part of the issue #52 , functions are able to access secrets/configmaps specified by the user. For now, CLI only accept one secret/configmap. For advanced users, it will be able to use YAML to declare multiple secrets/configmaps in later changes.
This commit is contained in:
committed by
Ta-Ching Chen
parent
4cf195768e
commit
1eb0453ce4
@@ -67,7 +67,9 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
|
||||
Namespace: fn.Spec.Package.PackageRef.Namespace,
|
||||
Name: fn.Spec.Package.PackageRef.Name,
|
||||
},
|
||||
Filename: targetFilename,
|
||||
Filename: targetFilename,
|
||||
Secrets: fn.Spec.Secrets,
|
||||
ConfigMaps: fn.Spec.ConfigMaps,
|
||||
}
|
||||
|
||||
loadReq := fission.FunctionLoadRequest{
|
||||
@@ -136,6 +138,8 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
|
||||
Command: []string{"/fetcher", "-specialize-on-startup",
|
||||
"-fetch-request", string(fetchPayload),
|
||||
"-load-request", string(loadPayload),
|
||||
"-secret-dir", deploy.sharedSecretPath,
|
||||
"-cfgmap-dir", deploy.sharedCfgMapPath,
|
||||
deploy.sharedMountPath},
|
||||
Env: []apiv1.EnvVar{
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ type (
|
||||
fetcherImagePullPolicy apiv1.PullPolicy
|
||||
namespace string
|
||||
sharedMountPath string
|
||||
sharedSecretPath string
|
||||
sharedCfgMapPath string
|
||||
|
||||
fsCache *fscache.FunctionServiceCache // cache funcSvc's by function, address and podname
|
||||
requestChannel chan *fnRequest
|
||||
@@ -107,6 +109,8 @@ func MakeNewDeploy(
|
||||
fetcherImg: fetcherImg,
|
||||
fetcherImagePullPolicy: apiv1.PullIfNotPresent,
|
||||
sharedMountPath: "/userfunc",
|
||||
sharedSecretPath: "/secrets",
|
||||
sharedCfgMapPath: "/configs",
|
||||
|
||||
requestChannel: make(chan *fnRequest),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user