assets

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 19 Imported by: 280

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindURLMirrors added in v1.30.0

func FindURLMirrors(u string) []string

FindURLMirrors will return a list of mirrors for well-known URL locations.

func NormalizeImage added in v1.33.2

func NormalizeImage(a *AssetBuilder, image string) string

func SetImageDigestResolver added in v1.37.0

func SetImageDigestResolver(resolver ImageDigestResolver)

SetImageDigestResolver installs the function RemapImage uses to resolve image digests. When no resolver is set, images are not pinned by digest.

Types

type AssetBuilder

type AssetBuilder struct {

	// KubeletSupportedVersion is the max version of kubelet that we are currently allowed to run on worker nodes.
	// This is used to avoid violating the kubelet supported version skew policy,
	// (we are not allowed to run a newer kubelet on a worker node than the control plane)
	KubeletSupportedVersion string
	// contains filtered or unexported fields
}

AssetBuilder discovers and remaps assets.

func NewAssetBuilder

func NewAssetBuilder(vfsContext *vfs.VFSContext, assets *kops.AssetsSpec, getAssets bool) *AssetBuilder

NewAssetBuilder creates a new AssetBuilder.

func (*AssetBuilder) AddStaticFile added in v1.36.0

func (a *AssetBuilder) AddStaticFile(file *StaticFile)

AddStaticFile records a nodeup static file.

func (*AssetBuilder) AddStaticManifest added in v1.36.0

func (a *AssetBuilder) AddStaticManifest(manifest *StaticManifest)

AddStaticManifest records a nodeup static manifest.

func (*AssetBuilder) FileAssets

func (a *AssetBuilder) FileAssets() []*FileAsset

FileAssets returns a sorted copy of the collected file assets.

func (*AssetBuilder) ImageAssets added in v1.21.3

func (a *AssetBuilder) ImageAssets() []*ImageAsset

ImageAssets returns a sorted copy of the collected image assets.

func (*AssetBuilder) RemapFile added in v1.30.0

func (a *AssetBuilder) RemapFile(canonicalURL *url.URL, knownHash *hashing.Hash) (*FileAsset, error)

RemapFile returns a remapped URL for the file, if AssetsLocation is defined. It is returns in a FileAsset, alongside the SHA hash of the file. The SHA hash is is knownHash is provided, and otherwise will be found first by checking the canonical URL against our well-known hashes, and failing that via download.

func (*AssetBuilder) RemapImage

func (a *AssetBuilder) RemapImage(image string) string

RemapImage normalizes a containers location if a user sets the AssetsLocation ContainerRegistry location.

func (*AssetBuilder) RemapManifest

func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error)

RemapManifest transforms a kubernetes manifest. Whenever we are building a Task that includes a manifest, we should pass it through RemapManifest first. This will: * rewrite the images if they are being redirected to a mirror, and ensure the image is uploaded

func (*AssetBuilder) StaticFiles added in v1.25.0

func (a *AssetBuilder) StaticFiles() []*StaticFile

StaticFiles returns a sorted copy of the collected static files.

func (*AssetBuilder) StaticManifests added in v1.17.0

func (a *AssetBuilder) StaticManifests() []*StaticManifest

StaticManifests returns a sorted copy of the collected static manifests.

type FileAsset

type FileAsset struct {
	// DownloadURL is the URL from which the cluster should download the asset.
	DownloadURL *url.URL
	// CanonicalURL is the canonical location of the asset, for example as distributed by the kops project
	CanonicalURL *url.URL
	// SHAValue is the SHA hash of the FileAsset.
	SHAValue *hashing.Hash
}

FileAsset models a file's location.

type ImageAsset added in v1.21.3

type ImageAsset struct {
	// DownloadLocation will be the name of the image we should run.
	// This is used to copy an image to a ContainerRegistry.
	DownloadLocation string
	// CanonicalLocation will be the source location of the image.
	CanonicalLocation string
}

ImageAsset models an image's location.

type ImageDigestResolver added in v1.37.0

type ImageDigestResolver func(image string) (string, error)

ImageDigestResolver looks up the manifest digest for an image, returning it in the form "sha256:...".

type MirroredAsset added in v1.30.0

type MirroredAsset struct {
	Locations []string
	Hash      *hashing.Hash
}

func BuildMirroredAsset added in v1.30.0

func BuildMirroredAsset(asset *FileAsset) *MirroredAsset

BuildMirroredAsset checks to see if this is a file under the standard base location, and if so constructs some mirror locations

func (*MirroredAsset) CompactString added in v1.30.0

func (a *MirroredAsset) CompactString() string

type StaticFile added in v1.25.0

type StaticFile struct {
	// Path is the path to the manifest.
	Path string

	// Content holds the desired file contents.
	Content string

	// The static manifest will only be applied to instances matching the specified role
	Roles []kops.InstanceGroupRole
}

type StaticManifest added in v1.17.0

type StaticManifest struct {
	// Key is the unique identifier of the manifest
	Key string

	// Path is the path to the manifest.
	Path string

	// The static manifest will only be applied to instances matching the specified role
	Roles []kops.InstanceGroupRole

	// Contents is the contents of the manifest, which may be easier than fetching it from Path
	Contents []byte
}

func (*StaticManifest) AppliesToRole added in v1.31.0

func (m *StaticManifest) AppliesToRole(role kops.InstanceGroupRole) bool

Directories

Path Synopsis
Package assetcopy copies cluster assets to a private file repository or container registry (`kops get assets --copy`).
Package assetcopy copies cluster assets to a private file repository or container registry (`kops get assets --copy`).

Jump to

Keyboard shortcuts

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