Skip to content

Commit

Permalink
containers.conf: add field for AddCompression to Engine table
Browse files Browse the repository at this point in the history
Allows users to set default value of `AddCompression` to Engine table so
users can use containers/buildah#4912 by
default.

Closes: containers/buildah#4912 (comment)

Signed-off-by: Aditya R <[email protected]>
  • Loading branch information
flouthoc committed Aug 24, 2023
1 parent 6c83ca1 commit 9edd4ce
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/containers.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,17 @@ The `engine` table contains configuration options used to set up container engin

Name of destination for accessing the Podman service. See SERVICE DESTINATION TABLE below.

**add_compression**=[]

List of compression algorithms. If set makes sure that requested compression variant
for each platform is added to the manifest list keeping original instance intact in
the same manifest list on every `manifest push`. Supported values are (`gzip`, `zstd` and `zstd:chunked`).

Note: This is different from `compression_format` which allows users to select a default
compression format for `push` and `manifest push`, while `add_compression` is limited to
`manifest push` and allows users to append new instances to manifest list with specified compression
algorithms in `add_compression` for each platform.

**cgroup_manager**="systemd"

The cgroup management implementation used for the runtime. Supports `cgroupfs`
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ type EngineConfig struct {
// ActiveService index to Destinations added v2.0.3
ActiveService string `toml:"active_service,omitempty"`

// Add existing instances with requested compression algorithms to manifest list
AddCompression []string `toml:"add_compression,omitempty"`

// ServiceDestinations mapped by service Names
ServiceDestinations map[string]Destination `toml:"service_destinations,omitempty"`

Expand Down
12 changes: 12 additions & 0 deletions pkg/config/config_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,18 @@ var _ = Describe("Config Local", func() {
gomega.Expect(config2.Engine.ComposeProviders).To(gomega.Equal([]string{"/some/thing/else", "/than/before"}))
})

It("AddCompression", func() {
// Given
config, err := New(nil)
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config.Engine.AddCompression).To(gomega.BeNil()) // no hard-coding to work on all paltforms
// When
config2, err := NewConfig("testdata/containers_default.conf")
// Then
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config2.Engine.AddCompression).To(gomega.Equal([]string{"zstd", "zstd:chunked"}))
})

It("ComposeWarningLogs", func() {
// Given
config, err := New(nil)
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var _ = Describe("Config", func() {
gomega.Expect(defaultConfig.Engine.EventsContainerCreateInspectData).To(gomega.BeFalse())
gomega.Expect(defaultConfig.Engine.DBBackend).To(gomega.BeEquivalentTo(stringBoltDB))
gomega.Expect(defaultConfig.Engine.PodmanshTimeout).To(gomega.BeEquivalentTo(30))
gomega.Expect(defaultConfig.Engine.AddCompression).To(gomega.BeNil())

dbBackend, err := defaultConfig.DBBackend()
gomega.Expect(dbBackend).To(gomega.BeEquivalentTo(DBBackendBoltDB))
Expand Down
6 changes: 6 additions & 0 deletions pkg/config/containers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ default_sysctls = [
#
#active_service = "production"

#List of compression algorithms. If set makes sure that requested compression variant
#for each platform is added to the manifest list keeping original instance intact in
#the same manifest list on every `manifest push`. Supported values are (`gzip`, `zstd` and `zstd:chunked`).
#
#add_compression = ["gzip", "zstd", "zstd:chunked"]

# Enforces using docker.io for completing short names in Podman's compatibility
# REST API. Note that this will ignore unqualified-search-registries and
# short-name aliases defined in containers-registries.conf(5).
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/testdata/containers_default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ pasta_options = ["-t", "auto"]

[engine]

add_compression = ["zstd", "zstd:chunked"]

# Cgroup management implementation used for the runtime.
cgroup_manager = "systemd"

Expand Down

0 comments on commit 9edd4ce

Please sign in to comment.