Merge pull request #25892 from Regis-Caelum/quadlet-pod-hostname

Add HostName to quadlet pod
This commit is contained in:
openshift-merge-bot[bot]
2025-04-22 12:52:04 +00:00
committed by GitHub
4 changed files with 16 additions and 0 deletions

View File

@ -1005,6 +1005,7 @@ Valid options for `[Pod]` are listed below:
| DNSSearch=example.com | --dns-search example.com |
| GIDMap=0:10000:10 | --gidmap=0:10000:10 |
| GlobalArgs=--log-level=debug | --log-level=debug |
| HostName=name | --hostname=name |
| IP=192.5.0.1 | --ip 192.5.0.1 |
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
| Network=host | --network host |
@ -1073,6 +1074,15 @@ escaped to allow inclusion of whitespace and other control characters.
This key can be listed multiple times.
### `HostName=`
Set the pods hostname inside all containers.
The given hostname is also added to the /etc/hosts file using the containers primary IP address (also see the `--add-host` option).
Equivalent to the Podman `--hostname` option.
This key can be listed multiple times.
### `IP=`
Specify a static IPv4 address for the pod, for example **10.88.64.128**.

View File

@ -447,6 +447,7 @@ var (
KeyDNSSearch: true,
KeyGIDMap: true,
KeyGlobalArgs: true,
KeyHostName: true,
KeyIP: true,
KeyIP6: true,
KeyNetwork: true,
@ -1722,6 +1723,7 @@ func ConvertPod(podUnit *parser.UnitFile, name string, unitsInfoMap map[string]*
KeyDNSOption: "--dns-option",
KeyDNSSearch: "--dns-search",
KeyAddHost: "--add-host",
KeyHostName: "--hostname",
}
lookupAndAddAllStrings(podUnit, PodGroup, allStringsKeys, execStartPre)

View File

@ -0,0 +1,3 @@
[Pod]
## assert-podman-pre-args "--hostname" "my-host-name"
HostName=my-host-name

View File

@ -1076,6 +1076,7 @@ BOGUS=foo
Entry("Pod - DNS Option", "dns-option.pod"),
Entry("Pod - DNS Search", "dns-search.pod"),
Entry("Pod - Host", "host.pod"),
Entry("Pod - HostName", "hostname.pod"),
Entry("Pod - IP", "ip.pod"),
Entry("Pod - Name", "name.pod"),
Entry("Pod - Network", "network.pod"),