webhook

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BareRegistry = "docker.io"

Variables

This section is empty.

Functions

func RegistryFromImageRef

func RegistryFromImageRef(imageReference string) (registry string, err error)

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

func MakeTransformers(rules []config.ProxyRule, client client.Client) ([]ContainerTransformer, error)

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

type DockerConfigEntry struct {
	Username string
	Password string
	Email    string
}

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) Handle

Handle mutates init containers and containers.

func (*PodContainerProxier) InjectDecoder

func (p *PodContainerProxier) InjectDecoder(d admission.Decoder) error

InjectDecoder injects the decoder.

Jump to

Keyboard shortcuts

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