v2

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemIdentityName    = metav1.SystemIdentityName
	SystemIdentityVersion = metav1.SystemIdentityVersion
)
View Source
const SchemaVersion = "v2"

Variables

View Source
var CDExcludes = signing.MapExcludes{
	"component": signing.MapExcludes{
		"labels":             signing.LabelExcludes,
		"repositoryContexts": nil,
		"resources": signing.DefaultedMapFields{
			Next: signing.ArrayExcludes{
				signing.MapExcludes{
					"access": nil,
					"srcRef": nil,
					"labels": signing.LabelExcludes,
				},
			},
		}.EnforceNull("extraIdentity"),
		"sources": nil,
		"componentReferences": signing.DefaultedMapFields{
			Next: signing.ArrayExcludes{
				signing.MapExcludes{
					"labels": signing.LabelExcludes,
				},
			},
		}.EnforceNull("extraIdentity"),
	},
	"signatures":    nil,
	"nestedDigests": nil,
}

CDExcludes describes the fields relevant for Signing ATTENTION: if changed, please adapt the HashEqual Functions in the generic part, accordingly.

View Source
var ErrNotFound = errors.New("NotFound")

Functions

func ConvertSourcerefsTo

func ConvertSourcerefsTo(in []SourceRef) []compdesc.SourceRef

func DefaultResources

func DefaultResources(component *ComponentDescriptor)

DefaultResources defaults a list of resources. The version of the component is defaulted for local resources that do not contain a version. adds the version as identity if the resource identity would clash otherwise.

func Validate

func Validate(fldPath *field.Path, component *ComponentDescriptor) field.ErrorList

func ValidateComponentReference

func ValidateComponentReference(fldPath *field.Path, cr ComponentReference) field.ErrorList

ValidateComponentReference validates a component reference.

func ValidateComponentReferences

func ValidateComponentReferences(fldPath *field.Path, refs ComponentReferences) field.ErrorList

ValidateComponentReferences validates a list of component references. It makes sure that no duplicate sources are present.

func ValidateObjectMeta

func ValidateObjectMeta(fldPath *field.Path, om compdesc.ObjectMetaAccessor) field.ErrorList

ValidateObjectMeta Validate the metadata of an object.

func ValidateResource

func ValidateResource(fldPath *field.Path, res Resource, access bool) field.ErrorList

ValidateResource validates a components resource.

func ValidateResources

func ValidateResources(fldPath *field.Path, resources Resources, componentVersion string) field.ErrorList

ValidateResources validates a list of resources. It makes sure that no duplicate sources are present.

func ValidateSource

func ValidateSource(fldPath *field.Path, src Source, access bool) field.ErrorList

ValidateSource validates the a component's source object.

func ValidateSourceRefs

func ValidateSourceRefs(fldPath *field.Path, srcs []SourceRef) field.ErrorList

func ValidateSources

func ValidateSources(fldPath *field.Path, sources Sources) field.ErrorList

ValidateSources validates a list of sources. It makes sure that no duplicate sources are present.

Types

type ComponentDescriptor

type ComponentDescriptor struct {
	// Metadata specifies the schema version of the component.
	Metadata metav1.Metadata `json:"meta"`
	// Spec contains the specification of the component.
	ComponentSpec `json:"component"`
	// Signatures contains a list of signatures for the ComponentDescriptor
	Signatures metav1.Signatures `json:"signatures,omitempty"`
	// NestedDigests described digest information of resources in aggregated
	// omponent versions.
	NestedDigests metav1.NestedDigests `json:"nestedDigests,omitempty"`
}

ComponentDescriptor defines a versioned component with a source and dependencies. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*ComponentDescriptor) DeepCopy

func (in *ComponentDescriptor) DeepCopy() *ComponentDescriptor

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptor.

func (*ComponentDescriptor) DeepCopyInto

func (in *ComponentDescriptor) DeepCopyInto(out *ComponentDescriptor)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ComponentDescriptor) Default

func (cd *ComponentDescriptor) Default() error

Default applies defaults to a component.

func (*ComponentDescriptor) Normalize

func (cd *ComponentDescriptor) Normalize(normAlgo string) ([]byte, error)

func (*ComponentDescriptor) SchemaVersion

func (cd *ComponentDescriptor) SchemaVersion() string

SchemeVersion returns the actual scheme version of this component descriptor representation.

func (*ComponentDescriptor) Validate

func (cd *ComponentDescriptor) Validate() error

Validate validates a parsed v2 component descriptor.

type ComponentReference

type ComponentReference struct {
	ElementMeta `json:",inline"`
	// ComponentName describes the remote name of the referenced object
	ComponentName string `json:"componentName"`
	// Digest is the optional digest of the referenced component.
	// +optional
	Digest *metav1.DigestSpec `json:"digest,omitempty"`
}

