model

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertComponentVersionList

func ConvertComponentVersionList(componentVersionList *ComponentVersionList) (*types.ComponentDescriptorList, error)

func GetComponentDescriptor

func GetComponentDescriptor(componentVersion ComponentVersion) (*types.ComponentDescriptor, error)

GetComponentDescriptor returns the component descriptor structure. Same as method GetComponentDescriptor of the ComponentVersion, except that the present function can handle the case that the provided componentVersion is nil.

Types

type BlobResolver

type BlobResolver interface {
	Info(ctx context.Context, res types.Resource) (*types.BlobInfo, error)

	Resolve(ctx context.Context, res types.Resource, writer io.Writer) (*types.BlobInfo, error)
}

type ComponentIdentity

type ComponentIdentity struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type ComponentVersion

type ComponentVersion interface {
	// GetSchemaVersion return the used ocm schema version.
	GetSchemaVersion() string

	// GetName returns the name of the component version.
	GetName() string

	// GetVersion returns the version of the component version
	GetVersion() string

	// GetComponentDescriptor returns the component descriptor structure as *types.ComponentDescriptor.
	// Cannot be nil
	GetComponentDescriptor() *types.ComponentDescriptor

	// GetRepositoryContext return the current repository context,
	// i.e. the last entry in the list of repository contexts.
	// TODO: Remove this method
	// ocm-spec specifies that the Repository Context is supposed to be informational about the transport history. The
	// spec does not mandate to set this property and therefore, we should not program against it.
	// Cannot be nil as component versions without repository context cannot be created (for now).
	GetRepositoryContext() *types.UnstructuredTypedObject

	// GetComponentReferences returns the list of component references of the present component version.
	// (not transitively; only the references of the present component version)
	GetComponentReferences() []types.ComponentReference

	// GetComponentReference returns the component reference with the given name.
	// Note:
	// - the name is the name of the reference, not the name of the referenced component version;
	// - the returned component reference is an entry of the present component descriptor, not the referenced
	//   component version.
	// Returns nil if there is no component reference with the given name.
	GetComponentReference(name string) *types.ComponentReference

	// GetReferencedComponentVersion returns the referenced component version
	// Cannot be nil
	GetReferencedComponentVersion(ctx context.Context, ref *types.ComponentReference, repositoryContext *types.UnstructuredTypedObject, overwriter componentoverwrites.Overwriter) (ComponentVersion, error)

	// GetResource returns the resource with the given name.
	// Returns an error if there is no such resource, or more than one.
	// Currently, the Landscaper does not use the identity argument.
	GetResource(name string, identity map[string]string) (Resource, error)
}

func GetComponentVersionWithOverwriter

func GetComponentVersionWithOverwriter(ctx context.Context,
	registryAccess RegistryAccess,
	cdRef *lsv1alpha1.ComponentDescriptorReference,
	overwriter componentoverwrites.Overwriter) (ComponentVersion, error)

GetComponentVersionWithOverwriter is like registryAccess.GetComponentVersion, but applies the given overwrites first.

type ComponentVersionList

type ComponentVersionList struct {
	Metadata types.Metadata `json:"meta"`

	// Components contain all resolvable components with their dependencies
	Components []ComponentVersion `json:"components"`
}

func GetTransitiveComponentReferences

func GetTransitiveComponentReferences(ctx context.Context,
	componentVersion ComponentVersion,
	repositoryContext *types.UnstructuredTypedObject,
	overwriter componentoverwrites.Overwriter) (*ComponentVersionList, error)

GetTransitiveComponentReferences returns a list of ComponentVersions that consists of the current one and all which are transitively referenced by it.

func (*ComponentVersionList) GetComponentVersion

func (c *ComponentVersionList) GetComponentVersion(name, version string) (ComponentVersion, error)

func (*ComponentVersionList) GetComponentVersionByName

func (c *ComponentVersionList) GetComponentVersionByName(name string) []ComponentVersion

type Factory

