Skip to content

Commit f9745d3

Browse files
authored
Merge pull request #754 from cdoern/domainname
generate: add support for domainname
2 parents 17b3287 + e972318 commit f9745d3

File tree

9 files changed

+136
-28
lines changed

9 files changed

+136
-28
lines changed

cmd/oci-runtime-tool/generate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
var generateFlags = []cli.Flag{
2222
cli.StringSliceFlag{Name: "args", Usage: "command to run in the container"},
23+
cli.StringFlag{Name: "domainname", Usage: "domainname value for the container"},
2324
cli.StringSliceFlag{Name: "env", Usage: "add environment variable e.g. key=value"},
2425
cli.StringSliceFlag{Name: "env-file", Usage: "read in a file of environment variables"},
2526
cli.StringSliceFlag{Name: "hooks-poststart-add", Usage: "set command to run in poststart hooks"},
@@ -207,6 +208,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
207208
g.SetHostname(context.String("hostname"))
208209
}
209210

211+
if context.IsSet("domainname") {
212+
g.SetDomainName(context.String("domainname"))
213+
}
214+
210215
if context.IsSet("oci-version") {
211216
g.SetOCIVersion(context.String("oci-version"))
212217
}

completions/bash/oci-runtime-tool

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ _oci-runtime-tool_help() {
307307
_oci-runtime-tool_generate() {
308308
local options_with_args="
309309
--args
310+
--domainname
310311
--env
311312
--env-file
312313
--hooks-poststart-add

generate/generate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,12 @@ func (g *Generator) SetDefaultSeccompActionForce(action string) error {
16211621
return seccomp.ParseDefaultActionForce(action, g.Config.Linux.Seccomp)
16221622
}
16231623

1624+
// SetDomainName sets g.Config.Domainname
1625+
func (g *Generator) SetDomainName(domain string) {
1626+
g.initConfig()
1627+
g.Config.Domainname = domain
1628+
}
1629+
16241630
// SetSeccompArchitecture sets the supported seccomp architectures
16251631
func (g *Generator) SetSeccompArchitecture(architecture string) error {
16261632
g.initConfigLinuxSeccomp()

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/hashicorp/go-multierror v1.1.1
99
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b
1010
github.com/mrunalp/fileutils v0.5.0
11-
github.com/opencontainers/runtime-spec v1.0.3-0.20201121164853-7413a7f753e1
11+
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
1212
github.com/opencontainers/selinux v1.9.1
1313
github.com/sirupsen/logrus v1.8.1
1414
github.com/stretchr/testify v1.3.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b h1:Ga1nclDSe8gOw37MV
1313
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs=
1414
github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
1515
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
16-
github.com/opencontainers/runtime-spec v1.0.3-0.20201121164853-7413a7f753e1 h1:UAfI7SOCo1CNIu3RevW9B4HQyf7SY5aSzcSeoC7OPs0=
17-
github.com/opencontainers/runtime-spec v1.0.3-0.20201121164853-7413a7f753e1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
16+
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb h1:1xSVPOd7/UA+39/hXEGnBJ13p6JFB0E1EvQFlrRDOXI=
17+
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
1818
github.com/opencontainers/selinux v1.9.1 h1:b4VPEF3O5JLZgdTDBmGepaaIbAo0GqoF6EBRq5f/g3Y=
1919
github.com/opencontainers/selinux v1.9.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
2020
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

man/oci-runtime-tool-generate.1.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ read the configuration from `config.json`.
2222

2323
--args "/usr/bin/httpd" --args "-D" --args "FOREGROUND"
2424

25+
**--domainname**
26+
Set the container domain name that is available inside the container.
27+
28+
2529
**--env**=[]
2630
Set environment variables e.g. key=value.
2731
This option allows you to specify arbitrary environment variables

vendor/github.com/opencontainers/runtime-spec/specs-go/config.go

Lines changed: 91 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/opencontainers/runtime-spec/specs-go/state.go

Lines changed: 25 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ github.com/mndrix/tap-go
1717
# github.com/mrunalp/fileutils v0.5.0
1818
## explicit
1919
github.com/mrunalp/fileutils
20-
# github.com/opencontainers/runtime-spec v1.0.3-0.20201121164853-7413a7f753e1
20+
# github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
2121
## explicit
2222
github.com/opencontainers/runtime-spec/specs-go
2323
# github.com/opencontainers/selinux v1.9.1

0 commit comments

Comments
 (0)