Ensure CSI is initialized properly when running agent and server combined

This commit is contained in:
Darren Shepherd 2019-04-08 10:54:59 -07:00
parent 3c7e103085
commit 841f8d29e6

View File

@ -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