Merge pull request #18515 from vrothberg/fix-18486

quadlet: support `HostName`
This commit is contained in:
OpenShift Merge Robot 2023-05-09 11:21:28 -04:00 committed by GitHub
commit dc01ce8768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -108,6 +108,7 @@ Valid options for `[Container]` are listed below:
| HealthStartupSuccess=2 | --health-startup-success=2 | | HealthStartupSuccess=2 | --health-startup-success=2 |
| HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s | | HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s |
| HealthTimeout=20s | --health-timeout=20s | | HealthTimeout=20s | --health-timeout=20s |
| HostName=new-host-name | --hostname="new-host-name" |
| Image=ubi8 | Image specification - ubi8 | | Image=ubi8 | Image specification - ubi8 |
| IP=192.5.0.1 | --ip 192.5.0.0 | | IP=192.5.0.1 | --ip 192.5.0.0 |
| IP6=fd46:db93:aa76:ac37::10 | --ip6 2001:db8::1 | | IP6=fd46:db93:aa76:ac37::10 | --ip6 2001:db8::1 |
@ -275,6 +276,11 @@ Equivalent to the Podman `--health-startup-timeout` option.
The maximum time allowed to complete the healthcheck before an interval is considered failed. The maximum time allowed to complete the healthcheck before an interval is considered failed.
Equivalent to the Podman `--health-timeout` option. Equivalent to the Podman `--health-timeout` option.
### `HostName=`
Sets the host name that is available inside the container.
Equivalent to the Podman `--hostname` option.
### `Image=` ### `Image=`
The image to run in the container. This image must be locally installed for the service to work The image to run in the container. This image must be locally installed for the service to work

View File

@ -58,6 +58,7 @@ const (
KeyHealthStartupSuccess = "HealthStartupSuccess" KeyHealthStartupSuccess = "HealthStartupSuccess"
KeyHealthStartupTimeout = "HealthStartupTimeout" KeyHealthStartupTimeout = "HealthStartupTimeout"
KeyHealthTimeout = "HealthTimeout" KeyHealthTimeout = "HealthTimeout"
KeyHostName = "HostName"
KeyImage = "Image" KeyImage = "Image"
KeyIP = "IP" KeyIP = "IP"
KeyIP6 = "IP6" KeyIP6 = "IP6"
@ -129,6 +130,7 @@ var (
KeyHealthStartupSuccess: true, KeyHealthStartupSuccess: true,
KeyHealthStartupTimeout: true, KeyHealthStartupTimeout: true,
KeyHealthTimeout: true, KeyHealthTimeout: true,
KeyHostName: true,
KeyImage: true, KeyImage: true,
KeyIP: true, KeyIP: true,
KeyIP6: true, KeyIP6: true,
@ -614,6 +616,10 @@ func ConvertContainer(container *parser.UnitFile, isUser bool) (*parser.UnitFile
handleHealth(container, ContainerGroup, podman) handleHealth(container, ContainerGroup, podman)
if hostname, ok := container.Lookup(ContainerGroup, KeyHostName); ok {
podman.add("--hostname", hostname)
}
podmanArgs := container.LookupAllArgs(ContainerGroup, KeyPodmanArgs) podmanArgs := container.LookupAllArgs(ContainerGroup, KeyPodmanArgs)
podman.add(podmanArgs...) podman.add(podmanArgs...)

View File

@ -0,0 +1,4 @@
[Container]
Image=localhost/imagename
## assert-podman-args "--hostname" "\"quadlet-host\""
HostName="quadlet-host"

View File

@ -575,6 +575,7 @@ var _ = Describe("quadlet system generator", func() {
Entry("logdriver.container", "logdriver.container"), Entry("logdriver.container", "logdriver.container"),
Entry("mount.container", "mount.container"), Entry("mount.container", "mount.container"),
Entry("health.container", "health.container"), Entry("health.container", "health.container"),
Entry("hostname.container", "hostname.container"),
Entry("basic.volume", "basic.volume"), Entry("basic.volume", "basic.volume"),
Entry("label.volume", "label.volume"), Entry("label.volume", "label.volume"),