Documentation
¶
Index ¶
- Constants
- func RegistryFromImageRef(imageReference string) (registry string, err error)
- func ReplaceRegistryInImageRef(imageReference, replacementRegistry string) (imageRef string, err error)
- type ContainerTransformer
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type PodContainerProxier
Constants ¶
const BareRegistry = "docker.io"
Variables ¶
This section is empty.
Functions ¶
func RegistryFromImageRef ¶
RegistryFromImageRef returns the registry (and port, if set) from the image reference, otherwise returns the default bare registry, "docker.io".
func ReplaceRegistryInImageRef ¶
func ReplaceRegistryInImageRef(imageReference, replacementRegistry string) (imageRef string, err error)
ReplaceRegistryInImageRef returns the image reference with the registry replaced.
Types ¶
type ContainerTransformer ¶
type ContainerTransformer interface {
// Name returns the name of the transformer rule
Name() string
// RewriteImage takes a docker image reference and returns the same image reference rewritten for a harbor
// proxy cache project endpoint, if one is available, else returns the original image reference.
RewriteImage(imageRef string) (string, error)
// CheckUpstream ensures that the docker image reference exists in the upstream registry
// and returns if the image exists, or an error if the registry can't be contacted.
CheckUpstream(ctx context.Context, imageRef string) (bool, error)
}
ContainerTransformer rewrites docker image references for harbor proxy cache projects.
func MakeTransformers ¶ added in v0.8.0
type DockerConfig ¶ added in v0.8.0
type DockerConfig map[string]dockerConfigEntryWithAuth
DockerConfig represents the config file used by the docker CLI. This config that represents the credentials that should be used when pulling images from specific image repositories.
type DockerConfigEntry ¶ added in v0.8.0
func (DockerConfigEntry) MarshalJSON ¶ added in v0.8.0
func (ident DockerConfigEntry) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*DockerConfigEntry) UnmarshalJSON ¶ added in v0.8.0
func (ident *DockerConfigEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type DockerConfigJSON ¶ added in v0.8.0
type DockerConfigJSON struct {
Auths DockerConfig `json:"auths"`
// +optional
HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"`
}
DockerConfigJSON represents ~/.docker/config.json file info see https://github.com/docker/docker/pull/12009
type PodContainerProxier ¶
type PodContainerProxier struct {
Client client.Client
Decoder admission.Decoder
Transformers []ContainerTransformer
Verbose bool
// kube config settings
KubeClientBurst int
KubeClientQPS float32
}
PodContainerProxier mutates init containers and containers to redirect them to the harbor proxy cache if one exists.
func (*PodContainerProxier) InjectDecoder ¶
func (p *PodContainerProxier) InjectDecoder(d admission.Decoder) error
InjectDecoder injects the decoder.