type Factory interface {
	// NewRegistryAccess provides an instance of a RegistryAccess, which is an interface for dealing with ocm
	// components.Technically, it is a facade either backed by the [component-cli] or by the [ocmlib].
	//
	// fs allows to pass a file system that is considered for resolving local components or artifacts as well as other
	// local resources such as dockerconfig files specified in the ociRegistryConfig. If nil is passed, the hosts
	// file system is used.
	//
	// secrets allows to pass in credentials of specific types (such as dockerconfigjson or
	// credentials.config.ocm.software although the latter only works with the ocmlib backed implementation and are
	// ignored otherwise) that will be considered when accessing registries.
	//
	// localRegistryConfig allows to pass in a root path. This root path may already point to a local ocm repository (in
	// which case it is sufficient to specify that the repository context is of type "local" in the component reference
	// when trying to get a component version) or it may point to a directory above (in which case the repository
	// context has to be further specified).
	//
	// ociRegistryConfig allows to provide configuration for the oci client used to access artifacts in oci registries.
	// The OCICacheConfiguration only influences the component-cli backed implementation and is ignored otherwise, since
	// the ocmlib backed implementation uses an ocmlib internal cache for oci artifacts.
	//
	// inlineCd allows to pass a component descriptor into the RegistryAccess, so the described component can later be
	// resolved through it. This is primarily used to pass in the inline component descriptors specified in
	// installations. Local artifacts described in inline component descriptors can be resolved based on the fs and the
	// localRegistryConfig. Referenced components in remote repositories can be resolved based on the repository context
	// of the inline component descriptor itself.
	//
	// additionalBlobResolvers allows to pass in additional blob resolvers. These are only used by the component-cli
	// backed implementation and are ignored otherwise.
	//
	// [component-cli]: https://github.com/gardener/component-cli
	// [ocmlib]: https://github.com/open-component-model/ocm
	NewRegistryAccess(ctx context.Context, options *RegistryAccessOptions) (RegistryAccess, error)

	// NewHelmRepoResource returns a helm chart resource that is stored in a helm chart repository.
	NewHelmRepoResource(ctx context.Context,
		ocmconfig *corev1.ConfigMap,
		helmChartRepo *helmv1alpha1.HelmChartRepo,
		lsClient client.Client,
		contextObj *lsv1alpha1.Context) (TypedResourceProvider, error)

	// NewHelmOCIResource returns a helm chart resource that is stored in an OCI registry.
	NewHelmOCIResource(ctx context.Context,
		fs vfs.FileSystem,
		ocmconfig *corev1.ConfigMap,
		ociImageRef string,
		registryPullSecrets []corev1.Secret,
		ociConfig *config.OCIConfiguration) (TypedResourceProvider, error)
}

type GlobalResourceIdentity

type GlobalResourceIdentity struct {
	ComponentIdentity ComponentIdentity `json:"component"`
	ResourceIdentity  v1.Identity       `json:"resource"`
}

type RegistryAccess

type RegistryAccess interface {
	GetComponentVersion(ctx context.Context, cdRef *lsv1alpha1.ComponentDescriptorReference) (ComponentVersion, error)

	//VerifySignature calls the ocm lib to verify the named signature in the component version with the public key or ca cert data.
	VerifySignature(componentVersion ComponentVersion, name string, pkeyData []byte, caCertData []byte) error
}

type RegistryAccessOptions added in v0.109.0

type RegistryAccessOptions struct {
	Fs                  vfs.FileSystem
	OcmConfig           *corev1.ConfigMap
	Secrets             []corev1.Secret
	LocalRegistryConfig *config.LocalRegistryConfiguration
	OciRegistryConfig   *config.OCIConfiguration
	InlineCd            *types.ComponentDescriptor
}

type Resource

type Resource interface {
	TypedResourceProvider

	// GetName returns the name by which the resource can be identified among all resources of a component version.
	GetName() string

	// GetVersion is a design error.
	GetVersion() string

	// GetType returns the type of the resource. It indicates whether the resource is for example a blueprint,
	// helm chart, or json schema. (Not to be confused with the access type.)
	GetType() string

	// GetAccessType returns the access type of the resource, for example: "localOciBlob" (cdv2.LocalOCIBlobType)
	GetAccessType() string

	// GetResource returns the entry in the component descriptor that corresponds to the present resource.
	GetResource() (*types.Resource, error)
}

type TypedResourceContent

type TypedResourceContent struct {
	Type     string
	Resource interface{}
}

type TypedResourceProvider

type TypedResourceProvider interface {
	GetTypedContent(ctx context.Context) (*TypedResourceContent, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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