ocm

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 37 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureCredentials

func ConfigureCredentials(ctx context.Context, ocmCtx ocm.Context, c client.Client, repositoryURL, secretRef, namespace string) error

ConfigureCredentials takes a repository url and secret ref and configures access to an OCI repository.

func ConstructRepositoryName

func ConstructRepositoryName(identity ocmmetav1.Identity) (string, error)

ConstructRepositoryName hashes the name and passes it back.

func HashIdentity

func HashIdentity(id ocmmetav1.Identity) (string, error)

HashIdentity returns the string hash of an ocm identity.

Types

type Client

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

Client implements the OCM fetcher interface.

func NewClient

func NewClient(client client.Client, cache cache.Cache) *Client

NewClient creates a new fetcher Client using the provided k8s client.

func (*Client) CreateAuthenticatedOCMContext

func (c *Client) CreateAuthenticatedOCMContext(ctx context.Context, obj *v1alpha1.ComponentVersion) (ocm.Context, error)

func (*Client) GetComponentVersion

func (c *Client) GetComponentVersion(
	_ context.Context,
	octx ocm.Context,
	repositoryURL, name, version string,
) (ocm.ComponentVersionAccess, error)

GetComponentVersion returns a component Version. It's the caller's responsibility to clean it up and close the component Version once done with it.

func (*Client) GetLatestValidComponentVersion

func (c *Client) GetLatestValidComponentVersion(
	ctx context.Context,
	octx ocm.Context,
	obj *v1alpha1.ComponentVersion,
) (string, error)

GetLatestValidComponentVersion gets the latest version that still matches the constraint.

func (*Client) GetResource

func (c *Client) GetResource(
	ctx context.Context,
	octx ocm.Context,
	cv *v1alpha1.ComponentVersion,
	resource *v1alpha1.ResourceReference,
) (io.ReadCloser, string, int64, error)

GetResource returns a reader for the resource data. It is the responsibility of the caller to close the reader.

func (*Client) ListComponentVersions

func (c *Client) ListComponentVersions(
	logger logr.Logger,
	octx ocm.Context,
	obj *v1alpha1.ComponentVersion,
) ([]Version, error)

func (*Client) TransferComponent added in v0.24.0

func (c *Client) TransferComponent(
	octx ocm.Context,
	obj *v1alpha1.ComponentVersion,
	sourceComponentVersion ocm.ComponentVersionAccess,
) error

func (*Client) VerifyComponent

func (c *Client) VerifyComponent(
	ctx context.Context,
	octx ocm.Context,
	obj *v1alpha1.ComponentVersion,
	version string,
) (bool, error)

type Contract

type Contract interface {
	CreateAuthenticatedOCMContext(ctx context.Context, obj *v1alpha1.ComponentVersion) (ocm.Context, error)
	GetResource(
		ctx context.Context,
		octx ocm.Context,
		cv *v1alpha1.ComponentVersion,
		resource *v1alpha1.ResourceReference,
	) (io.ReadCloser, string, int64, error)
	GetComponentVersion(
		ctx context.Context,
		octx ocm.Context,
		repositoryURL, name, version string,
	) (ocm.ComponentVersionAccess, error)
	GetLatestValidComponentVersion(ctx context.Context, octx ocm.Context, obj *v1alpha1.ComponentVersion) (string, error)
	ListComponentVersions(logger logr.Logger, octx ocm.Context, obj *v1alpha1.ComponentVersion) ([]Version, error)
	VerifyComponent(ctx context.Context, octx ocm.Context, obj *v1alpha1.ComponentVersion, version string) (bool, error)
	TransferComponent(
		octx ocm.Context,
		obj *v1alpha1.ComponentVersion,
		sourceComponentVersion ocm.ComponentVersionAccess,
	) error
}

Contract defines a subset of capabilities from the OCM library.

type Version

type Version struct {
	Semver  *semver.Version
	Version string
}

Version has two values to be able to sort a list but still return the actual Version. The Version might contain a `v`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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