image

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConformanceImageVersionAuto represents detecting the server's kubernetes version.
	ConformanceImageVersionAuto = "auto"
	// ConformanceImageVersionLatest represents always using the server's latest dev version.
	ConformanceImageVersionLatest = "latest"
	// ConformanceImageVersionAuto represents detecting the server's kubernetes version but ignoring errors. Useful for
	// debugging/testing when no cluster is present.
	ConformanceImageVersionIgnore = "ignore"

	// DevVersionURL is the URL which should respond with a simple text of the latest version for devs.
	DevVersionURL      = "https://storage.googleapis.com/k8s-release-dev/ci/latest.txt"
	DevVersionImageURL = "gcr.io/k8s-staging-ci-images/conformance"
)

Variables

View Source
var (
	//ErrImageVersionNoClient is the error returned when we need a client but didn't get on
	ErrImageVersionNoClient = errors.New(`can't use nil client with "auto" image version`)
)

Functions

func GetLatestDevVersion added in v0.53.1

func GetLatestDevVersion(url string) (string, error)

GetLatestDevVersion just GETs a known URL which holds the reference to the latest dev version.

Types

type Client added in v0.17.1

type Client interface {
	PullImages(images []string, retries int) []error
	PushImages(images []TagPair, retries int) []error
	DownloadImages(images []string, version string) (string, error)
	DeleteImages(images []string, retries int) []error
	RunImage(image string, entrypoint string, env map[string]string, args ...string) ([]string, error)
	InspectImages(images []string) []error
}

Client is the interface for interacting with images.

func NewDockerClient added in v0.17.1

func NewDockerClient() Client

NewDockerClient returns a DockerClient that can interact with the local docker installation.

type Config

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

Config holds an image's fully qualified name components registry, name, and tag

func (Config) GetFullyQualifiedImageName added in v0.17.1

func (i Config) GetFullyQualifiedImageName() string

GetFullyQualifiedImageName returns the fully qualified URI to an image (including tag)

type ConformanceImageVersion

type ConformanceImageVersion string

ConformanceImageVersion represents the version of a conformance image, or "auto" to detect the version

func (*ConformanceImageVersion) Get

func (c *ConformanceImageVersion) Get(client discovery.ServerVersionInterface, latestURL string) (registry, version string, returnErr error)

Get retrieves the preset version if there is one, queries client if the ConformanceImageVersion is set to `auto`, or finds the latest dev image published. kubernetes.Interface.Discovery() provides ServerVersionInterface. Don't require the entire kubernetes.Interface to simplify the required test mocks

func (*ConformanceImageVersion) Set

func (c *ConformanceImageVersion) Set(str string) error

Set the ImageVersion to either the string "auto" or a version string. The resulting version string will be forced into semver version with a 'v' prefix. You can set pre-release/metadata but it will fill in the minor/patch values as '0' if missing. E.g. 1+beta would yield v1.0.0+beta

func (*ConformanceImageVersion) String

func (c *ConformanceImageVersion) String() string

String needed for pflag.Value.

func (*ConformanceImageVersion) Type

func (c *ConformanceImageVersion) Type() string

Type needed for pflag.Value.

type DockerClient added in v0.17.1

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

DockerClient is an implementation of Client that uses the local docker installation to interact with images.

func (DockerClient) DeleteImages added in v0.17.1

func (i DockerClient) DeleteImages(images []string, retries int) []error

DeleteImages deletes the given list of images from the local machine. It will retry for the provided number of retries on failure.

func (DockerClient) DownloadImages added in v0.17.1

func (i DockerClient) DownloadImages(images []string, version string) (string, error)

DownloadImages exports the list of images to a tar file. The provided version will be included in the resulting file name.

func (DockerClient) InspectImages added in v0.56.17

func (i DockerClient) InspectImages(images []string) []error

InspectImages.

func (DockerClient) PullImages added in v0.17.1

func (i DockerClient) PullImages(images []string, retries int) []error

