Skip to content

Adjust BuildKit v0.17 GC configuration, and deprecate KeepBytes field #48639

@thaJeztah

Description

@thaJeztah

Description

BuildKit 0.17 is changing the configuration for Garbage Collection;

These settings are currently exposed to end-users through the daemon.json, so we need to;

  • update reference documentation
  • update manuals
  • deprecate old field (KeepBytes -> ReservedSpace)
  • verify if defaults need updating

Update reference documentation

The (dockerd reference describes the fields;

  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "10GB",
      "policy": [
        { "keepStorage": "10GB", "filter": ["unused-for=2200h"] },
        { "keepStorage": "50GB", "filter": ["unused-for=3300h"] },
        { "keepStorage": "100GB", "all": true }
      ]
    }
  },

update manuals

The Build garbage collection page describes the fields

Deprecate old field (KeepBytes -> ReservedSpace)

❓ We need to look at a transition period likely, to prevent the daemon failing to start if old/new options are used
👉 We need to deprecate the renamed field (KeepBytes -> ReservedSpace), and add deprecation warnings -> deprecation
👉 Docker Desktop may also be setting a default that may need updating(?)

Wire-up new fields

Besides the renamed field (KeepBytes -> ReservedSpace), 2 new fields were added that need to be wired up;

Changes;

  • The KeepBytes field was renamed to ReservedSpace
  • New field MaxUsedSpace added
  • New field MinFreeSpace added

Old Type:

type PruneInfo struct {
Filter []string `json:"filter"`
All bool `json:"all"`
KeepDuration time.Duration `json:"keepDuration"`
KeepBytes int64 `json:"keepBytes"`
}

New Type;

https://github.com/moby/buildkit/blob/2534310fd4c59018ae3874e8d0fad493086e2575/client/prune.go#L69-L77

type PruneInfo struct {
	All          bool          `json:"all"`
	Filter       []string      `json:"filter"`
	KeepDuration time.Duration `json:"keepDuration"`

	ReservedSpace int64 `json:"reservedSpace"`
	MaxUsedSpace  int64 `json:"maxUsedSpace"`
	MinFreeSpace  int64 `json:"minFreeSpace"`
}

Verify connection with docker system prune, docker builder prune

Verify if defaults need updating

The daemon currently sets defaults; we need to check if those needs updating

func DefaultGCPolicy(p string, defaultKeepBytes int64) []client.PruneInfo {

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions