v1alpha1

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package v1alpha1 stores definitions and methods to handle artifact definitions and methods +kubebuilder:object:generate=true +k8s:deepcopy-gen=package +groupName=artifacts.pkg.katanomi.dev

Index

Constants

View Source
const (
	// BinaryArtifactTypeDirectory for directory type
	BinaryArtifactTypeDirectory = "directory"
	// BinaryArtifactTypeFile for file type
	BinaryArtifactTypeFile = "file"
)
View Source
const (
	// ArtifactTypeContainerImage artifact type as container image
	ArtifactTypeContainerImage              ArtifactType = "ContainerImage"
	DeprecatedArtifactTypeOCIContainerImage              = "OCIContainerImage"

	// ArtifactTypeHelmChart artifact type helm chart
	ArtifactTypeHelmChart              ArtifactType = "HelmChart"
	DeprecatedArtifactTypeOCIHelmChart              = "OCIHelmChart"

	// ArtifactTypeBinary binary artifact
	ArtifactTypeBinary ArtifactType = "Binary"
	// ArtifactTypeMaven maven artifact
	ArtifactTypeMaven ArtifactType = "Maven"

	// OCIHelmMediaType media type used for OCI helm chart artifact
	OCIHelmMediaType = "application/vnd.cncf.helm.config.v1+json"
	// OCIHelmChartContentType content type for a chart tar file when using OCI
	// registry as storage
	OCIHelmChartContentType = "application/vnd.cncf.helm.chart.content.v1.tar+gzip"

	// OCITarGzipContentType Tar gzip file as a content type
	// used in helm 3.6 and prior as media type for the layer storing
	// the chart tar package. From helm 3.7 onwars started using
	// "application/vnd.cncf.helm.chart.content.v1.tar+gzip"
	OCITarGzipContentType = "application/tar+gzip"

	// DeprecatedOCIHelmChartContentType uses "application/tar+gzip" on
	// helm 3.6 and prior. Was replaced by "application/vnd.cncf.helm.chart.content.v1.tar+gzip"
	// on helm 3.7 onwards
	DeprecatedOCIHelmChartContentType = OCITarGzipContentType

	// HelmChartDigestAnnotationKey annotation key used to store a digest
	// generated by pkg/hash.HashFolder method and used to compare content equality
	HelmChartDigestAnnotationKey = "digest.katanomi.dev/chart"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "artifacts.pkg.katanomi.dev", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func AsDigestStringArray

func AsDigestStringArray(uris ...URI) (array []string)

AsDigestStringArray returns list of uri as a string array

func ExtractRepositoryDigestTag

func ExtractRepositoryDigestTag(value string) (url, digest, tag string)

ExtractRepositoryDigestTag takes a oci artifact url and extracts url, digest and tag

func FileUploadResourceAttributes added in v0.8.0

func FileUploadResourceAttributes(verb string) authv1.ResourceAttributes

FileUploadResourceAttributes returns a ResourceAttribute object to be used in a filter DEPRECATED: use ArtifactFileSubResourceAttributes instead

func GenerateDockerAuth added in v0.11.0

func GenerateDockerAuth(username, password []byte) string

GenerateDockerAuth generate docker auth by input.

func GetAuthFromDockerConfigJson

func GetAuthFromDockerConfigJson(registry string, dockerConfigJsonBytes []byte) (username, password string, err error)

GetAuthFromDockerConfigJson get docker credential information from docker config json

Types

type AllFilter

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

AllFilter will use AND logic between items in other words, it equals item[0] && item[1] && ... item[n] (n>=0)

func (*AllFilter) DeepCopy

func (in *AllFilter) DeepCopy() *AllFilter

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

func (*AllFilter) DeepCopyInto

func (in *AllFilter) DeepCopyInto(out *AllFilter)

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

func (AllFilter) Filter

func (f AllFilter) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter will filter artifacts by all filters

type AnyFilter

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

AnyFilter will use OR logic between items in other words, it equals item[0] || item[1] || ... item[n] (n>=0)

func (*AnyFilter) DeepCopy

func (in *AnyFilter) DeepCopy() *AnyFilter

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

func (*AnyFilter) DeepCopyInto

func (in *AnyFilter) DeepCopyInto(out *AnyFilter)

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

func (AnyFilter) Filter

func (f AnyFilter) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter will filter artifacts by filters using OR logic

type ArtifactType

type ArtifactType string

type ArtifactTypeBinaryProperties added in v0.9.0

type ArtifactTypeBinaryProperties struct {
	// Type of display type of artifact: directory, file
	Type string `json:"type"`
	// Name of artifact
	Name string `json:"name"`
	// Context of artifact
	Context string `json:"context"`
	// Size of artifact
	Size int64 `json:"size"`
}

ArtifactTypeBinaryProperties properties for binary artifact type

func (*ArtifactTypeBinaryProperties) DeepCopy added in v0.9.0

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

func (*ArtifactTypeBinaryProperties) DeepCopyInto added in v0.9.0

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

type ArtifactVersion

type ArtifactVersion struct {
	// Type of artifact
	Type ArtifactType `json:"type"`
	// URL of artifact
	URL string `json:"url"`
	// Digest means artifact digest
	// can be used to store a unique identifier
	// of the artifact version
	Digest string `json:"digest,omitempty"`

	// Versions of current artifact
	// +optional
	Versions []string `json:"versions,omitempty"`
}

ArtifactVersion artifacts

func ContainerImageTransformFunc

func ContainerImageTransformFunc(artifact ArtifactVersion) ArtifactVersion

ContainerImageTransformFunc transform into a container image

func GetBinaryObjectFromValues

func GetBinaryObjectFromValues(ctx context.Context, array []string) (versions []ArtifactVersion)

func GetContainerImageFromValues

func GetContainerImageFromValues(ctx context.Context, array []string) (versions []ArtifactVersion)

GetContainerImageFromValues return a list of container image artifacts using url, digest and tags

func GetContainerImageObjectFromURLValues

func GetContainerImageObjectFromURLValues(ctx context.Context, url, digest string, tags ...string) (versions []ArtifactVersion)

GetContainerImageObjectFromURLValues return a container image artifact using url, digest and a list of tags

func GetHelmChartFromValues

func GetHelmChartFromValues(ctx context.Context, array []string) (versions []ArtifactVersion)

GetHelmChartFromValues return a list of helm chart artifacts using url, digest and tags

func GetHelmChartObjectFromURLValues

func GetHelmChartObjectFromURLValues(ctx context.Context, url string, tags ...string) (versions []ArtifactVersion)

GetHelmChartObjectFromURLValues return a helm chart artifact using url and a list of tags

func GetOCIArtifactFromValues

func GetOCIArtifactFromValues(ctx context.Context, array []string, transformFunc ...OCIArtifactTransformationFunc) (versions []ArtifactVersion)

GetOCIArtifactFromValues return a list of container image artifacts using url, digest and tags

func HelmChartTransformFunc

func HelmChartTransformFunc(artifact ArtifactVersion) ArtifactVersion

HelmChartTransformFunc transform into a helm chart

func (*ArtifactVersion) DeepCopy

func (in *ArtifactVersion) DeepCopy() *ArtifactVersion

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

func (*ArtifactVersion) DeepCopyInto

func (in *ArtifactVersion) DeepCopyInto(out *ArtifactVersion)

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

func (ArtifactVersion) IsSameResult

func (n ArtifactVersion) IsSameResult(compared ArtifactVersion) bool

IsSameResult implements method for generic comparable usage and checking if lists have the same results

type ArtifactVersionCollection

type ArtifactVersionCollection struct {
	// ArtifactVersions all the artifacts
	ArtifactVersions []ArtifactVersion `json:"artifactVersions"`
}

ArtifactVersionCollection collection of artifacts versions

func (*ArtifactVersionCollection) DeepCopy

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

func (*ArtifactVersionCollection) DeepCopyInto

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

type ArtifactVersions

type ArtifactVersions []ArtifactVersion

ArtifactVersions list of artifacts versions

func (ArtifactVersions) DeepCopy

func (in ArtifactVersions) DeepCopy() ArtifactVersions

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

func (ArtifactVersions) DeepCopyInto

func (in ArtifactVersions) DeepCopyInto(out *ArtifactVersions)

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

type DigestAlgorithm

type DigestAlgorithm string

DigestAlgorithm artifact digest algorithm

const (
	// SHA256 artifact digest algorithm is sha256
	SHA256 DigestAlgorithm = "sha256"
)

func ParseFirstDigest

func ParseFirstDigest(line string) (algorithm DigestAlgorithm, digest string, ok bool)

ParseFirstDigest parse first digest from text string

type DockerAuthItem

type DockerAuthItem struct {
	// Username username
	Username string `json:"username"`
	// Password authentication password
	Password string `json:"password"`
	// Auth authentication token, generated with username:password base64
	Auth string `json:"auth"`
	// Eamil user eamil
	Eamil string `json:"email"`
	// Scope project scope for credential authentication
	Scope string `json:"scope"`
}

DockerAuthItem docker credential information for a single repository

func (*DockerAuthItem) DeepCopy

func (in *DockerAuthItem) DeepCopy() *DockerAuthItem

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

func (*DockerAuthItem) DeepCopyInto

func (in *DockerAuthItem) DeepCopyInto(out *DockerAuthItem)

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

type DockerConfigJson

type DockerConfigJson struct {
	Auths map[string]DockerAuthItem `json:"auths"`
}

DockerConfigJson docker credentials data

func (*DockerConfigJson) DeepCopy

func (in *DockerConfigJson) DeepCopy() *DockerConfigJson

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

func (*DockerConfigJson) DeepCopyInto

func (in *DockerConfigJson) DeepCopyInto(out *DockerConfigJson)

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

type EnvFilter

type EnvFilter struct {
	v1alpha1.ArtifactEnvFilter
}

EnvFilter represents artifact env filter

func (*EnvFilter) DeepCopy

func (in *EnvFilter) DeepCopy() *EnvFilter

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

func (*EnvFilter) DeepCopyInto

func (in *EnvFilter) DeepCopyInto(out *EnvFilter)

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

func (EnvFilter) Filter

func (filter EnvFilter) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter will filter artifacts by artifact envs

type FileUploadBinaryProperties added in v0.9.0

type FileUploadBinaryProperties struct {
	// Name for file key name
	Name string `json:"name"`
	// Overwrite allows to overwrite the file if it already exists
	Overwrite bool `json:"overwrite,omitempty"`
}

FileUploadBinaryProperties Upload file expandable fields for binary artifact

func (*FileUploadBinaryProperties) DeepCopy added in v0.9.0

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

func (*FileUploadBinaryProperties) DeepCopyInto added in v0.9.0

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

type FileUploadParams added in v0.8.0

type FileUploadParams struct {
	// Address target repo's address
	Address *duckv1.Addressable `json:"address,omitempty"`

	// Type for support upload file type,ContainerImage, HelmChart, Binary
	// current only support ContainerImage.
	Type ArtifactType `json:"type,omitempty"`

	// Name for artifact identity name
	Name string `json:"name"`

	// Checksum generate unique path value
	Checksum string `json:"checksum"`

	// Properties Upload file expandable fields
	// if type is ContainerImage,The supported fields under properties is `tags`
	Properties *runtime.RawExtension `json:"properties,omitempty"`
}

FileUploadParams Parameters required in ui upload file.

func (*FileUploadParams) DeepCopy added in v0.8.0

func (in *FileUploadParams) DeepCopy() *FileUploadParams

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

func (*FileUploadParams) DeepCopyInto added in v0.8.0

func (in *FileUploadParams) DeepCopyInto(out *FileUploadParams)

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

type Filter

type Filter interface {
	// Filter compute the predicate on the provided event and returns the result of the matching
	// message will be match details when not pass
	Filter(ctx context.Context, artifact v1alpha1.Artifact) (res FilterResult, message string, err error)
}

Filter is artifact filter interfact +k8s:deepcopy-gen=false

func NewAllFilter

func NewAllFilter(all []v1alpha1.ArtifactFilter) Filter

NewAllFilter will construct all filter

func NewAnyFilter

func NewAnyFilter(any []v1alpha1.ArtifactFilter) Filter

NewAnyFilter will construct filters using OR logic

func NewEnvFilter

func NewEnvFilter(f v1alpha1.ArtifactEnvFilter) Filter

NewEnvFilter will construct artifact env filter

func NewFilter

func NewFilter(filters ...v1alpha1.ArtifactFilterSet) Filter

NewFilter create Filter by filters, will use AND logic between items

func NewLabelFilter

func NewLabelFilter(f v1alpha1.ArtifactLabelFilter) Filter

NewLabelFilter will construct artifact label filter

func NewTagFilter

func NewTagFilter(f v1alpha1.ArtifactTagFilter) Filter

NewTagFilter will construct artifact tag filter

type FilterResult

type FilterResult string

FilterResult has the result of the filtering operation.

const (
	// indicates pass filter result
	PassFilter FilterResult = "pass"
	// indicates fail filter result
	FailFilter FilterResult = "fail"
	// indicates no filter result
	NoFilter FilterResult = "no_filter"
)

func NewFilterResult

func NewFilterResult(matched bool) FilterResult

NewFilterResult will parse bool to filterresult

func (FilterResult) And

And will use AND logic between two filter result if any one is NoFilter will return other one if all are pass will return pass if one is fail will return fail

func (FilterResult) Not

func (x FilterResult) Not() FilterResult

Not if current FilterResult is pass , will retrun fail if current FilterResult is faile, will return pass if current FilterResult is no filter , will return no filter

func (FilterResult) Or

Or will use OR logic between two filter result if any one is NoFilter will return other one if any one is pass will return pass if all items are fail will return fail

type Filters

type Filters []Filter

Filters is a wrapper that runs each filter and performs the and +k8s:deepcopy-gen=false

func NewArtifactFilter

func NewArtifactFilter(filter v1alpha1.ArtifactFilter) Filters

NewArtifactFilter will construct a ArtifactFilter

func (Filters) Filter

func (filters Filters) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter compute the predicate on the provided event and returns the result of the matching

type ImageAuths

type ImageAuths map[string][]DockerAuthItem

ImageAuths sever and DockerAuthItem list

func (ImageAuths) DeepCopy

func (in ImageAuths) DeepCopy() ImageAuths

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

func (ImageAuths) DeepCopyInto

func (in ImageAuths) DeepCopyInto(out *ImageAuths)

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

type ImageConfig

type ImageConfig struct {
	ImageAuths ImageAuths `json:"auths"`
}

ImageConfig define sever and multiple docker credentials related content.

func (*ImageConfig) DeepCopy

func (in *ImageConfig) DeepCopy() *ImageConfig

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

func (*ImageConfig) DeepCopyInto

func (in *ImageConfig) DeepCopyInto(out *ImageConfig)

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

type LabelFilter

type LabelFilter struct {
	v1alpha1.ArtifactLabelFilter
}

LabelFilter artifact label filter

func (*LabelFilter) DeepCopy

func (in *LabelFilter) DeepCopy() *LabelFilter

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

func (*LabelFilter) DeepCopyInto

func (in *LabelFilter) DeepCopyInto(out *LabelFilter)

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

func (LabelFilter) Filter

func (filter LabelFilter) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter will filter artifacts by artifact labels

type OCIArtifactTransformationFunc

type OCIArtifactTransformationFunc func(ArtifactVersion) ArtifactVersion

OCIArtifactTransformationFunc transformation function to use when converting a string array into ArtifactVersion +k8s:deepcopy-gen=false

type Protocol

type Protocol string

Protocol represent artifact transport protocol

var (
	// ProtocolDocker docker protocol
	ProtocolDocker Protocol = "docker"
	// ProtocolHelmChart helm chart protocol
	ProtocolHelmChart Protocol = "chart"
	// ProtocolOCI oci protocol
	ProtocolOCI Protocol = "oci"

	ErrInvalidReference = "invalid reference"
)

type TagFilter

type TagFilter struct {
	v1alpha1.ArtifactTagFilter
}

TagFilter represents artifact tag filter

func (*TagFilter) DeepCopy

func (in *TagFilter) DeepCopy() *TagFilter

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

func (*TagFilter) DeepCopyInto

func (in *TagFilter) DeepCopyInto(out *TagFilter)

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

func (TagFilter) Filter

func (filter TagFilter) Filter(ctx context.Context, artifact v1alpha1.Artifact) (FilterResult, string, error)

Filter will filter artifacts by artifact tags

type URI

type URI struct {
	// Protocol represent artifact transport protocol, it is optional, default value is docker
	Protocol string
	// Host represent artifact host
	Host string
	// Path represent artifact path
	Path string
	// Tag represent artifact tag
	Tag string
	// Digest represent artifact digest
	Digest string
	// Algorithm digest algorithm
	Algorithm DigestAlgorithm

	// Raw represent original uri
	Raw string
}

URI represents artifact uri , like docker://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.37.1@sha256:04411f239bc7144c3248b53af6741c2726eaddbe9b9cf62a24cf812689cc3223

func ParseURI

func ParseURI(uri string, t ArtifactType) (URI, error)

ParseURI parse uri to URI struct

func (*URI) DeepCopy

func (in *URI) DeepCopy() *URI

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

func (*URI) DeepCopyInto

func (in *URI) DeepCopyInto(out *URI)

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

func (URI) DigestString

func (u URI) DigestString() string

DigestString will return format of Algorithm:Digest

func (URI) Repository

func (u URI) Repository() string

func (URI) String

func (u URI) String() string

String returns the uri string, preferably using tag as a reference.

func (URI) Validate

func (u URI) Validate() error

Validate returns an error if the uri is invalid, otherwise returns empty.

func (URI) ValidateDigest

func (u URI) ValidateDigest() error

ValidateDigest validates the a digest.

func (URI) ValidateHost

func (u URI) ValidateHost() error

ValidateHost validates the host.

func (URI) ValidatePath

func (u URI) ValidatePath() error

ValidatePath validates the path.

func (URI) ValidateTag

func (u URI) ValidateTag() error

ValidateTag validates the tag.

func (URI) Version

func (u URI) Version() string

Version will return sha256:xx or tag .

func (URI) WithDigestString

func (u URI) WithDigestString() string

WithDigestString return uri string, including tag and digest.

Jump to

Keyboard shortcuts

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