cache

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// marked as "true" always, for searching
	CacheGlobalLabel = "cache.wasme.io/cache_event"
	// ref to the image
	CacheImageRefLabel = "cache.wasme.io/image_ref"
	Reason_ImageAdded  = "ImageAdded"
	Reason_ImageError  = "ImageError"
)

Variables

View Source
var (
	CacheName            = "wasme-cache"
	CacheNamespace       = "wasme"
	CacheImageRepository = "quay.io/solo-io/wasme"
	CacheImageTag        = version.Version
	ImagesKey            = "images"
	DefaultCacheArgs     = func(namespace string) []string {
		return []string{
			"cache",
			"--directory",
			"/var/local/lib/wasme-cache",
			"--ref-file",
			"/etc/wasme-cache/images.txt",
			"--cache-ns",
			namespace,
		}
	}
)

Functions

func Digest2filename added in v0.0.13

func Digest2filename(digest digest.Digest) string

func EventAnnotations added in v0.0.16

func EventAnnotations(image string) map[string]string

func EventLabels added in v0.0.16

func EventLabels(image string) map[string]string

func GetImageEvents added in v0.0.16

func GetImageEvents(kube kubernetes.Interface, eventNamespace, image string) ([]v1.Event, error)

get the cache events for an image. used by tests and the istio deployer, not by this package

func MakeDaemonSet added in v0.0.13

func MakeDaemonSet(name, namespace, image string, labels map[string]string, args []string, pullPolicy v1.PullPolicy) *appsv1.DaemonSet

func MakeRbac added in v0.0.16

func MakeRbac(name, namespace string) (*rbacv1.Role, *rbacv1.RoleBinding)

func MakeServiceAccount added in v0.0.16

func MakeServiceAccount(name, namespace string) *v1.ServiceAccount

func NewDeployer

func NewDeployer(kube kubernetes.Interface, namespace, name string, imageRepo, imageTag string, args []string, pullPolicy v1.PullPolicy) *deployer

func NewLocalImagePuller added in v0.0.13

func NewLocalImagePuller(imageCache Cache, refFile string, directory string, cacheNotifier EventNotifier) *localImagePuller

Types

type Cache

type Cache interface {
	// adds the image retrieve the digest for the image.
	// the digest will be cached if it is the initial Get
	Add(ctx context.Context, image string) (digest.Digest, error)

	// retrieve the wasm file from the image
	Get(ctx context.Context, digest digest.Digest) (model.Filter, error)
	http.Handler
}

Cache stores digests and image contents in memory

func NewCache

func NewCache(puller pull.ImagePuller) Cache

type CacheImpl

type CacheImpl struct {
	Puller pull.ImagePuller
	// contains filtered or unexported fields
}

func (*CacheImpl) Add

func (c *CacheImpl) Add(ctx context.Context, ref string) (digest.Digest, error)

func (*CacheImpl) Get

func (c *CacheImpl) Get(ctx context.Context, digest digest.Digest) (model.Filter, error)

func (*CacheImpl) ServeHTTP

func (c *CacheImpl) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Deployer

type Deployer interface {
	// ensures the desired cache is deployed.
	// if a cache component already exists, it is updated
	EnsureCache() error
}

the cache deployer deploys an instance of the cache to Kubernetes.

type EventNotifier added in v0.0.16

type EventNotifier interface {
	Notify(err error, image string) error
}

type LocalImagePuller added in v0.0.13

type LocalImagePuller interface {
	// watches ref file (images.txt) pulls each image to disk
	WatchFile(ctx context.Context) error
}

pulls images for a local cache

type Notifier added in v0.0.16

type Notifier struct {
	// contains filtered or unexported fields
}

sends Events to kubernetes when images are added to the cache

func NewNotifier added in v0.0.16

func NewNotifier(kube kubernetes.Interface, wasmeNamespace string, cacheName string) *Notifier

func (*Notifier) Notify added in v0.0.16

func (n *Notifier) Notify(err error, image string) error

Jump to

Keyboard shortcuts

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