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 expect 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 expect 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 expect 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 expect 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 expect 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 expect 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 expect 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 expect 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 expect 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 expect in compliance with the License.
Index ¶
- Constants
- func NewManifestPackageManagerFromOptions(opts *packmanager.PackageManagerOptions) (packmanager.PackageManager, error)
- func NewPackageFromManifest(ctx context.Context, manifest *Manifest, popts ...pack.PackageOption) (pack.Package, error)
- func NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions, provider Provider) (pack.Package, error)
- func NewPackageWithVersion(ctx context.Context, manifest *Manifest, version string, ...) (pack.Package, error)
- type DirectoryProvider
- type GitHubProvider
- type GitProvider
- type Manifest
- func FindManifestsFromSource(ctx context.Context, source string, mopts ...ManifestOption) ([]*Manifest, error)
- func NewManifestFromBytes(ctx context.Context, raw []byte, mopts ...ManifestOption) (*Manifest, error)
- func NewManifestFromFile(ctx context.Context, path string, mopts ...ManifestOption) (*Manifest, error)
- func NewManifestFromURL(ctx context.Context, path string, mopts ...ManifestOption) (*Manifest, error)
- type ManifestChannel
- type ManifestIndex
- func NewManifestIndexFromBytes(ctx context.Context, raw []byte, mopts ...ManifestOption) (*ManifestIndex, error)
- func NewManifestIndexFromFile(ctx context.Context, path string, mopts ...ManifestOption) (*ManifestIndex, error)
- func NewManifestIndexFromURL(ctx context.Context, path string, mopts ...ManifestOption) (*ManifestIndex, error)
- type ManifestIndexProvider
- type ManifestManager
- func (mm ManifestManager) AddSource(ctx context.Context, source string) error
- func (mm ManifestManager) ApplyOptions(pmopts ...packmanager.PackageManagerOption) error
- func (mm ManifestManager) Catalog(ctx context.Context, query packmanager.CatalogQuery, ...) ([]pack.Package, error)
- func (mm ManifestManager) Format() string
- func (um ManifestManager) From(sub string) (packmanager.PackageManager, error)
- func (mm ManifestManager) IsCompatible(ctx context.Context, source string) (packmanager.PackageManager, error)
- func (mm ManifestManager) LocalManifestIndex(ctx context.Context) string
- func (mm ManifestManager) LocalManifestsDir(ctx context.Context) string
- func (mm ManifestManager) NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions) ([]pack.Package, error)
- func (mm ManifestManager) Options() *packmanager.PackageManagerOptions
- func (mm ManifestManager) Pull(ctx context.Context, path string, opts *pack.PullPackageOptions) ([]pack.Package, error)
- func (mm ManifestManager) Push(ctx context.Context, path string) error
- func (mm ManifestManager) RemoveSource(ctx context.Context, source string) error
- func (mm ManifestManager) Update(ctx context.Context) error
- type ManifestOption
- type ManifestPackage
- func (mp ManifestPackage) ApplyOptions(opts ...pack.PackageOption) error
- func (mp ManifestPackage) CanonicalName() string
- func (mp ManifestPackage) Compatible(ref string) bool
- func (mp ManifestPackage) Format() string
- func (mp ManifestPackage) Name() string
- func (mp ManifestPackage) Options() *pack.PackageOptions
- func (mp ManifestPackage) Pack(ctx context.Context) error
- func (mp ManifestPackage) Pull(ctx context.Context, opts ...pack.PullPackageOption) error
- type ManifestProvider
- type ManifestVersion
- type ManifestVersionType
- type Provider
- func NewDirectoryProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewGitHubProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewGitProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewManifestIndexProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewManifestProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
- func NewProviderFromString(ctx context.Context, provider, path string, entity any, ...) (Provider, error)
Constants ¶
const (
ManifestContext pack.ContextKey = "manifest"
)
Variables ¶
This section is empty.
Functions ¶
func NewManifestPackageManagerFromOptions ¶
func NewManifestPackageManagerFromOptions(opts *packmanager.PackageManagerOptions) (packmanager.PackageManager, error)
func NewPackageFromManifest ¶
func NewPackageFromManifest(ctx context.Context, manifest *Manifest, popts ...pack.PackageOption) (pack.Package, error)
NewPackageFromManifest generates a manifest implementation of the pack.Package construct based on the input Manifest
func NewPackageFromOptions ¶
func NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions, provider Provider) (pack.Package, error)
NewPackageFromOptions generates a manifest implementation of the pack.Package construct based on the input options
func NewPackageWithVersion ¶
func NewPackageWithVersion(ctx context.Context, manifest *Manifest, version string, popts ...pack.PackageOption) (pack.Package, error)
NewPackageWithVersion generates a manifest implementation of the pack.Package construct based on the input Manifest for a particular version
Types ¶
type DirectoryProvider ¶
type DirectoryProvider struct {
// contains filtered or unexported fields
}
func (DirectoryProvider) Manifests ¶
func (dp DirectoryProvider) Manifests() ([]*Manifest, error)
func (DirectoryProvider) PullPackage ¶
func (dp DirectoryProvider) PullPackage(ctx context.Context, manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error
func (DirectoryProvider) String ¶
func (dp DirectoryProvider) String() string
type GitHubProvider ¶
type GitHubProvider struct {
// contains filtered or unexported fields
}
func (GitHubProvider) Manifests ¶
func (ghp GitHubProvider) Manifests() ([]*Manifest, error)
func (GitHubProvider) PullPackage ¶
func (ghp GitHubProvider) PullPackage(ctx context.Context, manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error
func (GitHubProvider) String ¶
func (ghp GitHubProvider) String() string
type GitProvider ¶
type GitProvider struct {
// contains filtered or unexported fields
}
func (GitProvider) Manifests ¶
func (gp GitProvider) Manifests() ([]*Manifest, error)
func (GitProvider) PullPackage ¶
func (gp GitProvider) PullPackage(ctx context.Context, manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error
func (GitProvider) String ¶
func (gp GitProvider) String() string
type Manifest ¶
type Manifest struct { // Name of the entity which this manifest represents Name string `yaml:"name"` // Type of entity which this manifest represetns Type unikraft.ComponentType `yaml:"type"` // Manifest is used to point to remote manifest, allowing the manifest itself // to be retrieved by indirection. Manifest is XOR with Versions and should // be back-propagated. Manifest string `yaml:"manifest,omitempty"` // Description of what this manifest represents Description string `yaml:"description,omitempty"` // Origin represents where (and therefore how) this manifest was populated Origin string `yaml:"origin,omitempty"` // Provider is the string name of the underlying implementation providing the // contents of this manifest Provider Provider `yaml:"provider,omitempty"` // Channels provides multiple ways to retrieve versions. Classically this is // a separation between "staging" and "stable" Channels []ManifestChannel `yaml:"channels,omitempty"` // Versions Versions []ManifestVersion `yaml:"versions,omitempty"` // contains filtered or unexported fields }
func FindManifestsFromSource ¶
func FindManifestsFromSource(ctx context.Context, source string, mopts ...ManifestOption) ([]*Manifest, error)
FindManifestsFromSource is a recursive method which follows a given source and attempts to instantiate a Provider which matches the given source. If the source is recognised by a provider, it is traversed to return all the known Manifests.
func NewManifestFromBytes ¶
func NewManifestFromBytes(ctx context.Context, raw []byte, mopts ...ManifestOption) (*Manifest, error)
NewManifestFromBytes parses a byte array of a YAML representing a manifest
func NewManifestFromFile ¶
func NewManifestFromFile(ctx context.Context, path string, mopts ...ManifestOption) (*Manifest, error)
NewManifestFromFile reads in a manifest file from a given path
func NewManifestFromURL ¶
func NewManifestFromURL(ctx context.Context, path string, mopts ...ManifestOption) (*Manifest, error)
NewManifestFromURL retrieves a provided path as a Manifest from a remote location over HTTP
func (Manifest) Auths ¶
func (m Manifest) Auths() map[string]config.AuthConfig
Auths returns the map of provided authentication configuration passed as an option to the Manifest
func (Manifest) DefaultChannel ¶
func (m Manifest) DefaultChannel() (*ManifestChannel, error)
DefaultChannel returns the default channel of the Manifest
func (Manifest) WriteToFile ¶
WriteToFile saves the manifest as a YAML format file at the given path
type ManifestChannel ¶
type ManifestIndex ¶
type ManifestIndex struct { Name string `yaml:"name,omitempty"` LastUpdated time.Time `yaml:"last_updated"` Manifests []*Manifest `yaml:"manifests"` Origin string `yaml:"-"` }
func NewManifestIndexFromBytes ¶
func NewManifestIndexFromBytes(ctx context.Context, raw []byte, mopts ...ManifestOption) (*ManifestIndex, error)
NewManifestIndexFromBytes parses a byte array of a YAML representing a manifest index
func NewManifestIndexFromFile ¶
func NewManifestIndexFromFile(ctx context.Context, path string, mopts ...ManifestOption) (*ManifestIndex, error)
func NewManifestIndexFromURL ¶
func NewManifestIndexFromURL(ctx context.Context, path string, mopts ...ManifestOption) (*ManifestIndex, error)
NewManifestFromURL retrieves a provided path as a ManifestIndex from a remote location over HTTP
func (*ManifestIndex) WriteToFile ¶
func (mi *ManifestIndex) WriteToFile(path string) error
type ManifestIndexProvider ¶
type ManifestIndexProvider struct {
// contains filtered or unexported fields
}
func (ManifestIndexProvider) Manifests ¶
func (mip ManifestIndexProvider) Manifests() ([]*Manifest, error)
func (ManifestIndexProvider) PullPackage ¶
func (mip ManifestIndexProvider) PullPackage(ctx context.Context, manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error
func (ManifestIndexProvider) String ¶
func (mip ManifestIndexProvider) String() string
type ManifestManager ¶
type ManifestManager struct {
// contains filtered or unexported fields
}
func (ManifestManager) AddSource ¶
func (mm ManifestManager) AddSource(ctx context.Context, source string) error
func (ManifestManager) ApplyOptions ¶
func (mm ManifestManager) ApplyOptions(pmopts ...packmanager.PackageManagerOption) error
func (ManifestManager) Catalog ¶
func (mm ManifestManager) Catalog(ctx context.Context, query packmanager.CatalogQuery, popts ...pack.PackageOption) ([]pack.Package, error)
func (ManifestManager) Format ¶
func (mm ManifestManager) Format() string
func (ManifestManager) From ¶
func (um ManifestManager) From(sub string) (packmanager.PackageManager, error)
func (ManifestManager) IsCompatible ¶
func (mm ManifestManager) IsCompatible(ctx context.Context, source string) (packmanager.PackageManager, error)
func (ManifestManager) LocalManifestIndex ¶
func (mm ManifestManager) LocalManifestIndex(ctx context.Context) string
LocalManifestIndex returns the user configured path to the manifest index
func (ManifestManager) LocalManifestsDir ¶
func (mm ManifestManager) LocalManifestsDir(ctx context.Context) string
LocalManifestDir returns the user configured path to all the manifests
func (ManifestManager) NewPackageFromOptions ¶
func (mm ManifestManager) NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions) ([]pack.Package, error)
NewPackage initializes a new package
func (ManifestManager) Options ¶
func (mm ManifestManager) Options() *packmanager.PackageManagerOptions
Options allows you to view the current options.
func (ManifestManager) Pull ¶
func (mm ManifestManager) Pull(ctx context.Context, path string, opts *pack.PullPackageOptions) ([]pack.Package, error)
Pull a package from the support registry of the implementation.
func (ManifestManager) Push ¶
func (mm ManifestManager) Push(ctx context.Context, path string) error
Push the resulting package to the supported registry of the implementation.
func (ManifestManager) RemoveSource ¶
func (mm ManifestManager) RemoveSource(ctx context.Context, source string) error
type ManifestOption ¶
func WithAuthConfig ¶
func WithAuthConfig(auths map[string]config.AuthConfig) ManifestOption
func WithSourcesRootDir ¶
func WithSourcesRootDir(dir string) ManifestOption
WithSourcesRootDir is an option which helps find cached Manifest Channel or Version resources. When set to a directory, the fixed structure of this directory should allow us to look up (and also store) resources here for later use.
type ManifestPackage ¶
type ManifestPackage struct { *pack.PackageOptions Provider // contains filtered or unexported fields }
func (ManifestPackage) ApplyOptions ¶
func (mp ManifestPackage) ApplyOptions(opts ...pack.PackageOption) error
func (ManifestPackage) CanonicalName ¶
func (mp ManifestPackage) CanonicalName() string
func (ManifestPackage) Compatible ¶
func (mp ManifestPackage) Compatible(ref string) bool
func (ManifestPackage) Format ¶
func (mp ManifestPackage) Format() string
func (ManifestPackage) Name ¶
func (mp ManifestPackage) Name() string
func (ManifestPackage) Options ¶
func (mp ManifestPackage) Options() *pack.PackageOptions
func (ManifestPackage) Pull ¶
func (mp ManifestPackage) Pull(ctx context.Context, opts ...pack.PullPackageOption) error
type ManifestProvider ¶
type ManifestProvider struct {
// contains filtered or unexported fields
}
func (ManifestProvider) Manifests ¶
func (mp ManifestProvider) Manifests() ([]*Manifest, error)
func (ManifestProvider) PullPackage ¶
func (mp ManifestProvider) PullPackage(ctx context.Context, manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error
func (ManifestProvider) String ¶
func (mp ManifestProvider) String() string
type ManifestVersion ¶
type ManifestVersion struct { Version string `yaml:"version"` Resource string `yaml:"resource"` Sha256 string `yaml:"sha256,omitempty"` Type ManifestVersionType `yaml:"type,omitempty"` Unikraft string `yaml:"unikraft,omitempty"` Local string `yaml:"-"` }
func (*ManifestVersion) ShortGitSha ¶
func (mv *ManifestVersion) ShortGitSha() (string, error)
type ManifestVersionType ¶
type ManifestVersionType string
const ( ManifestVersionSemver ManifestVersionType = "semver" ManifestVersionGitSha ManifestVersionType = "gitsha" )
type Provider ¶
type Provider interface { // Manifests returns a slice of Manifests which can be returned by this // Provider Manifests() ([]*Manifest, error) // Pull from the provider PullPackage(context.Context, *Manifest, *pack.PackageOptions, *pack.PullPackageOptions) error // String returns the name of the provider fmt.Stringer }
func NewDirectoryProvider ¶
func NewDirectoryProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
NewDirectoryProvider attempts to parse a provided path as a Unikraft "microlibirary" directory
func NewGitHubProvider ¶
NewGitHubProvider attempts to parse the input path as a location provided on GitHub. Additional context for authentication is necessary to use this provider if the location is held within a private repository. Otherwise we can both probe GitHub's API as well as exploit the fact that it is a Git repository to retrieve information and deliver information as a Manifest format.
func NewGitProvider ¶
NewGitProvider attempts to parse a provided path as a Git repository
func NewManifestIndexProvider ¶
func NewManifestIndexProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
NewManifestIndexProvider accepts an input path which is checked against first a local file on disk and then a remote URL. If either of these checks pass, the Provider is instantiated since the path does indeed represent a ManifestIndex.
func NewManifestProvider ¶
func NewManifestProvider(ctx context.Context, path string, mopts ...ManifestOption) (Provider, error)
NewManifestProvider accepts an input path which is checked against a local file on disk and a remote URL. If populating a Manifest struct is possible given the path, then this provider is able to return list of exactly 1 manifest.
func NewProvider ¶
NewProvider ultimately returns one of the supported manifest providers by attempting an ordered instantiation based on the input source. For the provider which does not return an error is indicator that it is supported and thus the return of NewProvider a compatible interface Provider able to gather information about the manifest.
func NewProviderFromString ¶ added in v0.2.0
func NewProviderFromString(ctx context.Context, provider, path string, entity any, mopts ...ManifestOption) (Provider, error)
NewProviderFromString returns a provider based on a giving string which identifies the provider