Add validation/mutating webhook server for Fission custom resources (#2608)

* add webhook server
* add metrics port
* Add self-signed cert generation in helm chart for webhooks (#2611)
* remove cert-manager installation
* update fission webhook charts
* remove extra cluster role
* add mutating webhook for pkg creation
* Service name and bundle fixes (#2614)
* caBundle templating
* Rename fission.svc to fission-webhook.svc
* update package build status

Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
This commit is contained in:
neha_gupta
2022-11-13 17:31:31 +05:30
committed by GitHub
co-authored by shaunak_deshmukh
parent 31dfc3e4d3
commit 9a07d7d96b
23 changed files with 1181 additions and 3 deletions
+16 -2
View File
@@ -24,9 +24,8 @@ import (
"strconv"
docopt "github.com/docopt/docopt-go"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"go.uber.org/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"github.com/fission/fission/cmd/fission-bundle/mqtrigger"
"github.com/fission/fission/pkg/buildermgr"
@@ -42,8 +41,14 @@ import (
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/profile"
"github.com/fission/fission/pkg/webhook"
)
// runWebhook starts admission webhook server
func runWebhook(ctx context.Context, logger *zap.Logger, port int) error {
return webhook.Start(ctx, logger, port)
}
func runController(ctx context.Context, logger *zap.Logger, port int) {
controller.Start(ctx, logger, port, false)
}
@@ -176,10 +181,12 @@ Usage:
fission-bundle --timer [--routerUrl=<url>]
fission-bundle --mqt [--routerUrl=<url>]
fission-bundle --mqt_keda [--routerUrl=<url>]
fission-bundle --webhookPort=<port>
fission-bundle --logger
fission-bundle --version
Options:
--controllerPort=<port> Port that the controller should listen on.
--webhookPort=<port> Port that the webhook should listen on.
--routerPort=<port> Port that the router should listen on.
--executorPort=<port> Port that the executor should listen on.
--storageServicePort=<port> Port that the storage service should listen on.
@@ -225,6 +232,13 @@ Options:
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
if arguments["--webhookPort"] != nil {
port := getPort(logger, arguments["--webhookPort"])
err = runWebhook(ctx, logger, port)
logger.Error("webhook server exited:", zap.Error(err))
return
}
if arguments["--controllerPort"] != nil {
port := getPort(logger, arguments["--controllerPort"])
runController(ctx, logger, port)