oci

package
v0.6.5-8-gcfcd31f Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: BSD-3-Clause Imports: 41 Imported by: 3

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	AnnotationMediaType            = "org.unikraft.mediaType"
	AnnotationName                 = "org.unikraft.image.name"
	AnnotationVersion              = "org.unikraft.image.version"
	AnnotationURL                  = "org.unikraft.image.url"
	AnnotationCreated              = "org.unikraft.image.created"
	AnnotaitonDescription          = "org.unikraft.image.description"
	AnnotationKernelPath           = "org.unikraft.kernel.image"
	AnnotationKernelVersion        = "org.unikraft.kernel.version"
	AnnotationKernelInitrdPath     = "org.unikraft.kernel.initrd"
	AnnotationKernelKConfig        = "org.unikraft.kernel.kconfig."
	AnnotationKernelArch           = "org.unikraft.kernel.arch"
	AnnotationKernelPlat           = "org.unikraft.kernel.plat"
	AnnotationFilesystemPath       = "org.unikraft.filesystem"
	AnnotationDiskIndexPathPattern = "org.unikraft.disk-%d"
	AnnotationKraftKitVersion      = "sh.kraftkit.version"
)
View Source
const (
	MediaTypeLayer       = "application/vnd.unikraft.rootfs.diff"
	MediaTypeImageKernel = "application/vnd.unikraft.image.v1"
	MediaTypeInitrdCpio  = "application/vnd.unikraft.initrd.v1"
	MediaTypeConfig      = "application/vnd.unikraft.config.v1"

	MediaTypeLayerGzip       = MediaTypeLayer + "+gzip"
	MediaTypeImageKernelGzip = MediaTypeImageKernel + "+gzip"
	MediaTypeInitrdCpioGzip  = MediaTypeInitrdCpio + "+gzip"
	MediaTypeConfigGzip      = MediaTypeConfig + "+gzip"
)
View Source
const (
	DefaultRegistry  = "unikraft.org"
	DefaultNamespace = "default"
)
View Source
const (
	WellKnownKernelPath      = "/unikraft/bin/kernel"
	WellKnownInitrdPath      = "/unikraft/bin/initrd"
	WellKnownConfigPath      = "/unikraft/bin/config"
	WellKnownKernelSourceDir = "/unikraft/src"
	WellKnownAppSourceDir    = "/unikraft/app"
)
View Source
const ConfigFilename = "config.json"
View Source
const OCIFormat pack.PackageFormat = "oci"

Variables

This section is empty.

Functions

func NewOCIManager

func NewOCIManager(ctx context.Context, opts ...any) (packmanager.PackageManager, error)

NewOCIManager instantiates a new package manager based on OCI archives.

func NewPackageFromOCIManifestSpec

func NewPackageFromOCIManifestSpec(ctx context.Context, handle handler.Handler, ref string, manifest ocispec.Manifest) (pack.Package, error)

NewPackageFromOCIManifestSpec generates a package from a supplied OCI image manifest specification.

func NewPackageFromRemoteOCIRef

func NewPackageFromRemoteOCIRef(ctx context.Context, handle handler.Handler, ref string) (pack.Package, error)

NewPackageFromRemoteOCIRef generates a new package from a given OCI image reference which is accessed by its remote registry.

func NewPackageFromTarget

func NewPackageFromTarget(ctx context.Context, targ target.Target, opts ...packmanager.PackOption) (pack.Package, error)

NewPackageFromTarget generates an OCI implementation of the pack.Package construct based on an input Application and options.

Types

type Blob

type Blob struct {
	// contains filtered or unexported fields
}

func NewBlob

func NewBlob(_ context.Context, mediaType string, data []byte, opts ...BlobOption) (*Blob, error)

NewBlob generates an OCI blob based on input byte array for a given media type.

func NewBlobFromFile

func NewBlobFromFile(_ context.Context, mediaType string, filePath string, opts ...BlobOption) (*Blob, error)

NewBlobFromFile generates an OCI blob based on an input file for a given media type

type BlobOption

type BlobOption func(*Blob) error

func WithBlobPlatform

func WithBlobPlatform(platform *ocispec.Platform) BlobOption

WithBlobPlatform specifies platform attribution such that the later queries to the blob store which include platform specification only return those with the set parameters.

func WithBlobRemoveAfterSave

func WithBlobRemoveAfterSave(removeAfterSave bool) BlobOption

WithBlobRemoveAfterSave atomizes each operation on the blob.

type Image

