func parseFlags() *stage1commontypes.RuntimePod { rp := stage1commontypes.RuntimePod{} flag.BoolVar(&debug, "debug", false, "Run in debug mode") flag.BoolVar(&interactive, "interactive", false, "The pod is interactive") flag.StringVar(&localConfig, "local-config", common.DefaultLocalConfigDir, "Local config path") // These flags are persisted in the PodRuntime flag.BoolVar(&rp.Mutable, "mutable", false, "Enable mutable operations on this pod, including starting an empty one") flag.Var(&rp.NetList, "net", "Setup networking") flag.StringVar(&rp.PrivateUsers, "private-users", "", "Run within user namespace. Can be set to [=UIDBASE[:NUIDS]]") flag.StringVar(&rp.MDSToken, "mds-token", "", "MDS auth token") flag.StringVar(&rp.Hostname, "hostname", "", "Hostname of the pod") flag.BoolVar(&rp.InsecureOptions.DisableCapabilities, "disable-capabilities-restriction", false, "Disable capability restrictions") flag.BoolVar(&rp.InsecureOptions.DisablePaths, "disable-paths", false, "Disable paths restrictions") flag.BoolVar(&rp.InsecureOptions.DisableSeccomp, "disable-seccomp", false, "Disable seccomp restrictions") dnsConfMode := pkgflag.MustNewPairList(map[string][]string{ "resolv": {"host", "stage0", "none", "default"}, "hosts": {"host", "stage0", "default"}, }, map[string]string{ "resolv": "default", "hosts": "default", }) flag.Var(dnsConfMode, "dns-conf-mode", "DNS config file modes") flag.Parse() rp.Debug = debug rp.ResolvConfMode = dnsConfMode.Pairs["resolv"] rp.EtcHostsMode = dnsConfMode.Pairs["hosts"] return &rp }
func parseFlags() *stage1commontypes.RuntimePod { rp := stage1commontypes.RuntimePod{} flag.BoolVar(&debug, "debug", false, "Run in debug mode") // The following flags need to be supported by stage1 according to // https://github.com/coreos/rkt/blob/master/Documentation/devel/stage1-implementors-guide.md // Most of them are ignored // These are ignored, but stage0 always passes them flag.Var(&discardNetlist, "net", "Setup networking") flag.StringVar(&discardString, "local-config", common.DefaultLocalConfigDir, "Local config path") // These are discarded with a warning // TODO either implement these, or stop passing them flag.Bool("interactive", true, "The pod is interactive (ignored, always true)") flag.Var(pkgflag.NewDiscardFlag("mds-token"), "mds-token", "MDS auth token (not implemented)") flag.Var(pkgflag.NewDiscardFlag("hostname"), "hostname", "Set hostname (not implemented)") flag.Bool("disable-capabilities-restriction", true, "ignored") flag.Bool("disable-paths", true, "ignored") flag.Bool("disable-seccomp", true, "ignored") dnsConfMode := pkgflag.MustNewPairList(map[string][]string{ "resolv": {"host", "stage0", "none", "default"}, "hosts": {"host", "stage0", "default"}, }, map[string]string{ "resolv": "default", "hosts": "default", }) flag.Var(dnsConfMode, "dns-conf-mode", "DNS config file modes") flag.Parse() rp.Debug = debug rp.ResolvConfMode = dnsConfMode.Pairs["resolv"] rp.EtcHostsMode = dnsConfMode.Pairs["hosts"] return &rp }