Added support to set builder and fn pod specs via helm chart (#2461)

The users can now set the pod spec for builder and fn pods via helm chart.
Currently we have set some default securitycontext for the pods. Before there were no permissions set and the user would by default enter root when kubectl exec into pod. Now the permissions have been set and the user will not be able to access root directory in poolmgr and newdeploy pods.
This commit is contained in:
Ankit Chawla
2022-06-27 16:52:28 +05:30
committed by GitHub
parent 21ea35b02a
commit 473acc4e2b
18 changed files with 287 additions and 8 deletions
+14 -2
View File
@@ -28,6 +28,7 @@ import (
"github.com/dchest/uniuri"
"github.com/pkg/errors"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
k8sInformers "k8s.io/client-go/informers"
k8sCache "k8s.io/client-go/tools/cache"
@@ -270,6 +271,17 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
executorInstanceID := strings.ToLower(uniuri.NewLen(8))
var podSpecPatch *apiv1.PodSpec
namespace, err := utils.GetCurrentNamespace()
if err != nil {
logger.Warn("Current namespace not found %s", zap.Error(err))
} else {
podSpecPatch, err = util.GetSpecFromConfigMap(ctx, kubernetesClient, fv1.RuntimePodSpecConfigmap, namespace)
if err != nil {
logger.Warn("Either configmap is not found or error reading data %v", zap.Error(err))
}
}
logger.Info("Starting executor", zap.String("instanceID", executorInstanceID))
informerFactory := genInformer.NewSharedInformerFactory(fissionClient, time.Minute*30)
@@ -288,7 +300,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient, metricsClient,
functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, pkgInformer, envInformer,
gpmPodInformer, gpmRsInformer)
gpmPodInformer, gpmRsInformer, podSpecPatch)
if err != nil {
return errors.Wrap(err, "pool manager creation failed")
}
@@ -304,7 +316,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient,
functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, envInformer,
ndmDeplInformer, ndmSvcInformer)
ndmDeplInformer, ndmSvcInformer, podSpecPatch)
if err != nil {
return errors.Wrap(err, "new deploy manager creation failed")
}