localregistry

package module
v0.0.0-...-ffc4c82 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

README

Local Registry Discovery

A Go implementation of the local registry discovery protocol.

Build Status GoDoc

Background

Local clusters like Kind, K3d, Minikube, and Microk8s let users iterate on Kubernetes quickly in a hermetic environment. To avoid network round-trip latency, these clusters can be configured to pull from a local, insecure registry.

KEP 1755 proposes a standard for how these clusters should expose their support for this feature, so that tooling can interoperate with them without redundant configuration.

Try it

Install the kubectl plugin:

go install github.com/tilt-dev/localregistry-go/cmd/kubectl-local_registry

Run:

kubectl local-registry get

If your cluster explicitly advertises a local registry, this tool will print the fields of LocalRegistryHostingV1.

Use it in your tool

This repo contains library code that reads the local registry configuration from a Kubernetes cluster, given a instance of the Go Kubernetes client.

License

Copyright 2020 Windmill Engineering

Licensed under the Apache License, Version 2.0

Documentation

Index

Constants

View Source
const ConfigMapField = "localRegistryHosting.v1"
View Source
const ConfigMapName = "local-registry-hosting"
View Source
const ConfigMapNamespace = "kube-public"
View Source
const SampleConfigMap = `` /* 318-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalRegistryHostingV1

type LocalRegistryHostingV1 struct {
	// Host documents the host (hostname and port) of the registry, as seen from
	// outside the cluster.
	//
	// This is the registry host that tools outside the cluster should push images
	// to.
	Host string `json:"host,omitempty" yaml:"host,omitempty"`

	// HostFromClusterNetwork documents the host (hostname and port) of the
	// registry, as seen from networking inside the container pods.
	//
	// This is the registry host that tools running on pods inside the cluster
	// should push images to. If not set, then tools inside the cluster should
	// assume the local registry is not available to them.
	HostFromClusterNetwork string `json:"hostFromClusterNetwork,omitempty" yaml:"hostFromClusterNetwork,omitempty"`

	// HostFromContainerRuntime documents the host (hostname and port) of the
	// registry, as seen from the cluster's container runtime.
	//
	// When tools apply Kubernetes objects to the cluster, this host should be
	// used for image name fields. If not set, users of this field should use the
	// value of Host instead.
	//
	// Note that it doesn't make sense semantically to define this field, but not
	// define Host or HostFromClusterNetwork. That would imply a way to pull
	// images without a way to push images.
	HostFromContainerRuntime string `json:"hostFromContainerRuntime,omitempty" yaml:"hostFromContainerRuntime,omitempty"`

	// Help contains a URL pointing to documentation for users on how to set
	// up and configure a local registry.
	//
	// Tools can use this to nudge users to enable the registry. When possible,
	// the writer should use as permanent a URL as possible to prevent drift
	// (e.g., a version control SHA).
	//
	// When image pushes to a registry host specified in one of the other fields
	// fail, the tool should display this help URL to the user. The help URL
	// should contain instructions on how to diagnose broken or misconfigured
	// registries.
	Help string `json:"help,omitempty" yaml:"help,omitempty"`
}

LocalRegistryHostingV1 describes a local registry that developer tools can connect to. A local registry allows clients to load images into the local cluster by pushing to this registry.

func Discover

Check if the cluster advertises support for a local registry.

If no registry advertised, returns an empty struct.

If a registry is advertised but we don't understand the config map, returns an error.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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