ComponentReference describes the reference to another component in the registry. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*ComponentReference) DeepCopy

func (in *ComponentReference) DeepCopy() *ComponentReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentReference.

func (*ComponentReference) DeepCopyInto

func (in *ComponentReference) DeepCopyInto(out *ComponentReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ComponentReference) GetMeta

func (r *ComponentReference) GetMeta() *ElementMeta

type ComponentReferences

type ComponentReferences []ComponentReference

func (ComponentReferences) Get

func (ComponentReferences) Len

func (r ComponentReferences) Len() int

type ComponentSpec

type ComponentSpec struct {
	ObjectMeta `json:",inline"`
	// RepositoryContexts defines the previous repositories of the component
	RepositoryContexts runtime.UnstructuredTypedObjectList `json:"repositoryContexts"`
	// Provider defines the provider type of a component.
	// It can be external or internal.
	Provider metav1.ProviderName `json:"provider"`
	// Sources defines sources that produced the component
	Sources Sources `json:"sources"`
	// ComponentReferences references component dependencies that can be resolved in the current context.
	ComponentReferences ComponentReferences `json:"componentReferences"`
	// Resources defines all resources that are created by the component and by a third party.
	Resources Resources `json:"resources"`
}

ComponentSpec defines a virtual component with a repository context, source and dependencies. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*ComponentSpec) DeepCopy

func (in *ComponentSpec) DeepCopy() *ComponentSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentSpec.

func (*ComponentSpec) DeepCopyInto

func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DescriptorVersion

type DescriptorVersion struct{}

func (*DescriptorVersion) ConvertFrom

func (*DescriptorVersion) ConvertTo

func (*DescriptorVersion) Decode

func (*DescriptorVersion) GetVersion

func (v *DescriptorVersion) GetVersion() string

type ElementAccessor

type ElementAccessor interface {
	Len() int
	Get(i int) ElementMetaAccessor
}

ElementAccessor provides generic access to list of elements.

type ElementMeta

type ElementMeta struct {
	// Name is the context unique name of the object.
	Name string `json:"name"`
	// Version is the semver version of the object.
	Version string `json:"version"`
	// ExtraIdentity is the identity of an object.
	// An additional label with key "name" ist not allowed
	ExtraIdentity metav1.Identity `json:"extraIdentity,omitempty"`
	// Labels defines an optional set of additional labels
	// describing the object.
	// +optional
	Labels metav1.Labels `json:"labels,omitempty"`
}

ElementMeta defines a object that is uniquely identified by its identity. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*ElementMeta) DeepCopy

func (in *ElementMeta) DeepCopy() *ElementMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElementMeta.

func (*ElementMeta) DeepCopyInto

func (in *ElementMeta) DeepCopyInto(out *ElementMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ElementMeta) GetIdentity

func (o *ElementMeta) GetIdentity(accessor ElementAccessor) metav1.Identity

GetIdentity returns the identity of the object.

func (*ElementMeta) GetIdentityDigest

func (o *ElementMeta) GetIdentityDigest(accessor ElementAccessor) []byte

GetIdentityDigest returns the digest of the object's identity.

func (ElementMeta) GetLabels

func (o ElementMeta) GetLabels() metav1.Labels

GetLabels returns the label of the object.

func (*ElementMeta) GetName

func (o *ElementMeta) GetName() string

GetName returns the name of the object.

func (*ElementMeta) GetRawIdentity

func (o *ElementMeta) GetRawIdentity() metav1.Identity

func (ElementMeta) GetVersion

func (o ElementMeta) GetVersion() string

GetVersion returns the version of the object.

func (*ElementMeta) SetExtraIdentity

func (o *ElementMeta) SetExtraIdentity(identity metav1.Identity)

SetExtraIdentity sets the identity of the object.

func (*ElementMeta) SetLabels

func (o *ElementMeta) SetLabels(labels []metav1.Label)

SetLabels sets the labels of the object.

func (*ElementMeta) SetName

func (o *ElementMeta) SetName(name string)

SetName sets the name of the object.

func (*ElementMeta) SetVersion

func (o *ElementMeta) SetVersion(version string)

SetVersion sets the version of the object.

type ElementMetaAccessor

type ElementMetaAccessor interface {
	GetMeta() *ElementMeta
}

ElementMetaAccessor provides generic access an elements meta information.

type ObjectMeta

type ObjectMeta struct {
	// Name is the context unique name of the object.
	Name string `json:"name"`
	// Version is the semver version of the object.
	Version string `json:"version"`
	// Labels defines an optional set of additional labels
	// describing the object.
	// +optional
	Labels metav1.Labels `json:"labels,omitempty"`
	// CreationTime is the creation time of the component version
	// +optional
	CreationTime *metav1.Timestamp `json:"creationTime,omitempty"`
}

