Documentation ¶
Index ¶
- Constants
- func ParseReference(imageStr string) (imageRef string, originalRef string, err error)
- type AdditionalMetadata
- func WithArchitecture(architecture, variant string) AdditionalMetadata
- func WithConfig(config []byte) AdditionalMetadata
- func WithManifest(manifest []byte) AdditionalMetadata
- func WithManifestDigest(digest string) AdditionalMetadata
- func WithOS(o string) AdditionalMetadata
- func WithPlatform(platform string) AdditionalMetadata
- func WithRepoDigests(digests ...string) AdditionalMetadata
- func WithTags(tags ...string) AdditionalMetadata
- type FileCatalog
- type FileCatalogReader
- type Image
- func (i *Image) Cleanup() error
- func (i *Image) FileContentsByRef(ref file.Reference) (io.ReadCloser, error)
- func (i *Image) FileContentsFromSquash(path file.Path) (io.ReadCloser, error)
- func (i *Image) FilesByMIMETypeFromSquash(mimeTypes ...string) ([]file.Reference, error)
- func (i *Image) IDs() []string
- func (i *Image) OpenPathFromSquash(path file.Path) (io.ReadCloser, error)
- func (i *Image) OpenReference(ref file.Reference) (io.ReadCloser, error)
- func (i *Image) Read() error
- func (i *Image) ResolveLinkByImageSquash(ref file.Reference, options ...filetree.LinkResolutionOption) (*file.Resolution, error)
- func (i *Image) ResolveLinkByLayerSquash(ref file.Reference, layer int, options ...filetree.LinkResolutionOption) (*file.Resolution, error)
- func (i *Image) SquashedTree() filetree.Reader
- type Layer
- func (l *Layer) FileContents(path file.Path) (io.ReadCloser, error)
- func (l *Layer) FileContentsFromSquash(path file.Path) (io.ReadCloser, error)
- func (l *Layer) FilesByMIMEType(mimeTypes ...string) ([]file.Reference, error)
- func (l *Layer) FilesByMIMETypeFromSquash(mimeTypes ...string) ([]file.Reference, error)
- func (l *Layer) OpenPath(path file.Path) (io.ReadCloser, error)
- func (l *Layer) OpenPathFromSquash(path file.Path) (io.ReadCloser, error)
- func (l *Layer) Read(catalog *FileCatalog, idx int, uncompressedLayersCacheDir string) error
- type LayerMetadata
- type Metadata
- type Platform
- type Provider
- type RegistryCredentials
- type RegistryOptions
- type Source
Constants ¶
const SingularitySquashFSLayer = "application/vnd.sylabs.sif.layer.v1.squashfs"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdditionalMetadata ¶
func WithArchitecture ¶
func WithArchitecture(architecture, variant string) AdditionalMetadata
func WithConfig ¶
func WithConfig(config []byte) AdditionalMetadata
func WithManifest ¶
func WithManifest(manifest []byte) AdditionalMetadata
func WithManifestDigest ¶
func WithManifestDigest(digest string) AdditionalMetadata
func WithOS ¶
func WithOS(o string) AdditionalMetadata
func WithPlatform ¶
func WithPlatform(platform string) AdditionalMetadata
func WithRepoDigests ¶
func WithRepoDigests(digests ...string) AdditionalMetadata
func WithTags ¶
func WithTags(tags ...string) AdditionalMetadata
type FileCatalog ¶
FileCatalog represents all file metadata and source tracing for all files contained within the image layer blobs (i.e. everything except for the image index/manifest/metadata files).
func NewFileCatalog ¶
func NewFileCatalog() *FileCatalog
NewFileCatalog returns an empty FileCatalog.
func (*FileCatalog) Add ¶
Add creates a new FileCatalogEntry for the given file reference and metadata, cataloged by the ID of the file reference (overwriting any existing entries without warning).
func (*FileCatalog) Open ¶
func (c *FileCatalog) Open(f file.Reference) (io.ReadCloser, error)
Open returns a io.ReadCloser for the given file reference. The underlying io.ReadCloser will not attempt to allocate resources until the first read is performed.
type FileCatalogReader ¶
type FileCatalogReader interface { Layer(file.Reference) *Layer Open(file.Reference) (io.ReadCloser, error) filetree.IndexReader }
type Image ¶
type Image struct { // Metadata contains select image attributes Metadata Metadata // Layers contains the rich layer objects in build order Layers []*Layer // FileCatalog contains all file metadata for all files in all layers FileCatalog FileCatalogReader SquashedSearchContext filetree.Searcher // contains filtered or unexported fields }
Image represents a container image.
func New ¶
func New(image v1.Image, tmpDirGen *file.TempDirGenerator, contentCacheDir string, additionalMetadata ...AdditionalMetadata) *Image
New provides a new (unread) image object.
func NewImage ¶
func NewImage(image v1.Image, tmpDirGen *file.TempDirGenerator, contentCacheDir string, additionalMetadata ...AdditionalMetadata) *Image
NewImage provides a new (unread) image object. Deprecated: use New() instead
func (*Image) Cleanup ¶
Cleanup removes all temporary files created from parsing the image. Future calls to image will not function correctly after this call.
func (*Image) FileContentsByRef ¶
FileContentsByRef fetches file contents for a single file reference, regardless of the source layer. If the path does not exist an error is returned. Deprecated: please use OpenReference() instead.
func (*Image) FileContentsFromSquash ¶
FileContentsFromSquash fetches file contents for a single path, relative to the image squash tree. If the path does not exist an error is returned. Deprecated: use OpenPathFromSquash() instead.
func (*Image) FilesByMIMETypeFromSquash ¶
FilesByMIMETypeFromSquash returns file references for files that match at least one of the given MIME types. Deprecated: please use SquashedSearchContext().SearchByMIMEType() instead.
func (*Image) OpenPathFromSquash ¶
OpenPathFromSquash fetches file contents for a single path, relative to the image squash tree. If the path does not exist an error is returned.
func (*Image) OpenReference ¶
OpenReference fetches file contents for a single file reference, regardless of the source layer. If the path does not exist an error is returned.
func (*Image) Read ¶
Read parses information from the underlying image tar into this struct. This includes image metadata, layer metadata, layer file trees, and layer squash trees (which implies the image squash tree).
func (*Image) ResolveLinkByImageSquash ¶
func (i *Image) ResolveLinkByImageSquash(ref file.Reference, options ...filetree.LinkResolutionOption) (*file.Resolution, error)
ResolveLinkByImageSquash resolves a symlink or hardlink for the given file reference relative to the result from the image squash. If the given file reference is not a link type, or is a unresolvable (dead) link, then the given file reference is returned.
func (*Image) ResolveLinkByLayerSquash ¶
func (i *Image) ResolveLinkByLayerSquash(ref file.Reference, layer int, options ...filetree.LinkResolutionOption) (*file.Resolution, error)
ResolveLinkByLayerSquash resolves a symlink or hardlink for the given file reference relative to the result from the layer squash of the given layer index argument. If the given file reference is not a link type, or is a unresolvable (dead) link, then the given file reference is returned.
func (*Image) SquashedTree ¶
SquashedTree returns the pre-computed image squash file tree.
type Layer ¶
type Layer struct { // Metadata contains select layer attributes Metadata LayerMetadata // Tree is a filetree that represents the structure of the layer tar contents ("diff tree") Tree filetree.Reader // SquashedTree is a filetree that represents the combination of this layers diff tree and all diff trees // in lower layers relative to this one. SquashedTree filetree.Reader SquashedSearchContext filetree.Searcher SearchContext filetree.Searcher // contains filtered or unexported fields }
Layer represents a single layer within a container image.
func (*Layer) FileContents ¶
FileContents reads the file contents for the given path from the underlying layer blob, relative to the layers "diff tree". An error is returned if there is no file at the given path and layer or the read operation cannot continue. Deprecated: use OpenPath() instead.
func (*Layer) FileContentsFromSquash ¶
FileContentsFromSquash reads the file contents for the given path from the underlying layer blob, relative to the layers squashed file tree. An error is returned if there is no file at the given path and layer or the read operation cannot continue. Deprecated: use OpenPathFromSquash() instead.
func (*Layer) FilesByMIMEType ¶
FilesByMIMEType returns file references for files that match at least one of the given MIME types relative to each layer tree. Deprecated: use SearchContext().SearchByMIMEType() instead.
func (*Layer) FilesByMIMETypeFromSquash ¶
FilesByMIMETypeFromSquash returns file references for files that match at least one of the given MIME types relative to the squashed file tree representation. Deprecated: use SquashedSearchContext().SearchByMIMEType() instead.
func (*Layer) OpenPath ¶
OpenPath reads the file contents for the given path from the underlying layer blob, relative to the layers "diff tree". An error is returned if there is no file at the given path and layer or the read operation cannot continue.
func (*Layer) OpenPathFromSquash ¶
OpenPathFromSquash reads the file contents for the given path from the underlying layer blob, relative to the layers squashed file tree. An error is returned if there is no file at the given path and layer or the read operation cannot continue.
type LayerMetadata ¶
type LayerMetadata struct { Index uint // Digest is the sha256 digest of the layer contents (the docker "diff id") Digest string MediaType v1Types.MediaType // Size in bytes of the layer content size Size int64 }
LayerMetadata represents container layer metadata.
type Metadata ¶
type Metadata struct { // ID is the sha256 of this image config json (not manifest) ID string // Size in bytes of all the image layer content sizes (does not include config / manifest / index metadata sizes) Size int64 Config v1.ConfigFile MediaType v1Types.MediaType // --- below fields are optional metadata Tags []name.Tag RawManifest []byte ManifestDigest string RawConfig []byte RepoDigests []string Architecture string Variant string OS string }
Metadata represents container image metadata.
type Platform ¶
type Platform struct { // Architecture field specifies the CPU architecture, for example // `amd64` or `ppc64`. Architecture string `json:"architecture"` // OS specifies the operating system, for example `linux` or `windows`. OS string `json:"os"` // Variant is an optional field specifying a variant of the CPU, for // example `v7` to specify ARMv7 when architecture is `arm`. Variant string `json:"variant,omitempty"` }
Platform is a subset of the supported fields from specs "github.com/opencontainers/image-spec/specs-go/v1.Platform"
func NewPlatform ¶
type Provider ¶
Provider is an abstraction for any object that provides image objects (e.g. the docker daemon API, a tar file of an OCI image, podman varlink API, etc.).
type RegistryCredentials ¶
type RegistryCredentials struct { Authority string Username string Password string Token string // Explicitly pass in the Authenticator, allowing for things like // k8schain to be passed through explicitly. Authenticator authn.Authenticator // MTLS configuration ClientCert string ClientKey string }
RegistryCredentials contains any information necessary to authenticate against an OCI-distribution-compliant registry (either with basic auth, or bearer token, or ggcr authenticator implementation). Note: only valid for the OCI registry provider.
type RegistryOptions ¶
type RegistryOptions struct { InsecureSkipTLSVerify bool InsecureUseHTTP bool Credentials []RegistryCredentials Keychain authn.Keychain CAFileOrDir string }
RegistryOptions for the OCI registry provider and containerd provider. If no specific Credential is found in the RegistryCredentials, will check for Keychain, and barring that will use Default Keychain.
func (RegistryOptions) Authenticator ¶
func (r RegistryOptions) Authenticator(registry string) authn.Authenticator
Authenticator selects the credentials used to authenticate with a registry. Returns an authn.Authenticator object capable for handling high level credentials for the registry.
type Source ¶
type Source = string
const ( UnknownSource Source = "" ContainerdDaemonSource Source = "containerd" DockerTarballSource Source = "docker-archive" DockerDaemonSource Source = "docker" OciDirectorySource Source = "oci-dir" OciTarballSource Source = "oci-archive" OciRegistrySource Source = "oci-registry" PodmanDaemonSource Source = "podman" SingularitySource Source = "singularity" )