app: Use longhorn manager cmd to find customized default setting then verify it
@@ -27,6 +27,9 @@ const (
FlagManagerImage = "manager-image"
FlagServiceAccount = "service-account"
FlagKubeConfig = "kube-config"
+ FlagDefaultSettingPath = "default-setting-path"
+
+ EnvDefaultSettingPath = "DEFAULT_SETTING_PATH"
)
func DaemonCmd() cli.Command {
@@ -49,6 +52,11 @@ func DaemonCmd() cli.Command {
Name: FlagKubeConfig,
Usage: "Specify path to kube config (optional)",
},
+ cli.StringFlag{
+ Name: FlagDefaultSettingPath,
+ Usage: "Specify path to customized default setting",
+ EnvVar: EnvDefaultSettingPath,
+ },
},
Action: func(c *cli.Context) {
if err := startManager(c); err != nil {
@@ -78,12 +86,20 @@ func startManager(c *cli.Context) error {
}
kubeconfigPath := c.String(FlagKubeConfig)
+ defaultSettingPath := c.String(FlagDefaultSettingPath)
+
if err := environmentCheck(); err != nil {
logrus.Errorf("Failed environment check, please make sure you " +
"have iscsiadm/open-iscsi installed on the host")
return fmt.Errorf("Environment check failed: %v", err)
}
+ if defaultSettingPath != "" {
+ if _, err := os.Stat(defaultSettingPath); err != nil {
+ return fmt.Errorf("Cannot find customized default setting file on %v: %v", defaultSettingPath, err)
+ }
+ }
+
currentNodeID, err := util.GetRequiredEnv(types.EnvNodeName)
if err != nil {
return fmt.Errorf("BUG: fail to detect the node name")