ObjectMeta defines a object that is uniquely identified by its name and version. +k8s:deepcopy-gen=true

func (*ObjectMeta) DeepCopy

func (in *ObjectMeta) DeepCopy() *ObjectMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMeta.

func (*ObjectMeta) DeepCopyInto

func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ObjectMeta) GetLabels

func (o ObjectMeta) GetLabels() metav1.Labels

GetLabels returns the label of the object.

func (ObjectMeta) GetName

func (o ObjectMeta) GetName() string

GetName returns the name of the object.

func (ObjectMeta) GetVersion

func (o ObjectMeta) GetVersion() string

GetVersion returns the version of the object.

func (*ObjectMeta) SetLabels

func (o *ObjectMeta) SetLabels(labels []metav1.Label)

SetLabels sets the labels of the object.

func (*ObjectMeta) SetName

func (o *ObjectMeta) SetName(name string)

SetName sets the name of the object.

func (*ObjectMeta) SetVersion

func (o *ObjectMeta) SetVersion(version string)

SetVersion sets the version of the object.

type Resource

type Resource struct {
	ElementMeta `json:",inline"`

	// Type describes the type of the object.
	Type string `json:"type"`

	// Relation describes the relation of the resource to the component.
	// Can be a local or external resource
	Relation metav1.ResourceRelation `json:"relation,omitempty"`

	// SourceRef defines a list of source names.
	// These names reference the sources defines in `component.sources`.
	SourceRef []SourceRef `json:"srcRef,omitempty"`

	// Access describes the type specific method to
	// access the defined resource.
	Access *runtime.UnstructuredTypedObject `json:"access"`

	// Digest is the optional digest of the referenced resource.
	// +optional
	Digest *metav1.DigestSpec `json:"digest,omitempty"`
}

Resource describes a resource dependency of a component. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*Resource) DeepCopy

func (in *Resource) DeepCopy() *Resource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource.

func (*Resource) DeepCopyInto

func (in *Resource) DeepCopyInto(out *Resource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Resource) GetMeta

func (r *Resource) GetMeta() *ElementMeta

func (Resource) GetType

func (o Resource) GetType() string

GetType returns the type of the object.

func (*Resource) SetType

func (o *Resource) SetType(ttype string)

SetType sets the type of the object.

type Resources

type Resources []Resource

Resources describes a set of resource specifications.

func (Resources) Get

func (Resources) Len

func (r Resources) Len() int

type Source

type Source struct {
	SourceMeta `json:",inline"`

	Access *runtime.UnstructuredTypedObject `json:"access"`
}

Source is the definition of a component's source. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*Source) DeepCopy

func (in *Source) DeepCopy() *Source

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source.

func (*Source) DeepCopyInto

func (in *Source) DeepCopyInto(out *Source)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Source) GetMeta

func (s *Source) GetMeta() *ElementMeta

type SourceMeta

type SourceMeta struct {
	ElementMeta `json:",inline"`
	// Type describes the type of the object.
	Type string `json:"type"`
}

SourceMeta is the definition of the meta data of a source. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*SourceMeta) DeepCopy

func (in *SourceMeta) DeepCopy() *SourceMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceMeta.

func (*SourceMeta) DeepCopyInto

func (in *SourceMeta) DeepCopyInto(out *SourceMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (SourceMeta) GetType

func (o SourceMeta) GetType() string

GetType returns the type of the object.

func (*SourceMeta) SetType

func (o *SourceMeta) SetType(ttype string)

SetType sets the type of the object.

type SourceRef

type SourceRef struct {
	// IdentitySelector defines the identity that is used to match a source.
	IdentitySelector metav1.StringMap `json:"identitySelector,omitempty"`
	// Labels defines an optional set of additional labels
	// describing the object.
	// +optional
	Labels metav1.Labels `json:"labels,omitempty"`
}

SourceRef defines a reference to a source +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*SourceRef) DeepCopy

func (in *SourceRef) DeepCopy() *SourceRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceRef.

func (*SourceRef) DeepCopyInto

func (in *SourceRef) DeepCopyInto(out *SourceRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Sources

type Sources []Source

Sources describes a set of source specifications.

func (Sources) Get

func (r Sources) Get(i int) ElementMetaAccessor

func (Sources) Len

func (r Sources) Len() int

Directories

Path Synopsis
Package jsonscheme generated by go-bindata.// sources: ../../../../../../../resources/component-descriptor-v2-schema.yaml
Package jsonscheme generated by go-bindata.// sources: ../../../../../../../resources/component-descriptor-v2-schema.yaml

Jump to

Keyboard shortcuts

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