imagetranslation

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultImageTranslator added in v1.0.2

func GetDefaultImageTranslator(imageTranslationConfigsDir string, allowRegexp bool, clientCfg clientcmd.ClientConfig) image.Translator

GetDefaultImageTranslator returns a default image translation that uses CRDs and a config directory

func GetEmptyImageTranslator added in v1.0.2

func GetEmptyImageTranslator() image.Translator

GetEmptyImageTranslator returns an empty image translator that doesn't apply any translations

Types

type ConfigSource

type ConfigSource interface {
	// Configs returns list of configs that are available in this data source
	Configs(ctx context.Context) ([]TranslationConfig, error)

	// Description returns the data-source description to be used in the logs
	Description() string
}

ConfigSource is the data-source for translation configs

func NewCRDSource

func NewCRDSource(namespace string, clientCfg clientcmd.ClientConfig) ConfigSource

NewCRDSource is a factory for CRD-based config source

func NewFakeConfigSource

func NewFakeConfigSource(configs map[string]v1.ImageTranslation) ConfigSource

NewFakeConfigSource is a factory for a fake config source

func NewFileConfigSource

func NewFileConfigSource(configsDirectory string) ConfigSource

NewFileConfigSource is a factory for a directory-based config source

type ImageNameTranslator

type ImageNameTranslator interface {
	// LoadConfigs initializes translator with configs from supplied data sources. All previous mappings are discarded.
	LoadConfigs(ctx context.Context, sources ...ConfigSource)

	// Translate translates image name to ins Endpoint. If no suitable mapping was found, the default Endpoint is returned
	Translate(name string) image.Endpoint
}

ImageNameTranslator is the main translator interface

func NewImageNameTranslator

func NewImageNameTranslator(allowRegexp bool) ImageNameTranslator

NewImageNameTranslator creates an instance of ImageNameTranslator

type TranslationConfig

type TranslationConfig interface {
	// ConfigName returns the config name (any string identifier)
	ConfigName() string

	// Payload returns ImageTranslation object associated with the config
	Payload() (v1.ImageTranslation, error)
}

TranslationConfig represents a single config (prefix + rule list) in a config-set

Jump to

Keyboard shortcuts

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