Skip to content

Commit ebad6b0

Browse files
committed
engine: add platform field to EngineConfig
Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
1 parent ed7ccf9 commit ebad6b0

6 files changed

Lines changed: 26 additions & 0 deletions

File tree

common/docs/containers.conf.5.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,14 @@ Locks are recycled and can be reused after the associated container, pod, or vol
809809
The default number available is 2048.
810810
If this is changed, a lock renumbering must be performed, using the `podman system renumber` command.
811811

812+
**platform**=""
813+
814+
Specifies the default platform for image operations such as pull, build, run,
815+
and create. When set, container engines will use this platform instead of the
816+
host's native platform. The format is `os/arch` or `os/arch/variant` (e.g.,
817+
`linux/amd64`, `linux/arm64/v8`). If empty (the default), the host's platform
818+
is used.
819+
812820
**pod_exit_policy**="continue"
813821

814822
Set the exit policy of the pod when the last container exits. Supported policies are:

common/pkg/config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ type EngineConfig struct {
422422
// OCIRuntimesFlags are the set of configured OCI runtimes' flags
423423
OCIRuntimesFlags map[string][]string `toml:"runtimes_flags,omitempty"`
424424

425+
// Platform specifies the default platform (os/arch[/variant]) for image
426+
// operations such as pull, build, run, and create. If empty, the host's
427+
// platform is used. Format: "os/arch" or "os/arch/variant" (e.g.,
428+
// "linux/amd64", "linux/arm64/v8").
429+
Platform string `toml:"platform,omitempty"`
430+
425431
// PlatformToOCIRuntime requests specific OCI runtime for a specified platform of image.
426432
PlatformToOCIRuntime map[string]string `toml:"platform_to_oci_runtime,omitempty"`
427433

common/pkg/config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ image_copy_tmp_dir="storage"`
347347
gomega.Expect(config.Containers.Privileged).To(gomega.BeTrue())
348348
gomega.Expect(config.Containers.ReadOnly).To(gomega.BeTrue())
349349
gomega.Expect(config.Engine.ImageParallelCopies).To(gomega.Equal(uint(10)))
350+
gomega.Expect(config.Engine.Platform).To(gomega.Equal("linux/amd64"))
350351
gomega.Expect(config.Engine.PlatformToOCIRuntime).To(gomega.Equal(PlatformToOCIRuntimeMap))
351352
gomega.Expect(config.Engine.ImageDefaultFormat).To(gomega.Equal("v2s2"))
352353
gomega.Expect(config.Engine.CompressionFormat).To(gomega.BeEquivalentTo("zstd:chunked"))

common/pkg/config/containers.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,11 @@ default_sysctls = [
703703
#
704704
#num_locks = 2048
705705

706+
# Default platform (os/arch[/variant]) for image operations such as pull,
707+
# build, run, and create. If empty, the host's platform is used.
708+
#
709+
#platform = ""
710+
706711
# Set the exit policy of the pod when the last container exits.
707712
#pod_exit_policy = "continue"
708713

common/pkg/config/containers.conf-freebsd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ default_sysctls = [
535535
#
536536
#num_locks = 2048
537537

538+
# Default platform (os/arch[/variant]) for image operations such as pull,
539+
# build, run, and create. If empty, the host's platform is used.
540+
#
541+
#platform = ""
542+
538543
# Whether to pull new image before running a container
539544
#
540545
#pull_policy = "missing"

common/pkg/config/testdata/containers_override.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ events_container_create_inspect_data = true
1818
pod_exit_policy="stop"
1919
compression_format="zstd:chunked"
2020
cdi_spec_dirs = [ "/somepath" ]
21+
platform = "linux/amd64"
2122

2223
[engine.platform_to_oci_runtime]
2324
hello = "world"

0 commit comments

Comments
 (0)