Remove unwanted permissions from Fission components (#2568)
* Remove unwanted permissions from Fission components
* Remove unwanted permission from buildermgr
* Remove rbac permissions from controller
* Remove unwanted namespace permission
* Remove unwanted fission resource permissions
* Add deployment list permission for buildermgr
* add deployment create permission for buildermgr
* Update action version
* Add rolebinding permission for buildermanager
* Reduce permissions for fetcher and builder components
* Aded deployment delete permission to buildermgr
* Add logger to wait crds function
* Revert "Grant CustomResourcedefintion read permission to specific components (#2567)"
This reverts commit 8fe62b755c.
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -42,7 +42,7 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string, envBui
|
||||
return errors.Wrap(err, "failed to get fission or kubernetes client")
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ func (envw *environmentWatcher) createBuilderDeployment(ctx context.Context, env
|
||||
},
|
||||
Spec: apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-builder",
|
||||
ServiceAccountName: fv1.FissionBuilderSA,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func Start(ctx context.Context, logger *zap.Logger, port int, unitTestFlag bool)
|
||||
cLogger.Fatal("failed to find fission CRDs", zap.Error(err))
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fc)
|
||||
err = crd.WaitForCRDs(ctx, logger, fc)
|
||||
if err != nil {
|
||||
cLogger.Fatal("error waiting for CRDs", zap.Error(err))
|
||||
}
|
||||
|
||||
+3
-1
@@ -22,6 +22,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/dynamic"
|
||||
@@ -88,7 +89,8 @@ func MakeFissionClient() (versioned.Interface, kubernetes.Interface, apiextensio
|
||||
}
|
||||
|
||||
// WaitForCRDs does a timeout to check if CRDs have been installed
|
||||
func WaitForCRDs(ctx context.Context, fissionClient versioned.Interface) error {
|
||||
func WaitForCRDs(ctx context.Context, logger *zap.Logger, fissionClient versioned.Interface) error {
|
||||
logger.Info("Waiting for CRDs to be installed")
|
||||
start := time.Now()
|
||||
for {
|
||||
fi := fissionClient.CoreV1().Functions(metav1.NamespaceDefault)
|
||||
|
||||
@@ -259,7 +259,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
|
||||
return errors.Wrap(err, "failed to get kubernetes client")
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ func TestExecutor(t *testing.T) {
|
||||
log.Panicf("failed to ensure crds: %v", err)
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
log.Panicf("failed to wait crds: %v", err)
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ func (deploy *NewDeploy) getDeploymentSpec(ctx context.Context, fn *fv1.Function
|
||||
},
|
||||
Spec: apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-fetcher",
|
||||
ServiceAccountName: fv1.FissionFetcherSA,
|
||||
TerminationGracePeriodSeconds: &gracePeriodSeconds,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ func (gp *GenericPool) genDeploymentSpec(env *fv1.Environment) (*appsv1.Deployme
|
||||
},
|
||||
Spec: apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-fetcher",
|
||||
ServiceAccountName: fv1.FissionFetcherSA,
|
||||
// TerminationGracePeriodSeconds should be equal to the
|
||||
// sleep time of preStop to make sure that SIGTERM is sent
|
||||
// to pod after 6 mins.
|
||||
|
||||
@@ -32,7 +32,7 @@ func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
||||
return errors.Wrap(err, "failed to get fission or kubernetes client")
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ func StartScalerManager(ctx context.Context, logger *zap.Logger, routerURL strin
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func Start(ctx context.Context, logger *zap.Logger, port int, executorURL string
|
||||
logger.Fatal("error connecting to kubernetes API", zap.Error(err))
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
logger.Fatal("error waiting for CRDs", zap.Error(err))
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
||||
return errors.Wrap(err, "failed to get fission or kubernetes client")
|
||||
}
|
||||
|
||||
err = crd.WaitForCRDs(ctx, fissionClient)
|
||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user