compdesc

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 32 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KIND_COMPONENT        = errkind.KIND_COMPONENT
	KIND_COMPONENTVERSION = "component version"
	KIND_RESOURCE         = "component resource"
	KIND_SOURCE           = "component source"
	KIND_REFERENCE        = "component reference"
)
View Source
const (
	SystemIdentityName    = metav1.SystemIdentityName
	SystemIdentityVersion = metav1.SystemIdentityVersion
)
View Source
const (
	LocalRelation    = metav1.LocalRelation
	ExternalRelation = metav1.ExternalRelation

	NoDigest = metav1.NoDigest
)
View Source
const (
	NoneType       = "none"
	NoneLegacyType = "None"
)

Type is the access type for no blob.

View Source
const (
	KIND_HASH_ALGORITHM   = signutils.KIND_HASH_ALGORITHM
	KIND_SIGN_ALGORITHM   = signutils.KIND_SIGN_ALGORITHM
	KIND_NORM_ALGORITHM   = signutils.KIND_NORM_ALGORITHM
	KIND_VERIFY_ALGORITHM = signutils.KIND_VERIFY_ALGORITHM
	KIND_PUBLIC_KEY       = signutils.KIND_PUBLIC_KEY
	KIND_PRIVATE_KEY      = signutils.KIND_PRIVATE_KEY
	KIND_SIGNATURE        = signutils.KIND_SIGNATURE
	KIND_DIGEST           = signutils.KIND_DIGEST
)
View Source
const ComponentDescriptorFileName = "component-descriptor.yaml"
View Source
const DefaultSchemeVersion = "v2"
View Source
const InternalSchemaVersion = "internal"

Variables

View Source
var (
	REALM  = logging.DefineSubRealm("component descriptor handling", "compdesc")
	Logger = logging.DynamicLogger(REALM)
)

DefaultJSONCodec implements Codec interface with the json decoder encoder.

View Source
var DefaultSchemes = Schemes{}
View Source
var DefaultYAMLCodec = CodecWrapper{
	Decoder:       DecoderFunc(func(data []byte, obj interface{}) error { return yaml.Unmarshal(data, obj) }),
	StrictDecoder: StrictDecoderFunc(func(data []byte, obj interface{}) error { return yaml.UnmarshalStrict(data, obj) }),
	Encoder:       EncoderFunc(yaml.Marshal),
}

DefaultYAMLCodec implements Codec interface with the yaml decoder encoder.

View Source
var Normalizations = NormalizationAlgorithms{/* contains filtered or unexported fields */}
View Source
var NotFound = errors.ErrNotFound()

Deprecated: as result of the new select function an empty list is returned instead of an error.

Functions

func CatchConversionError

func CatchConversionError(errp *error)

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 ElementIndex

func ElementIndex(acc ElementListAccessor, metaprovider ElementMetaProvider) int

ElementIndex determines the index of an element in the element list for a given ElementMeta. If no element is found -1 is returned.

func Encode

func Encode(obj *ComponentDescriptor, opts ...EncodeOption) ([]byte, error)

Encode encodes a component into the given object. If the serialization version is left blank, the schema version configured in the component descriptor will be used.

func GetIndexByIdentity

func GetIndexByIdentity(a ElementListAccessor, id metav1.Identity) int

func Hash

func Hash(cd *ComponentDescriptor, normAlgo string, hash hash.Hash) (string, error)

Hash return the hash for the component-descriptor, if it is normalizeable (= componentReferences and resources contain digest field).

func IsIdentity

func IsIdentity(s string) bool

func IsNoneAccess

func IsNoneAccess(a AccessSpec) bool

func IsNoneAccessKind

func IsNoneAccessKind(kind string) bool

func MapToSelectorElementList

func MapToSelectorElementList(accessor ElementListAccessor) accessors.ElementListAccessor

func MapToSelectorReference

func MapToSelectorReference(r *Reference) accessors.ReferenceAccessor

func MapToSelectorResource

func MapToSelectorResource(r *Resource) accessors.ResourceAccessor

func MapToSelectorSource

func MapToSelectorSource(r *Source) accessors.SourceAccessor

func MatchResourceReference added in v0.15.0

func NormHash

