Skip to content

Commit 4ba8cde

Browse files
Inshal KhanRegis-Caelum
authored andcommitted
Add HostName to quadlet pod
update docs for hostname Signed-off-by: Inshal Khan <[email protected]>
1 parent 2a9b149 commit 4ba8cde

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

docs/source/markdown/podman-systemd.unit.5.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ Valid options for `[Pod]` are listed below:
989989
| DNSSearch=example.com | --dns-search example.com |
990990
| GIDMap=0:10000:10 | --gidmap=0:10000:10 |
991991
| GlobalArgs=--log-level=debug | --log-level=debug |
992+
| HostName=name | --hostname=name |
992993
| IP=192.5.0.1 | --ip 192.5.0.1 |
993994
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
994995
| Network=host | --network host |
@@ -1057,6 +1058,15 @@ escaped to allow inclusion of whitespace and other control characters.
10571058

10581059
This key can be listed multiple times.
10591060

1061+
### `HostName=`
1062+
1063+
Set the pod’s hostname inside all containers.
1064+
1065+
The given hostname is also added to the /etc/hosts file using the container’s primary IP address (also see the `--add-host` option).
1066+
1067+
Equivalent to the Podman `--hostname` option.
1068+
This key can be listed multiple times.
1069+
10601070
### `IP=`
10611071

10621072
Specify a static IPv4 address for the pod, for example **10.88.64.128**.

pkg/systemd/quadlet/quadlet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ var (
417417
KeyDNSSearch: true,
418418
KeyGIDMap: true,
419419
KeyGlobalArgs: true,
420+
KeyHostName: true,
420421
KeyIP: true,
421422
KeyIP6: true,
422423
KeyNetwork: true,
@@ -1664,6 +1665,7 @@ func ConvertPod(podUnit *parser.UnitFile, name string, unitsInfoMap map[string]*
16641665
KeyDNSOption: "--dns-option",
16651666
KeyDNSSearch: "--dns-search",
16661667
KeyAddHost: "--add-host",
1668+
KeyHostName: "--hostname",
16671669
}
16681670
lookupAndAddAllStrings(podUnit, PodGroup, allStringsKeys, execStartPre)
16691671

test/e2e/quadlet/hostname.pod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Pod]
2+
## assert-podman-pre-args "--hostname" "my-host-name"
3+
HostName=my-host-name

test/e2e/quadlet_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ BOGUS=foo
10761076
Entry("Pod - DNS Option", "dns-option.pod"),
10771077
Entry("Pod - DNS Search", "dns-search.pod"),
10781078
Entry("Pod - Host", "host.pod"),
1079+
Entry("Pod - HostName", "hostname.pod"),
10791080
Entry("Pod - IP", "ip.pod"),
10801081
Entry("Pod - Name", "name.pod"),
10811082
Entry("Pod - Network", "network.pod"),

0 commit comments

Comments
 (0)