mutate

package
v0.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(base v1.Image, ms ...Mutation) (v1.Image, error)

Apply performs the specified mutation(s) to a base image, returning the resulting image.

func Squash

func Squash(base v1.Image) (v1.Image, error)

Squash replaces all layers in the base image with a single, squashed layer.

func SquashSubset added in v0.12.0

func SquashSubset(base v1.Image, start, end int) (v1.Image, error)

SquashSubset replaces the layers starting at start index and up to (but not including) end index with a single, squashed layer.

func SquashfsLayer

func SquashfsLayer(base v1.Layer, dir string, opts ...SquashfsConverterOpt) (v1.Layer, error)

SquashfsLayer converts the base layer into a layer using the squashfs format. A dir must be specified, which is used as a working directory during conversion. The caller is responsible for cleaning up dir.

By default, this will attempt to locate a suitable TAR to SquashFS converter such as 'tar2sqfs' or `sqfstar` via exec.LookPath. To specify a path to a specific converter program, consider using OptSquashfsLayerConverter.

By default, AUFS whiteout markers in the base TAR layer will be converted to OverlayFS whiteout markers in the SquashFS layer. This can be disabled, e.g. where it is known that the layer is part of a squashed image that will not have any whiteouts, using OptSquashfsSkipWhiteoutConversion.

Note - when whiteout conversion is performed the base layer will be read twice. Callers should ensure it is cached, and is not a streaming layer.

func TarFromSquashfsLayer added in v0.10.0

func TarFromSquashfsLayer(base v1.Layer, opts ...TarConverterOpt) (tarball.Opener, error)

TarFromSquashfsLayer returns an opener that will provide a TAR conversion of the SquashFS format base layer.

TarFromSquashfsLayer may create one or more temporary files during the conversion process. By default, the directory returned by TempDir is used. To override this, consider using OptTarTempDir.

By default, this will attempt to locate a suitable SquashFS to tar converter, currently only 'sqfs2tar', via exec.LookPath. To specify a path to a specific converter program, consider using OptTarLayerConverter.

By default, OverlayFS whiteout markers in the base SquashFS layer will be converted to AUFS whiteout markers in the TAR layer. This can be disabled, e.g. where it is known that the layer is part of a squashed image that will not have any whiteouts, using OptTarSkipWhiteourConversion.

Types

type Mutation

type Mutation func(*image) error

func ReplaceLayers

func ReplaceLayers(l v1.Layer) Mutation

ReplaceLayers replaces all layers in the image with l.

func SetConfig added in v0.3.0

func SetConfig(configFile any, configType types.MediaType) Mutation

SetConfig replaces the config with the specified raw content of type t.

func SetHistory

func SetHistory(history v1.History) Mutation

SetHistory replaces the history in an image with the specified entry.

func SetLayer

func SetLayer(i int, l v1.Layer) Mutation

SetLayer sets the layer at index i to l.

type SquashfsConverterOpt added in v0.4.0

type SquashfsConverterOpt func(*squashfsConverter) error

SquashfsConverterOpt are used to specify squashfs converter options.

func OptSquashfsLayerConverter added in v0.4.0

func OptSquashfsLayerConverter(converter string) SquashfsConverterOpt

OptSquashfsLayerConverter specifies the converter program to use when converting from TAR to SquashFS format.

func OptSquashfsSkipWhiteoutConversion added in v0.6.0

func OptSquashfsSkipWhiteoutConversion(b bool) SquashfsConverterOpt

OptSquashfsSkipWhiteoutConversion is set to skip the default conversion of whiteout / opaque markers from AUFS to OverlayFS format.

type TarConverterOpt added in v0.10.0

type TarConverterOpt func(*tarConverter) error

TarConverterOpt are used to specify tar converter options.

func OptTarLayerConverter added in v0.10.0

func OptTarLayerConverter(converter string) TarConverterOpt

OptTarLayerConverter specifies the converter program to use when converting from SquashFS to tar format.

func OptTarSkipWhiteoutConversion added in v0.10.0

func OptTarSkipWhiteoutConversion(b bool) TarConverterOpt

OptTarSkipWhiteoutConversion is set to skip the default conversion of whiteout / opaque markers from OverlayFS to AUFS format.

func OptTarTempDir added in v0.10.0

func OptTarTempDir(d string) TarConverterOpt

OptTarTempDir sets the directory to use for temporary files. If not set, the directory returned by TempDir is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL