Skip to content

Commit

Permalink
Merge pull request #683 from jhowardmsft/jjh/windowsdefaults
Browse files Browse the repository at this point in the history
Windows: Typos and incorrect defaults
  • Loading branch information
Zhou Hao authored Mar 5, 2019
2 parents 5ed6852 + 3bc60a4 commit bcea291
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
9 changes: 7 additions & 2 deletions cmd/oci-runtime-tool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ var generateFlags = []cli.Flag{
cli.BoolFlag{Name: "windows-ignore-flushes-during-boot", Usage: "ignore flushes during boot"},
cli.StringSliceFlag{Name: "windows-layer-folders", Usage: "specifies a list of layer folders the container image relies on"},
cli.StringFlag{Name: "windows-network", Usage: "specifies network for container"},
cli.BoolFlag{Name: "windows-network-allowunqualifieddnsquery", Usage: "specifies networking unqualified DNS query is allowed"},
cli.StringFlag{Name: "windows-network-networkNamespace", Usage: "specifies network namespace for container"},
cli.StringFlag{Name: "windows-resources-cpu", Usage: "specifies CPU for container"},
cli.Uint64Flag{Name: "windows-resources-memory-limit", Usage: "specifies limit of memory"},
Expand Down Expand Up @@ -940,7 +941,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
}

if context.IsSet("windows-ignore-flushes-during-boot") {
g.SetWinodwsIgnoreFlushesDuringBoot(context.Bool("windows-ignore-flushes-during-boot"))
g.SetWindowsIgnoreFlushesDuringBoot(context.Bool("windows-ignore-flushes-during-boot"))
}

if context.IsSet("windows-layer-folders") {
Expand Down Expand Up @@ -972,6 +973,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
g.SetWindowsNetwork(tmpNetwork)
}

if context.IsSet("windows-network-allowunqualifieddnsquery") {
g.SetWindowsNetworkAllowUnqualifiedDNSQuery(context.Bool("windows-network-allowunqualifieddnsquery"))
}

if context.IsSet("windows-network-networkNamespace") {
g.SetWindowsNetworkNamespace(context.String("windows-network-networkNamespace"))
}
Expand Down Expand Up @@ -1000,7 +1005,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
}

if context.IsSet("windows-servicing") {
g.SetWinodwsServicing(context.Bool("windows-servicing"))
g.SetWindowsServicing(context.Bool("windows-servicing"))
}

err := addSeccomp(context, g)
Expand Down
1 change: 1 addition & 0 deletions completions/bash/oci-runtime-tool
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ _oci-runtime-tool_generate() {
--process-terminal
--rootfs-readonly
--windows-ignore-flushes-during-boot
--windows-network-allowunqualifieddnsquery
--windows-servicing
"

Expand Down
25 changes: 11 additions & 14 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,8 @@ func New(os string) (generator Generator, err error) {
"cmd",
},
Cwd: `C:\`,
ConsoleSize: &rspec.Box{
Width: 80,
Height: 20,
},
}
config.Windows = &rspec.Windows{
IgnoreFlushesDuringBoot: true,
Network: &rspec.WindowsNetwork{
AllowUnqualifiedDNSQuery: true,
},
}
config.Windows = &rspec.Windows{}
} else {
config.Root = &rspec.Root{
Path: "rootfs",
Expand Down Expand Up @@ -1712,8 +1703,8 @@ func (g *Generator) SetWindowsHypervUntilityVMPath(path string) {
g.Config.Windows.HyperV.UtilityVMPath = path
}

// SetWinodwsIgnoreFlushesDuringBoot sets g.Config.Winodws.IgnoreFlushesDuringBoot.
func (g *Generator) SetWinodwsIgnoreFlushesDuringBoot(ignore bool) {
// SetWindowsIgnoreFlushesDuringBoot sets g.Config.Windows.IgnoreFlushesDuringBoot.
func (g *Generator) SetWindowsIgnoreFlushesDuringBoot(ignore bool) {
g.initConfigWindows()
g.Config.Windows.IgnoreFlushesDuringBoot = ignore
}
Expand Down Expand Up @@ -1751,6 +1742,12 @@ func (g *Generator) SetWindowsNetwork(network rspec.WindowsNetwork) {
g.Config.Windows.Network = &network
}

// SetWindowsNetworkAllowUnqualifiedDNSQuery sets g.Config.Windows.Network.AllowUnqualifiedDNSQuery
func (g *Generator) SetWindowsNetworkAllowUnqualifiedDNSQuery(setting bool) {
g.initConfigWindowsNetwork()
g.Config.Windows.Network.AllowUnqualifiedDNSQuery = setting
}

// SetWindowsNetworkNamespace sets g.Config.Windows.Network.NetworkNamespace
func (g *Generator) SetWindowsNetworkNamespace(path string) {
g.initConfigWindowsNetwork()
Expand All @@ -1775,8 +1772,8 @@ func (g *Generator) SetWindowsResourcesStorage(storage rspec.WindowsStorageResou
g.Config.Windows.Resources.Storage = &storage
}

// SetWinodwsServicing sets g.Config.Winodws.Servicing.
func (g *Generator) SetWinodwsServicing(servicing bool) {
// SetWindowsServicing sets g.Config.Windows.Servicing.
func (g *Generator) SetWindowsServicing(servicing bool) {
g.initConfigWindows()
g.Config.Windows.Servicing = servicing
}
3 changes: 3 additions & 0 deletions man/oci-runtime-tool-generate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ read the configuration from `config.json`.
Specifies network for container.
e.g. --windows-network='{"endpointList": ["7a010682-17e0-4455-a838-02e5d9655fe6"],"allowUnqualifiedDNSQuery": true,"DNSSearchList": ["a.com"],"networkSharedContainerName": "containerName", "networkNamespace" : "15010682-17e0-4455-a838-02e5d9655f00"}'

**--windows-network-allowunqualifieddnsquery**=true|false
Whether to allow unqualified DNS queries

**--windows-network-networkNamespace**=""
Specified the network namespace for the container
e.g. --windows-network-networkNamespace '15010682-17e0-4455-a838-02e5d9655f00'
Expand Down

0 comments on commit bcea291

Please sign in to comment.