type Image struct {
	// contains filtered or unexported fields
}

func NewImage

func NewImage(_ context.Context, handle handler.Handler, opts ...ImageOption) (*Image, error)

NewImage instantiates a new image based in a handler and any provided options.

func NewImageFromManifestSpec

func NewImageFromManifestSpec(ctx context.Context, handle handler.Handler, manifest ocispec.Manifest, opts ...ImageOption) (*Image, error)

NewImageFromManifestSpec instantiates a new image based in a handler and with the provided Manifest specification and options.

func (*Image) AddBlob

func (image *Image) AddBlob(ctx context.Context, blob *Blob) (ocispec.Descriptor, error)

AddBlob adds a blog to the image and returns the resulting descriptor.

func (*Image) AddLayer

func (image *Image) AddLayer(ctx context.Context, layer *Layer) (ocispec.Descriptor, error)

AddLayer adds a layer directly to the image and returns the resulting descriptor.

func (*Image) Layers

func (image *Image) Layers() []*Layer

Layers returns the layers of this OCI image.

func (*Image) Save

func (image *Image) Save(ctx context.Context, source string, onProgress func(float64)) (ocispec.Descriptor, error)

Save the image.

func (*Image) SetAnnotation

func (image *Image) SetAnnotation(_ context.Context, key, val string)

SetAnnotation sets an anootation of the image with the provided key.

func (*Image) SetArchitecture

func (image *Image) SetArchitecture(_ context.Context, architecture string)

SetArchitecture sets the architecture of the image.

func (*Image) SetCmd

func (image *Image) SetCmd(_ context.Context, cmd []string)

Set the command of the image.

func (*Image) SetLabel

func (image *Image) SetLabel(_ context.Context, key, val string)

SetLabel sets a label of the image with the provided key.

func (*Image) SetOS

func (image *Image) SetOS(_ context.Context, os string)

SetOS sets the OS of the image.

func (*Image) SetOSFeature

func (image *Image) SetOSFeature(_ context.Context, feature ...string)

SetOSFeature sets any OS features of the image.

func (*Image) SetOSVersion

func (image *Image) SetOSVersion(_ context.Context, osversion string)

SetOSVersion sets the version of the OS of the image.

type ImageOption

type ImageOption func(*Image) error

func WithAutoSave

func WithAutoSave(autoSave bool) ImageOption

WithAutoSave atomicizes the image as operations occur on its body.

func WithWorkdir

func WithWorkdir(workdir string) ImageOption

WithWorkdir specifies the working directory of the image.

type Layer

type Layer struct {
	// contains filtered or unexported fields
}

func NewLayerFromFile

func NewLayerFromFile(ctx context.Context, mediaType, src, dst string, opts ...LayerOption) (*Layer, error)

NewLayerFromFile creates a new layer from a given blob

type LayerOption

type LayerOption func(*Layer) error

func WithLayerAnnotation

func WithLayerAnnotation(key, val string) LayerOption

WithLayerAnnotation sets an annotation for a particular layer

type OCIManagerOption added in v0.6.0

type OCIManagerOption func(context.Context, *ociManager) error

func WithContainerd added in v0.6.0

func WithContainerd(ctx context.Context, addr, namespace string) OCIManagerOption

WithContainerd forces the use of a containerd handler by providing an address to the containerd daemon (whether UNIX socket or TCP socket) as well as the default namespace to operate within.

func WithDefaultAuth added in v0.6.0

func WithDefaultAuth() OCIManagerOption

WithDefaultAuth uses the KraftKit-set configuration for authentication against remote registries.

func WithDefaultRegistries added in v0.6.0

func WithDefaultRegistries() OCIManagerOption

WithDefaultRegistries sets the list of KraftKit-set registries which is defined through its configuration.

func WithDetectHandler added in v0.6.0

func WithDetectHandler() OCIManagerOption

WithDetectHandler uses internal KraftKit configuration to determine which underlying OCI handler implementation should be used. Ultimately, this is done by checking whether set configuration can ultimately invoke a relative client to enable the handler.

func WithDockerConfig added in v0.6.0

func WithDockerConfig(auth regtypes.AuthConfig) OCIManagerOption

WithDockerConfig sets the authentication configuration to use when making calls to authenticated registries.

func WithRegistries added in v0.6.0

func WithRegistries(registries ...string) OCIManagerOption

WithRegistries sets the list of registries to use when making calls to non-canonically named OCI references.

Directories

Path Synopsis
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.

Jump to

Keyboard shortcuts

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