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
- func NewOCIManager(ctx context.Context, opts ...any) (packmanager.PackageManager, error)
- func NewPackageFromOCIManifestSpec(ctx context.Context, handle handler.Handler, ref string, ...) (pack.Package, error)
- func NewPackageFromRemoteOCIRef(ctx context.Context, handle handler.Handler, ref string) (pack.Package, error)
- func NewPackageFromTarget(ctx context.Context, targ target.Target, opts ...packmanager.PackOption) (pack.Package, error)
- type Blob
- type BlobOption
- type Image
- func (image *Image) AddBlob(ctx context.Context, blob *Blob) (ocispec.Descriptor, error)
- func (image *Image) AddLayer(ctx context.Context, layer *Layer) (ocispec.Descriptor, error)
- func (image *Image) Layers() []*Layer
- func (image *Image) Save(ctx context.Context, source string, onProgress func(float64)) (ocispec.Descriptor, error)
- func (image *Image) SetAnnotation(_ context.Context, key, val string)
- func (image *Image) SetArchitecture(_ context.Context, architecture string)
- func (image *Image) SetCmd(_ context.Context, cmd []string)
- func (image *Image) SetLabel(_ context.Context, key, val string)
- func (image *Image) SetOS(_ context.Context, os string)
- func (image *Image) SetOSFeature(_ context.Context, feature ...string)
- func (image *Image) SetOSVersion(_ context.Context, osversion string)
- type ImageOption
- type Layer
- type LayerOption
- type OCIManagerOption
- func WithContainerd(ctx context.Context, addr, namespace string) OCIManagerOption
- func WithDefaultAuth() OCIManagerOption
- func WithDefaultRegistries() OCIManagerOption
- func WithDetectHandler() OCIManagerOption
- func WithDockerConfig(auth regtypes.AuthConfig) OCIManagerOption
- func WithRegistries(registries ...string) OCIManagerOption
Constants ¶
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" )
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" )
const ( DefaultRegistry = "unikraft.org" DefaultNamespace = "default" )
const ( WellKnownKernelPath = "/unikraft/bin/kernel" WellKnownInitrdPath = "/unikraft/bin/initrd" WellKnownConfigPath = "/unikraft/bin/config" WellKnownKernelSourceDir = "/unikraft/src" WellKnownAppSourceDir = "/unikraft/app" )
const ConfigFilename = "config.json"
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 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 ¶
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 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) AddLayer ¶
AddLayer adds a layer directly to the image and returns the resulting descriptor.
func (*Image) Save ¶
func (image *Image) Save(ctx context.Context, source string, onProgress func(float64)) (ocispec.Descriptor, error)
Save the image.
func (*Image) SetAnnotation ¶
SetAnnotation sets an anootation of the image with the provided key.
func (*Image) SetArchitecture ¶
SetArchitecture sets the architecture of the image.
func (*Image) SetOSFeature ¶
SetOSFeature sets any OS features of the image.
type ImageOption ¶
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 ¶
func WithLayerAnnotation ¶
func WithLayerAnnotation(key, val string) LayerOption
WithLayerAnnotation sets an annotation for a particular layer
type OCIManagerOption ¶ added in v0.6.0
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.