extract

package
v0.0.0-...-435808f Latest Latest
Warning

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

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

Documentation

Overview

Package extract implements support for extracting required K8s binaries and required K8s images from GCS buckets containing release or ci builds artifacts.

Additionally, it is also possible to manage local repositories of the aforementioned artifacts or repository hosted on http/https web servers.

Index

Constants

This section is empty.

Variables

View Source
var (

	// AllKubernetesImages defines of image tarballs included in a K8s release
	AllKubernetesImages = []string{"kube-apiserver.tar", "kube-controller-manager.tar", "kube-scheduler.tar", "kube-proxy.tar"}

	// AllImagesPattern defines a pattern for searching all the images in a folder
	AllImagesPattern = []string{"*.tar"}
)

Functions

func ResolveLabel

func ResolveLabel(src string) (version string, err error)

ResolveLabel provide a utility func for resolving a label

Types

type Extractor

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

Extractor defines attributes for a Kubernetes artifact extractor

func NewExtractor

func NewExtractor(src, dst string, options ...Option) (extractor *Extractor)

NewExtractor returns a new extractor configured with the given options

func (*Extractor) Extract

func (e *Extractor) Extract() (paths map[string]string, err error)

Extract Kubernetes artifacts from the given source

func (*Extractor) SetFiles

func (e *Extractor) SetFiles(files []string)

SetFiles allows to override the default list of files that the extractor is expected to retrieve.

type Option

type Option func(*Extractor)

Option is an Extractor configuration option supplied to NewExtractor

func OnlyKubeadm

func OnlyKubeadm(onlyKubeadm bool) Option

OnlyKubeadm option instructs the Extractor for retrieving kubeadm only

func OnlyKubelet

func OnlyKubelet(onlyKubelet bool) Option

OnlyKubelet option instructs the Extractor for retrieving kubelet only

func OnlyKubernetesBinaries

func OnlyKubernetesBinaries(onlyBinaries bool) Option

OnlyKubernetesBinaries option instructs the Extractor for retrieving Kubernetes binaries only

func OnlyKubernetesImages

func OnlyKubernetesImages(onlyImages bool) Option

OnlyKubernetesImages option instructs the Extractor for retrieving Kubernetes images tarballs only

func WithNameOverride

func WithNameOverride(newName string) Option

WithNameOverride option instructs the Extractor to rename the bit

func WithNamePrefix

func WithNamePrefix(namePrefix string) Option

WithNamePrefix option instructs the Extractor to adds a prefix to the name of each file before saving to destination

func WithVersionFile

func WithVersionFile(enable bool) Option

WithVersionFile option instructs the Extractor whether to add version file

func WithVersionFolder

func WithVersionFolder(versionFolder bool) Option

WithVersionFolder option instructs the Extractor to save all files in a folder named like the kubernetes version

type SourceType

type SourceType int

SourceType defines src types

const (
	// ReleaseLabelOrVersionSource describe a src that is hosted in releaseBuildURepository
	ReleaseLabelOrVersionSource SourceType = iota + 1

	// CILabelOrVersionSource describe a src that is hosted in ciBuildRepository
	CILabelOrVersionSource

	// RemoteRepositorySource describe a src that is hosted in a remote http/https repository
	RemoteRepositorySource

	// LocalRepositorySource describe a src that is hosted in local repository
	LocalRepositorySource
)

func GetSourceType

func GetSourceType(src string) SourceType

GetSourceType returns the src type descriptor

Jump to

Keyboard shortcuts

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