registry

package
v1.11.0 Latest Latest
Warning

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

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

Documentation

Overview

Package registry implements the various functions needed to store and retrieve images from a container registry.

Index

Constants

View Source
const (
	RegistrySecretNamespaceAnnotationKey = "epinio.io/registry-namespace" // nolint:gosec // not credentials
	CredentialsSecretName                = "registry-creds"
)

Variables

This section is empty.

Functions

func ExportRegistryNames added in v1.10.0

func ExportRegistryNames(log logr.Logger, secretLoader git.SecretLister) ([]string, error)

func ExtractImageParts

func ExtractImageParts(imageURL string) (string, string, error)

ExtractImageParts accepts a container image URL and returns the registry and the image parts.

func GetRegistryUrlFromSecret added in v1.10.0

func GetRegistryUrlFromSecret(secret v1.Secret) (string, error)

func Validate

func Validate(url, namespace, username, password string) error

Validate makes sure the provided settings are valid The user should provide all the mandatory settings or no settings at all.

Types

type ConnectionDetails

type ConnectionDetails struct {
	RegistryCredentials []RegistryCredentials
	Namespace           string
}

func GetConnectionDetails

func GetConnectionDetails(ctx context.Context, cluster *kubernetes.Cluster, secretNamespace, secretName string) (*ConnectionDetails, error)

GetConnectionDetails retrieves registry connection details from a Kubernetes secret.

func (*ConnectionDetails) PrivateRegistryURL

func (d *ConnectionDetails) PrivateRegistryURL() (string, error)

PrivateRegistryURL returns the internal (localhost) registry URL. That url can be used by Kubernetes to pull images only when the internal registry is used and exposed over NodePort. This method will return an empty string if no localhost URL exists in the config.

func (*ConnectionDetails) PublicRegistryURL

func (d *ConnectionDetails) PublicRegistryURL() (string, error)

PublicRegistryURL returns the public registry URL from the connection details object. Assumes to have only one non-local registry in the config. If there are more, it will just return the first one found (no guaranteed order since there should only be one)

func (*ConnectionDetails) ReplaceWithInternalRegistry

func (d *ConnectionDetails) ReplaceWithInternalRegistry(imageURL string) (string, error)

type ContainerRegistryAuth

type ContainerRegistryAuth struct {
	Auth     string `json:"auth"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type DockerConfigJSON

type DockerConfigJSON struct {
	Auths map[string]ContainerRegistryAuth `json:"auths"`
}

type ExportRegistry added in v1.10.0

type ExportRegistry struct {
	Name string
	URL  string
}

func ExportRegistries added in v1.10.0

func ExportRegistries(log logr.Logger, secretLoader git.SecretLister) ([]ExportRegistry, error)

type RegistryCredentials

type RegistryCredentials struct {
	URL      string
	Username string
	Password string
}

func GetRegistryCredentialsFromSecret added in v1.10.0

func GetRegistryCredentialsFromSecret(secret v1.Secret) (RegistryCredentials, error)

Jump to

Keyboard shortcuts

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