func NormHash(cd *ComponentDescriptor, normAlgo string, hash hash.Hash) ([]byte, string, error)

func Normalize

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

func RegisterScheme

func RegisterScheme(scheme Scheme)

func ResolveResourceReference added in v0.15.0

func Sign

func Sign(cctx credentials.Context, cd *ComponentDescriptor, privateKey signutils.GenericPrivateKey, signer signing.Signer, hasher signing.Hasher, signatureName, issuer string) error

Sign signs the given component-descriptor with the signer. The component-descriptor has to contain digests for componentReferences and resources.

func ThrowConversionError

func ThrowConversionError(err error)

func Validate

func Validate(desc *ComponentDescriptor) error

func Verify

func Verify(cd *ComponentDescriptor, registry signing.Registry, signatureName string, rootCA ...signutils.GenericCertificatePool) error

Verify verifies the signature (selected by signatureName) and hash of the component-descriptor (as specified in the signature). Does NOT resolve resources or referenced component-descriptors. Returns error if verification fails.

func WithSigning

func WithSigning(b ...bool)

func WithVersion

func WithVersion(v string)

Types

type AccessProvider

type AccessProvider interface {
	GetAccess() AccessSpec
}

AccessProvider provides access to an access specification of elements.

type AccessSpec

type AccessSpec = accessors.AccessSpec

AccessSpec is an abstract specification of an access method The outbound object is typicall a runtime.UnstructuredTypedObject. Inbound any serializable AccessSpec implementation is possible.

func GenericAccessSpec

func GenericAccessSpec(un *runtime.UnstructuredTypedObject) AccessSpec

GenericAccessSpec returns a generic AccessSpec implementation for an unstructured object. It can always be used instead of a dedicated access spec implementation. The core methods will map these spec into effective ones before an access is returned to the caller.

type ArtifactAccess

type ArtifactAccess func(cd *ComponentDescriptor) ArtifactAccessor

ArtifactAccess provides access to a dedicated kind of artifact set in the component descriptor (resources or sources).

type ArtifactAccessor

type ArtifactAccessor interface {
	ElementListAccessor
	GetArtifact(i int) ElementArtifactAccessor
}

ArtifactAccessor provides generic access to list of artifacts. There are resources or sources.

func ResourceArtifacts

func ResourceArtifacts(cd *ComponentDescriptor) ArtifactAccessor

func SourceArtifacts

func SourceArtifacts(cd *ComponentDescriptor) ArtifactAccessor

type ArtifactMetaAccess

type ArtifactMetaAccess interface {
	ElementMetaAccess
	GetType() string
	SetType(string)
}

type ArtifactMetaPointer

type ArtifactMetaPointer[P any] interface {
	ArtifactMetaAccess
	*P
}

ArtifactMetaPointer is a pointer to an artifact meta object.

type Codec

type Codec interface {
	Decoder
	StrictDecoder
	Encoder
}

Codec describes an encoding for en object.

type CodecWrapper

type CodecWrapper struct {
	Decoder
	StrictDecoder
	Encoder
}

CodecWrapper is a simple struct that implements the Codec interface.

func (CodecWrapper) ApplyDecodeOption

func (o CodecWrapper) ApplyDecodeOption(options *DecodeOptions)

ApplyDecodeOption applies the configured codec.

func (CodecWrapper) ApplyEncodeOption

func (o CodecWrapper) ApplyEncodeOption(options *EncodeOptions)

ApplyEncodeOption applies the configured codec.

type CompDescDigest

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

type CompDescDigests

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

func NewCompDescDigests

func NewCompDescDigests(cd *ComponentDescriptor) *CompDescDigests

func (*CompDescDigests) Descriptor

func (d *CompDescDigests) Descriptor() *ComponentDescriptor

func (*CompDescDigests) Get

func (d *CompDescDigests) Get(normAlgo string, hasher signing.Hasher) ([]byte, string, error)

type ComponentDescriptor

