mirror

package
v0.0.0-...-686ee7d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBlobGostDigest

func CalculateBlobGostDigest(blobStream io.Reader) (string, error)

func CreateEmptyImageLayoutAtPath

func CreateEmptyImageLayoutAtPath(path string) (layout.Path, error)

func ExtractImageDigestsFromDeckhouseInstaller

func ExtractImageDigestsFromDeckhouseInstaller(
	mirrorCtx *Context,
	installerTag string,
	installersLayout layout.Path,
) (map[string]struct{}, error)

func FillLayoutsImages

func FillLayoutsImages(
	mirrorCtx *Context,
	layouts *ImageLayouts,
	deckhouseVersions []semver.Version,
)

func FindDeckhouseModulesImages

func FindDeckhouseModulesImages(mirrorCtx *Context, layouts *ImageLayouts) error

func FindExternalModuleImages

func FindExternalModuleImages(
	mod *Module,
	authProvider authn.Authenticator,
	skipReleaseChannels, insecure, skipVerifyTLS bool,
) (moduleImages, releaseImages map[string]struct{}, err error)

func GenerateDeckhouseReleaseManifests

func GenerateDeckhouseReleaseManifests(
	versionsToMirror []semver.Version,
	pathToManifestYaml string,
	releaseChannelsImagesLayout layout.Path,
) error

func IsTrivyMediaTypeNotAllowedError

func IsTrivyMediaTypeNotAllowedError(err error) bool

func MakeRemoteRegistryRequestOptions

func MakeRemoteRegistryRequestOptions(authProvider authn.Authenticator, insecure, skipTLSVerification bool) ([]name.Option, []remote.Option)

func MakeRemoteRegistryRequestOptionsFromMirrorContext

func MakeRemoteRegistryRequestOptionsFromMirrorContext(mirrorCtx *Context) ([]name.Option, []remote.Option)

func NopTagToDigestMappingFunc

func NopTagToDigestMappingFunc(_ string) *v1.Hash

func PackBundle

func PackBundle(mirrorCtx *Context) error

func PullDeckhouseImages

func PullDeckhouseImages(mirrorCtx *Context, layouts *ImageLayouts) error

func PullDeckhouseReleaseChannels

func PullDeckhouseReleaseChannels(mirrorCtx *Context, layouts *ImageLayouts) error

func PullImageSet

func PullImageSet(
	authProvider authn.Authenticator,
	targetLayout layout.Path,
	imageSet map[string]struct{},
	tagToDigestMappingFunc TagToDigestMappingFunc,
	insecure, skipVerifyTLS, allowMissingTags bool,
) error

func PullInstallers

func PullInstallers(mirrorCtx *Context, layouts *ImageLayouts) error

func PullModules

func PullModules(mirrorCtx *Context, layouts *ImageLayouts) error

func PullTrivyVulnerabilityDatabaseImageToLayout

func PullTrivyVulnerabilityDatabaseImageToLayout(
	sourceRepo string,
	authProvider authn.Authenticator,
	targetLayout layout.Path,
	insecure, skipVerifyTLS bool,
) error

func UnpackBundle

func UnpackBundle(mirrorCtx *Context) error

func ValidateLayouts

func ValidateLayouts(layouts []layout.Path, validationMode ValidationMode) error

func ValidateReadAccessForImage

func ValidateReadAccessForImage(imageTag string, authProvider authn.Authenticator, insecure, skipVerifyTLS bool) error

func ValidateWriteAccessForRepo

func ValidateWriteAccessForRepo(repo string, authProvider authn.Authenticator, insecure, skipVerifyTLS bool) error

func VersionsToCopy

func VersionsToCopy(mirrorCtx *Context) ([]semver.Version, error)

Types

type Context

type Context struct {
	Insecure            bool // --insecure
	SkipTLSVerification bool // --skip-tls-verify
	DoGOSTDigests       bool // --gost-digest
	SkipModulesPull     bool // --no-modules

	RegistryAuth authn.Authenticator // --registry-login + --registry-password (can be nil in this case) or --license depending on the operation requested
	RegistryHost string              // --registry (FQDN with port, if one is provided)
	RegistryPath string              // --registry (path)

	DeckhouseRegistryRepo string // --source

	BundlePath         string // --images-bundle-path
	BundleChunkSize    int64  // Plain bytes
	UnpackedImagesPath string
	ValidationMode     ValidationMode // --validation, hidden flag

	// Only one of those 2 is used at a time or none at all.
	MinVersion      *semver.Version // --min-version
	SpecificVersion *semver.Version // --release
}

Context hold data related to pending registry mirroring operation.

type ImageLayouts

type ImageLayouts struct {
	Deckhouse       layout.Path
	DeckhouseImages map[string]struct{}

	Install       layout.Path
	InstallImages map[string]struct{}

	ReleaseChannel       layout.Path
	ReleaseChannelImages map[string]struct{}

	Security       layout.Path
	SecurityImages map[string]struct{}

	Modules map[string]ModuleImageLayout

	TagsResolver *TagsResolver
}

func CreateOCIImageLayoutsForDeckhouse

func CreateOCIImageLayoutsForDeckhouse(
	rootFolder string,
	modules []Module,
) (*ImageLayouts, error)

type Module

type Module struct {
	Name         string
	RegistryPath string
	Releases     []string
}

func GetDeckhouseExternalModules

func GetDeckhouseExternalModules(mirrorCtx *Context) ([]Module, error)

func GetExternalModulesFromRepo

func GetExternalModulesFromRepo(repo string, registryAuth authn.Authenticator, insecure, skipVerifyTLS bool) ([]Module, error)

type ModuleFilter

type ModuleFilter map[string][]string

ModuleFilter maps module names to required tags

func ParseModuleFilterString

func ParseModuleFilterString(str string) ModuleFilter

func (ModuleFilter) FilterModuleReleases

func (f ModuleFilter) FilterModuleReleases(mod *Module)

func (ModuleFilter) Match

func (f ModuleFilter) Match(mod Module) bool

type ModuleImageLayout

type ModuleImageLayout struct {
	ModuleLayout layout.Path
	ModuleImages map[string]struct{}

	ReleasesLayout layout.Path
	ReleaseImages  map[string]struct{}
}

type TagToDigestMappingFunc

type TagToDigestMappingFunc func(imageRef string) *v1.Hash

type TagsResolver

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

func NewTagsResolver

func NewTagsResolver() *TagsResolver

func (*TagsResolver) GetTagDigest

func (r *TagsResolver) GetTagDigest(imageRef string) *v1.Hash

func (*TagsResolver) ResolveTagsDigestsForImageLayouts

func (r *TagsResolver) ResolveTagsDigestsForImageLayouts(mirrorCtx *Context, layouts *ImageLayouts) error

func (*TagsResolver) ResolveTagsDigestsFromImageSet

func (r *TagsResolver) ResolveTagsDigestsFromImageSet(
	imageSet map[string]struct{},
	authProvider authn.Authenticator,
	insecure, skipTLSVerification bool,
) error

type ValidationMode

type ValidationMode string
const (
	NoValidation   ValidationMode = "off"
	FastValidation ValidationMode = "fast"
	FullValidation ValidationMode = "full"
)

Jump to

Keyboard shortcuts

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