From 841f8d29e684cd8eac0b4de8a53f6f048e25416b Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 8 Apr 2019 10:54:59 -0700 Subject: [PATCH] Ensure CSI is initialized properly when running agent and server combined --- pkg/cli/server/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index 3be5dbfae4..fe0b086b63 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -20,6 +20,7 @@ import ( "github.com/sirupsen/logrus" "github.com/urfave/cli" "k8s.io/apimachinery/pkg/util/net" + "k8s.io/kubernetes/pkg/volume" _ "github.com/mattn/go-sqlite3" // ensure we have sqlite ) @@ -70,6 +71,9 @@ func run(app *cli.Context, cfg *cmds.Server) error { return fmt.Errorf("must run as root unless --disable-agent is specified") } + // If running agent in server, set this so that CSI initializes properly + volume.WaitForValidHost = !cfg.DisableAgent + serverConfig := server.Config{} serverConfig.ControlConfig.ClusterSecret = cfg.ClusterSecret serverConfig.ControlConfig.DataDir = cfg.DataDir