PullImages pulls the given list of images, skipping if they are already present on the machine. It will retry for the provided number of retries on failure.

func (DockerClient) PushImages added in v0.17.1

func (i DockerClient) PushImages(images []TagPair, retries int) []error

PushImages will tag each of the source images as the destination image and push. It will skip the operation if the image source and destination are equal. It will retry for the provided number of retries on failure.

func (DockerClient) RunImage added in v0.20.0

func (i DockerClient) RunImage(image string, entryPoint string, env map[string]string, args ...string) ([]string, error)

type DryRunClient added in v0.17.1

type DryRunClient struct{}

DryRunClient is an implementation of Client that logs the image operations that would be performed rather than performing them.

func (DryRunClient) DeleteImages added in v0.17.1

func (i DryRunClient) DeleteImages(images []string, retries int) []error

DeleteImages logs which images would be deleted.

func (DryRunClient) DownloadImages added in v0.17.1

func (i DryRunClient) DownloadImages(images []string, version string) (string, error)

DownloadImages logs that the images would be saved and returns the tarball name.

func (DryRunClient) InspectImages added in v0.56.17

func (i DryRunClient) InspectImages([]string) []error

func (DryRunClient) PullImages added in v0.17.1

func (i DryRunClient) PullImages(images []string, retries int) []error

PullImages logs the images that would be pulled.

func (DryRunClient) PushImages added in v0.17.1

func (i DryRunClient) PushImages(images []TagPair, retries int) []error

PushImages logs what the images would be tagged and pushed as.

func (DryRunClient) RunImage added in v0.20.0

func (i DryRunClient) RunImage(image string, entryPoint string, env map[string]string, args ...string) ([]string, error)

type RegistryList

type RegistryList struct {
	BuildImageRegistry      string `yaml:"buildImageRegistry"`
	DockerGluster           string `yaml:"dockerGluster,omitempty"`
	DockerLibraryRegistry   string `yaml:"dockerLibraryRegistry,omitempty"`
	E2eRegistry             string `yaml:"e2eRegistry,omitempty"`
	E2eVolumeRegistry       string `yaml:"e2eVolumeRegistry"`
	EtcdRegistry            string `yaml:"etcdRegistry,omitempty"`
	GcAuthenticatedRegistry string `yaml:"gcAuthenticatedRegistry,omitempty"`
	GcRegistry              string `yaml:"gcRegistry,omitempty"`
	GcEtcdRegistry          string `yaml:"gcEtcdRegistry,omitempty"`
	GcrReleaseRegistry      string `yaml:"gcrReleaseRegistry,omitempty"`
	GoogleContainerRegistry string `yaml:"googleContainerRegistry,omitempty"`
	InvalidRegistry         string `yaml:"invalidRegistry,omitempty"`
	PrivateRegistry         string `yaml:"privateRegistry,omitempty"`
	PromoterE2eRegistry     string `yaml:"promoterE2eRegistry"`
	QuayIncubator           string `yaml:"quayIncubator,omitempty"`
	QuayK8sCSI              string `yaml:"quayK8sCSI,omitempty"`
	SampleRegistry          string `yaml:"sampleRegistry,omitempty"`
	SigStorageRegistry      string `yaml:"sigStorageRegistry"`

	K8sVersion *version.Version `yaml:"-"`
	Images     map[int]Config   `yaml:"-"`
}

RegistryList holds public and private image registries

func GetDefaultImageRegistries added in v0.16.5

func GetDefaultImageRegistries(version string) (*RegistryList, error)

GetDefaultImageRegistries returns the default default image registries

func NewRegistryList

func NewRegistryList(repoConfig, k8sVersion string) (*RegistryList, error)

NewRegistryList returns a default registry or one that matches a config file passed

type TagPair added in v0.17.1

type TagPair struct {
	Src string
	Dst string
}

TagPair represents a source image and a destination image that it will be tagged and pushed as.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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