type ComponentDescriptor struct {
	// Metadata specifies the schema version of the component.
	Metadata 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"`

	// NestedDigets describe calculated resource digests for aggregated
	// component versions, which might not be persisted, but incorporated
	// into signatures of the actual component version
	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 Decode

func Decode(data []byte, opts ...DecodeOption) (*ComponentDescriptor, error)

Decode decodes a component into the given object.

func DefaultComponent

func DefaultComponent(component *ComponentDescriptor) *ComponentDescriptor

DefaultComponent applies defaults to a component.

func New

func New(name, version string) *ComponentDescriptor

func ResolveReferencePath added in v0.15.0

func ResolveReferencePath(cv *ComponentDescriptor, path []metav1.Identity, resolver ComponentVersionResolver) (*ComponentDescriptor, error)

func (*ComponentDescriptor) AddRepositoryContext

func (cd *ComponentDescriptor) AddRepositoryContext(repoCtx runtime.TypedObject) error

AddRepositoryContext appends the given repository context to components descriptor repository history. The context is not appended if the effective repository context already matches the current context.

func (*ComponentDescriptor) Copy

func (*ComponentDescriptor) Equal

func (cd *ComponentDescriptor) Equal(obj interface{}) bool

func (*ComponentDescriptor) Equivalent

func (*ComponentDescriptor) GetEffectiveRepositoryContext

func (cd *ComponentDescriptor) GetEffectiveRepositoryContext() *runtime.UnstructuredTypedObject

GetEffectiveRepositoryContext returns the currently active repository context.

func (*ComponentDescriptor) GetReferenceByIdentity

func (cd *ComponentDescriptor) GetReferenceByIdentity(id v1.Identity) (Reference, error)

GetReferenceByIdentity returns reference that matches the given identity.

func (*ComponentDescriptor) GetReferenceIndex

func (cd *ComponentDescriptor) GetReferenceIndex(src ElementMetaProvider) int

GetReferenceIndex returns the index of a given source. If the index is not found -1 is returned.

func (*ComponentDescriptor) GetReferenceIndexByIdentity

func (cd *ComponentDescriptor) GetReferenceIndexByIdentity(id v1.Identity) int

GetReferenceIndexByIdentity returns the index of the reference that matches the given identity.

func (*ComponentDescriptor) GetReferences

func (cd *ComponentDescriptor) GetReferences() References

func (*ComponentDescriptor) GetResourceByIdentity

func (cd *ComponentDescriptor) GetResourceByIdentity(id v1.Identity) (Resource, error)

GetResourceByIdentity returns resource that matches the given identity.

func (*ComponentDescriptor) GetResourceIndex

func (cd *ComponentDescriptor) GetResourceIndex(res *ResourceMeta) int

GetResourceIndex returns the index of a given resource. If the index is not found -1 is returned.

func (*ComponentDescriptor) GetResourceIndexByIdentity

func (cd *ComponentDescriptor) GetResourceIndexByIdentity(id v1.Identity) int

GetResourceIndexByIdentity returns the index of the resource that matches the given identity.

func (*ComponentDescriptor) GetResources

func (cd *ComponentDescriptor) GetResources() Resources

func (*ComponentDescriptor) GetSignatureIndex

func (cd *ComponentDescriptor) GetSignatureIndex(name string) int

GetSignatureIndex returns the index of the signature with the given name If the index is not found -1 is returned.

func (*ComponentDescriptor) GetSourceByIdentity

func (cd *ComponentDescriptor) GetSourceByIdentity(id v1.Identity) (Source, error)

GetSourceByIdentity returns source that match the given identity.

func (*ComponentDescriptor) GetSourceIndex

func (cd *ComponentDescriptor) GetSourceIndex(src *SourceMeta) int

GetSourceIndex returns the index of a given source. If the index is not found -1 is returned.

func (*ComponentDescriptor) GetSourceIndexByIdentity

func (cd *ComponentDescriptor) GetSourceIndexByIdentity(id v1.Identity) int

GetSourceIndexByIdentity returns the index of the source that matches the given identity.

func (*ComponentDescriptor) GetSources

func (cd *ComponentDescriptor) GetSources() Sources

func (*ComponentDescriptor) HasResourceDigests

func (cd *ComponentDescriptor) HasResourceDigests() bool

func (*ComponentDescriptor) IsNormalizeable

func (cd *ComponentDescriptor) IsNormalizeable() error

IsNormalizeable checks if componentReferences and resources contain digest. Resources are allowed to omit the digest, if res.access.type == None or res.access == nil. Does NOT verify if the digests are correct.

func (*ComponentDescriptor) Reset

func (cd *ComponentDescriptor) Reset()

func (*ComponentDescriptor) SchemaVersion

func (cd *ComponentDescriptor) SchemaVersion() string

SchemaVersion returns the scheme version configured in the representation.

func (*ComponentDescriptor) SelectReferences

func (cd *ComponentDescriptor) SelectReferences(sel ...refsel.Selector) (References, error)

func (*ComponentDescriptor) SelectResources

func (cd *ComponentDescriptor) SelectResources(sel ...rscsel.Selector) (Resources, error)

func (*ComponentDescriptor) SelectSignatureByName

func (cd *ComponentDescriptor) SelectSignatureByName(signatureName string) *metav1.Signature

SelectSignatureByName returns the Signature (Digest and SigantureSpec) matching the given name.

func (*ComponentDescriptor) SelectSources

func (cd *ComponentDescriptor) SelectSources(sel ...srcsel.Selector) (Sources, error)

type ComponentDescriptorVersion

type ComponentDescriptorVersion interface {
	SchemaVersion() string
	GetName() string
	GetVersion() string
	Normalize(normAlgo string) ([]byte, error)
}

func Convert

Convert converts a component descriptor into a dedicated scheme version. If the serialization version is left blank, the schema version configured in the component descriptor will be used.

type ComponentSpec

type ComponentSpec struct {
	metav1.ObjectMeta `json:",inline"`
	// RepositoryContexts defines the previous repositories of the component
	RepositoryContexts runtime.UnstructuredTypedObjectList `json:"repositoryContexts"`
	// Sources defines sources that produced the component
	Sources Sources `json:"sources"`
	// References references component dependencies that can be resolved in the current context.
	References References `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

type ComponentVersionResolver added in v0.15.0

type ComponentVersionResolver interface {
	LookupComponentVersion(name string, version string) (*ComponentDescriptor, error)
}

func NewCompoundResolver added in v0.15.0

func NewCompoundResolver(res ...ComponentVersionResolver) ComponentVersionResolver

type ComponentVersionSet added in v0.15.0

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

func NewComponentVersionSet added in v0.15.0

func NewComponentVersionSet(cds ...*ComponentDescriptor) *ComponentVersionSet

func (*ComponentVersionSet) AddVersion added in v0.15.0

func (c *ComponentVersionSet) AddVersion(cd *ComponentDescriptor)

func (*ComponentVersionSet) LookupComponentVersion added in v0.15.0

func (c *ComponentVersionSet) LookupComponentVersion(name string, version string) (*ComponentDescriptor, error)

type CompoundResolver added in v0.15.0

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

func (*CompoundResolver) AddResolver added in v0.15.0

func (c *CompoundResolver) AddResolver(r ComponentVersionResolver)

func (*CompoundResolver) LookupComponentVersion added in v0.15.0

func (c *CompoundResolver) LookupComponentVersion(name string, version string) (*ComponentDescriptor, error)

type DecodeOption

type DecodeOption interface {
	ApplyDecodeOption(options *DecodeOptions)
}

DecodeOption is the interface to specify different cache options.

type DecodeOptions

type DecodeOptions struct {
	Codec             Codec
	DisableValidation bool
	StrictMode        bool
}

DecodeOptions defines decode options for the codec.

func (*DecodeOptions) ApplyDecodeOption

func (o *DecodeOptions) ApplyDecodeOption(options *DecodeOptions)

ApplyDecodeOption applies the actual options.

func (*DecodeOptions) ApplyOptions

func (o *DecodeOptions) ApplyOptions(opts []DecodeOption) *DecodeOptions

ApplyOptions applies the given list options on these options, and then returns itself (for convenient chaining).

type Decoder

type Decoder interface {
	Decode(data []byte, obj interface{}) error
}

Decoder defines a decoder for an object.

type DecoderFunc

type DecoderFunc func(data []byte, obj interface{}) error

DecoderFunc is a simple function that implements the Decoder interface.

func (DecoderFunc) Decode

func (e DecoderFunc) Decode(data []byte, obj interface{}) error

Decode is the Decode implementation of the Decoder interface.

type DigestSpec

type DigestSpec = metav1.DigestSpec

func NewExcludeFromSignatureDigest

func NewExcludeFromSignatureDigest() *DigestSpec

type DisableValidation

type DisableValidation bool

DisableValidation enables or disables validation of the component descriptor.

func (DisableValidation) ApplyDecodeOption

func (v DisableValidation) ApplyDecodeOption(options *DecodeOptions)

ApplyDecodeOption applies the validation disable option.

type Element added in v0.15.0

type Element = accessors.Element

type ElementArtifactAccessor

type ElementArtifactAccessor interface {
	ElementMetaAccessor
	GetType() string
	GetAccess() AccessSpec
	SetAccess(a AccessSpec)
}

ElementArtifactAccessor provides access to generic artifact information of an element.

type ElementDigestAccessor

type ElementDigestAccessor interface {
	GetDigest() *metav1.DigestSpec
	SetDigest(*metav1.DigestSpec)
}

type ElementListAccessor added in v0.15.0

type ElementListAccessor = accessors.ElementListAccessor

ElementListAccessor 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) AddExtraIdentity

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

func (*ElementMeta) Copy

func (o *ElementMeta) Copy() *ElementMeta

func (*ElementMeta) Equivalent

func (o *ElementMeta) Equivalent(a *ElementMeta) equivalent.EqualState

func (*ElementMeta) GetExtraIdentity

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

GetExtraIdentity returns the extra identity of the object.

func (*ElementMeta) GetIdentity

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

GetIdentity returns the identity of the object.

func (*ElementMeta) GetIdentityDigest

func (o *ElementMeta) GetIdentityDigest(accessor ElementListAccessor) []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) GetMatchBaseIdentity

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

GetMatchBaseIdentity returns all possible identity attributes for resource matching.

func (*ElementMeta) GetMeta

func (r *ElementMeta) GetMeta() accessors.ElementMeta

GetMeta returns the element meta.

func (*ElementMeta) GetName

func (o *ElementMeta) GetName() string

GetName returns the name of the object.

func (*ElementMeta) GetRawIdentity

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

GetRawIdentity returns the identity plus version, if set.

func (*ElementMeta) GetVersion

func (o *ElementMeta) GetVersion() string

GetVersion returns the version of the object.

func (*ElementMeta) RemoveLabel

func (o *ElementMeta) RemoveLabel(name string) bool

RemoveLabel removes a single label.

func (*ElementMeta) SetExtraIdentity

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

SetExtraIdentity sets the identity of the object.

func (*ElementMeta) SetLabel

func (o *ElementMeta) SetLabel(name string, value interface{}, opts ...metav1.LabelOption) error

SetLabel sets a single label to an effective value. If the value is no byte slice, it is marshaled.

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 ElementMetaAccess

type ElementMetaAccess interface {
	GetName() string
	GetVersion() string
	GetIdentity(accessor ElementListAccessor) metav1.Identity
	GetLabels() metav1.Labels
}

type ElementMetaAccessor

type ElementMetaAccessor = accessors.Element

ElementMetaAccessor provides generic access an elements meta information. Deprecated: use Element.

type ElementMetaProvider

type ElementMetaProvider interface {
	GetMeta() accessors.ElementMeta
}

type EncodeOption

type EncodeOption interface {
	ApplyEncodeOption(options *EncodeOptions)
}

EncodeOption is the interface to specify different encode options.

type EncodeOptions

type EncodeOptions struct {
	Codec         Codec
	SchemaVersion string
}

func (*EncodeOptions) ApplyEncodeOption

func (o *EncodeOptions) ApplyEncodeOption(options *EncodeOptions)

ApplyDecodeOption applies the actual options.

func (*EncodeOptions) ApplyOptions

func (o *EncodeOptions) ApplyOptions(opts []EncodeOption) *EncodeOptions

ApplyOptions applies the given list options on these options, and then returns itself (for convenient chaining).

func (*EncodeOptions) DefaultFor

func (o *EncodeOptions) DefaultFor(cd *ComponentDescriptor) *EncodeOptions

type Encoder

type Encoder interface {
	Encode(obj interface{}) ([]byte, error)
}

Encoder defines a encoder for an object.

type EncoderFunc

type EncoderFunc func(obj interface{}) ([]byte, error)

EncoderFunc is a simple function that implements the Encoder interface.

func (EncoderFunc) Encode

func (e EncoderFunc) Encode(obj interface{}) ([]byte, error)

Encode is the Encode implementation of the Encoder interface.

type GenericComponentDescriptor added in v0.15.0

type GenericComponentDescriptor ComponentDescriptor

func (*GenericComponentDescriptor) Descriptor added in v0.15.0

func (GenericComponentDescriptor) MarshalJSON added in v0.15.0

func (g GenericComponentDescriptor) MarshalJSON() ([]byte, error)

func (*GenericComponentDescriptor) UnmarshalJSON added in v0.15.0

func (g *GenericComponentDescriptor) UnmarshalJSON(bytes []byte) error

type Identity

type Identity = metav1.Identity

func NewExtraIdentity

func NewExtraIdentity(extras ...string) Identity

func NewIdentity

func NewIdentity(name string, extras ...string) Identity

type Label

type Label = metav1.Label

type LabelOption

type LabelOption = metav1.LabelOption

type Labels

type Labels = metav1.Labels

type LabelsAccessor

type LabelsAccessor interface {
	// GetLabels returns the labels of the object.
	GetLabels() metav1.Labels
	// SetLabels sets the labels of the object.
	SetLabels(labels []metav1.Label)
}

LabelsAccessor describes a accessor for a labeled object.

type Metadata

type Metadata struct {
	ConfiguredVersion string `json:"configuredSchemaVersion"`
}

Metadata defines the configured metadata of the component descriptor. It is taken from the original serialization format. It can be set to define a default serialization version.

type NameAccessor

type NameAccessor interface {
	// GetName returns the name of the object.
	GetName() string
	// SetName sets the name of the object.
	SetName(name string)
}

NameAccessor describes a accessor for a named object.

type NormalisationAlgorithm

type NormalisationAlgorithm = string

NormalisationAlgorithm types and versions the algorithm used for digest generation.

const (
	JsonNormalisationV1 NormalisationAlgorithm = "jsonNormalisation/v1"
	JsonNormalisationV2 NormalisationAlgorithm = "jsonNormalisation/v2"
)

type Normalization

type Normalization interface {
	Normalize(cd *ComponentDescriptor) ([]byte, error)
}

type NormalizationAlgorithms

type NormalizationAlgorithms struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*NormalizationAlgorithms) Get

func (*NormalizationAlgorithms) Names

func (n *NormalizationAlgorithms) Names() []string

func (*NormalizationAlgorithms) Normalize

func (n *NormalizationAlgorithms) Normalize(cd *ComponentDescriptor, algo string) ([]byte, error)

func (*NormalizationAlgorithms) Register

func (n *NormalizationAlgorithms) Register(name string, norm Normalization)

type ObjectMeta

type ObjectMeta = metav1.ObjectMeta

type ObjectMetaAccessor

type ObjectMetaAccessor interface {
	NameAccessor
	VersionAccessor
	LabelsAccessor
}

ObjectMetaAccessor describes a accessor for named and versioned object.

type Provider

type Provider = metav1.Provider

type ProviderName

type ProviderName = metav1.ProviderName

type Reference added in v0.15.0

type Reference 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"`
}

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

func NewComponentReference

func NewComponentReference(name, componentName, version string, extraIdentity metav1.Identity) *Reference

func (*Reference) Copy added in v0.15.0

func (r *Reference) Copy() *Reference

func (*Reference) Equivalent added in v0.15.0

func (*Reference) Fresh added in v0.15.0

func (o *Reference) Fresh() *Reference

Fresh returns a digest-free copy.

func (*Reference) GetComponentName added in v0.15.0

func (r *Reference) GetComponentName() string

func (*Reference) GetDigest added in v0.15.0

func (r *Reference) GetDigest() *metav1.DigestSpec

func (*Reference) SetDigest added in v0.15.0

func (r *Reference) SetDigest(d *metav1.DigestSpec)

func (Reference) String added in v0.15.0

func (r Reference) String() string

func (*Reference) WithExtraIdentity added in v0.15.0

func (o *Reference) WithExtraIdentity(extras ...string) *Reference

WithExtraIdentity returns a new reference with a dedicated version.

func (*Reference) WithVersion added in v0.15.0

func (o *Reference) WithVersion(v string) *Reference

WithVersion returns a new reference with a dedicated version.

type References

type References []Reference

func (References) Copy

func (r References) Copy() References

func (References) Equivalent

func (r References) Equivalent(o References) equivalent.EqualState

func (References) Get

func (References) Len

func (r References) Len() int

func (References) Less

func (r References) Less(i, j int) bool

func (References) Swap

func (r References) Swap(i, j int)

type Resource

type Resource struct {
	ResourceMeta `json:",inline"`
	// Access describes the type specific method to
	// access the defined resource.
	Access AccessSpec `json:"access"`
}

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

func (*Resource) Copy

func (r *Resource) Copy() *Resource

func (*Resource) Equivalent

func (*Resource) GetAccess

func (r *Resource) GetAccess() AccessSpec

func (*Resource) GetDigest

func (r *Resource) GetDigest() *metav1.DigestSpec

func (*Resource) GetRelation

func (r *Resource) GetRelation() metav1.ResourceRelation

func (*Resource) SetAccess

func (r *Resource) SetAccess(a AccessSpec)

func (*Resource) SetDigest

func (r *Resource) SetDigest(d *metav1.DigestSpec)

type ResourceMeta

type ResourceMeta 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"`

	// SourceRefs defines a list of source names.
	// These entries reference the sources defined in the
	// component.sources.
	SourceRefs SourceRefs `json:"srcRefs,omitempty"`

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

ResourceMeta describes the meta data of a resource. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func NewResourceMeta

func NewResourceMeta(name string, typ string, relation metav1.ResourceRelation) *ResourceMeta

func (*ResourceMeta) Copy

func (o *ResourceMeta) Copy() *ResourceMeta

Copy copies a resource meta.

func (*ResourceMeta) Fresh

func (o *ResourceMeta) Fresh() *ResourceMeta

Fresh returns a digest-free copy.

func (*ResourceMeta) GetType

func (o *ResourceMeta) GetType() string

GetType returns the type of the object.

func (*ResourceMeta) SetDigest

func (o *ResourceMeta) SetDigest(d *metav1.DigestSpec)

SetDigest sets the digest of the object.

func (*ResourceMeta) SetType

func (o *ResourceMeta) SetType(ttype string)

SetType sets the type of the object.

func (*ResourceMeta) WithExtraIdentity

func (o *ResourceMeta) WithExtraIdentity(extras ...string) *ResourceMeta

func (*ResourceMeta) WithLabel

func (o *ResourceMeta) WithLabel(l *Label) *ResourceMeta

func (*ResourceMeta) WithVersion

func (o *ResourceMeta) WithVersion(v string) *ResourceMeta

type ResourceRelation

type ResourceRelation = metav1.ResourceRelation

type Resources

type Resources []Resource

Resources describes a set of resource specifications.

func (Resources) Copy

func (r Resources) Copy() Resources

func (Resources) Equivalent

func (r Resources) Equivalent(o Resources) equivalent.EqualState

func (Resources) Get

func (Resources) GetArtifact

func (r Resources) GetArtifact(i int) ElementArtifactAccessor

func (Resources) HaveDigests

func (r Resources) HaveDigests() bool

func (Resources) Len

func (r Resources) Len() int

type SchemaVersion

type SchemaVersion string

SchemaVersion enforces a dedicated schema version .

func (SchemaVersion) ApplyEncodeOption

func (o SchemaVersion) ApplyEncodeOption(options *EncodeOptions)

ApplyEncodeOption applies the configured schema version.

type Scheme

type Scheme interface {
	GetVersion() string

	Decode(data []byte, opts *DecodeOptions) (ComponentDescriptorVersion, error)
	ConvertFrom(desc *ComponentDescriptor) (ComponentDescriptorVersion, error)
	ConvertTo(ComponentDescriptorVersion) (*ComponentDescriptor, error)
}

type Schemes

type Schemes map[string]Scheme

func (Schemes) Names

func (v Schemes) Names() []string

func (Schemes) Register

func (v Schemes) Register(scheme Scheme)

type Signature

type Signature = metav1.Signature

type SignatureSpec

type SignatureSpec = metav1.SignatureSpec

type Signatures

type Signatures = metav1.Signatures

type Source

type Source struct {
	SourceMeta `json:",inline"`
	Access     AccessSpec `json:"access"`
}

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

func (*Source) Copy

func (s *Source) Copy() *Source

func (*Source) Equivalent

func (*Source) GetAccess

func (s *Source) GetAccess() AccessSpec

func (*Source) SetAccess

func (r *Source) SetAccess(a AccessSpec)

type SourceMeta

type SourceMeta struct {
	ElementMeta
	// 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 NewSourceMeta

func NewSourceMeta(name, typ string) *SourceMeta

func (*SourceMeta) Copy

func (o *SourceMeta) Copy() *SourceMeta

Copy copies a source meta.

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.

func (*SourceMeta) WithExtraIdentity

func (o *SourceMeta) WithExtraIdentity(extras ...string) *SourceMeta

func (*SourceMeta) WithLabel

func (o *SourceMeta) WithLabel(l *Label) *SourceMeta

func (*SourceMeta) WithVersion

func (o *SourceMeta) WithVersion(v string) *SourceMeta

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) Copy

func (r *SourceRef) Copy() *SourceRef

Copy copy a source ref.

type SourceRefs

type SourceRefs []SourceRef

func (SourceRefs) Copy

func (r SourceRefs) Copy() SourceRefs

Copy copies a list of source refs.

type Sources

type Sources []Source

Sources describes a set of source specifications.

func (Sources) Copy

func (s Sources) Copy() Sources

func (Sources) Equivalent

func (r Sources) Equivalent(o Sources) equivalent.EqualState

func (Sources) Get

func (s Sources) Get(i int) ElementMetaAccessor

func (Sources) GetArtifact

func (s Sources) GetArtifact(i int) ElementArtifactAccessor

func (Sources) Len

func (s Sources) Len() int

type StrictDecoder

type StrictDecoder interface {
	DecodeStrict(data []byte, obj interface{}) error
}

StrictDecoder defines a decoder for an object.

type StrictDecoderFunc

type StrictDecoderFunc func(data []byte, obj interface{}) error

StrictDecoderFunc is a simple function that implements the StrictDecoder interface.

func (StrictDecoderFunc) DecodeStrict

func (e StrictDecoderFunc) DecodeStrict(data []byte, obj interface{}) error

StrictDecode is the Decode implementation of the Decoder interface.

type StrictMode

type StrictMode bool

StrictMode enables or disables strict mode parsing.

func (StrictMode) ApplyDecodeOption

func (s StrictMode) ApplyDecodeOption(options *DecodeOptions)

ApplyDecodeOption applies the configured strict mode.

type Timestamp

type Timestamp = metav1.Timestamp

func NewTimestamp

func NewTimestamp() Timestamp

func NewTimestampFor

func NewTimestampFor(t time.Time) Timestamp

func NewTimestampP

func NewTimestampP() *Timestamp

func NewTimestampPFor

func NewTimestampPFor(t time.Time) *Timestamp

type VersionAccessor

type VersionAccessor interface {
	// GetVersion returns the version of the object.
	GetVersion() string
	// SetVersion sets the version of the object.
	SetVersion(version string)
}

VersionAccessor describes a accessor for a versioned object.

Directories

Path Synopsis
meta
v1
jsonv1
Package jsonv1 provides a normalization which uses schema specific normalizations.
Package jsonv1 provides a normalization which uses schema specific normalizations.
jsonv2
Package jsonv2 provides a normalization which is completely based on the abstract (internal) version of the component descriptor and is therefore agnostic of the final serialization format.
Package jsonv2 provides a normalization which is completely based on the abstract (internal) version of the component descriptor and is therefore agnostic of the final serialization format.
ocm.software/v3alpha1/jsonscheme
Package jsonscheme generated by go-bindata.// sources: ../../../../../../../resources/component-descriptor-ocm-v3-schema.yaml
Package jsonscheme generated by go-bindata.// sources: ../../../../../../../resources/component-descriptor-ocm-v3-schema.yaml
v2
v2/jsonscheme
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