groot

package module
v0.0.0-...-90a43f9 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

README

groot

A framework for building image plugins for Guardian in Go.

Running tests

Running Groot tests is as easy as running scripts/test. Some of the tests are testing against a private docker registry and therefore you need to setup your own (see below for instructions how to do that). The following environment variables configure the private docker registry access:

  • DOCKER_REGISTRY_USERNAME - the private registry username
  • DOCKER_REGISTRY_PASSWORD - the private registry password
  • PRIVATE_DOCKER_IMAGE_URL - the private docker image URL, e.g. docker://my-user/my-image:my-tag

Setting up the private docker image

  • Build and push the docker image from fetcher/layerfetcher/source/assets/groot-private-docker-image/Dockerfile:
docker build -t my-user/my-image:my-tag fetcher/layerfetcher/source/assets/groot-private-docker-image
docker login
docker push my-user/my-image:my-tag
  • Make sure that the image is private (e.g. via logging into the registry admin UI)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(driver Driver, argv []string, driverFlags []cli.Flag, version string)

Types

type DiskUsage

type DiskUsage struct {
	TotalBytesUsed     int64 `json:"total_bytes_used"`
	ExclusiveBytesUsed int64 `json:"exclusive_bytes_used"`
}

type DockerConfig

type DockerConfig struct {
	InsecureRegistries []string
	Username           string
	Password           string
}

type Driver

type Driver interface {
	ImageDriver
	VolumeDriver
}

Driver should implement the filesystem interaction

type Groot

type Groot struct {
	Driver      Driver
	Logger      lager.Logger
	ImagePuller ImagePuller
}

func (*Groot) Create

func (g *Groot) Create(handle string, diskLimit int64, excludeImageFromQuota bool) (runspec.Spec, error)

func (*Groot) Delete

func (g *Groot) Delete(handle string) error

func (*Groot) Pull

func (g *Groot) Pull() error

func (*Groot) Stats

func (g *Groot) Stats(handle string) (VolumeStats, error)

type ImageDriver

type ImageDriver interface {
	Bundle(logger lager.Logger, bundleID string, layerIDs []string, diskLimit int64) (runspec.Spec, error)
	Delete(logger lager.Logger, bundleID string) error
	Stats(logger lager.Logger, bundleID string) (VolumeStats, error)
	WriteMetadata(logger lager.Logger, bundleID string, imageMetadata ImageMetadata) error
}

type ImageMetadata

type ImageMetadata struct {
	Size int64 `json:"size"`
}

type ImagePuller

type ImagePuller interface {
	Pull(logger lager.Logger, spec imagepuller.ImageSpec) (imagepuller.Image, error)
}

ImagePuller should be able to download and store a remote (or local) image and return all its layer information so that it can be bundled together by the driver

type SilentError

type SilentError struct {
	Underlying error
}

SilentError silences errors. urfave/cli already prints certain errors, we don't want to print them twice

func (SilentError) Error

func (e SilentError) Error() string

type VolumeDriver

type VolumeDriver interface {
	Unpack(logger lager.Logger, layerID string, parentIDs []string, layerTar io.Reader) (int64, error)
}

type VolumeStats

type VolumeStats struct {
	DiskUsage DiskUsage `json:"disk_usage"`
}

Directories

Path Synopsis
fetcher
layerfetcher/layerfetcherfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
imagepullerfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
integration

Jump to

Keyboard shortcuts

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