kaar

package module
v0.0.0-...-75fecea Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

kaar - Active Development!

Kubernetes Application Archive.

Bundle up a Kubernetes application 📦 into a single static OCI compliant archive.

  • Search for valid Kubernetes manifests (YAML)
  • Identify references to container images (OCI)
  • Create a single OCI compliant artifact that contains all the application data, and container image data

Runtime

kaar works just like Linux tar, which means good luck remembering the flags.

app/
├── deploy.yaml   # References a container image
├── Dockerfile
├── main.go
└── service.yaml


kaar [flags] [archive] [path]
kaar -cf myapp.kaar ./app        Create an archive with container images referenced in deploy.yaml
kaar -xf myapp.karr ./app        Extract an archive with container images referenced in deploy.yaml

 -x Extract
 -f File
 -z Zip
 -c Create
How it works

kaar will recursively iterate through every file in the path and search for valid Kubernetes YAML. Next kaar will identify all container images referenced from the YAML. Finally kaar will archive the container images (local first, remote next) as well as the YAML from the local directory. The resulting archive will be saved as an OCI compliant container image that can be uploaded to any container registry.

.kaar

Within each kaar archive there is a special directory .kaar which is used to store raw container image data, and meta information for each archive.

Documentation

Index

Constants

View Source
const (

	//	Reference: https://yaml.org/spec/1.2/spec.html
	//
	YAMLDelimiter string = "\n---\n"
)

Variables

View Source
var Version string

Functions

This section is empty.

Types

type Archive

type Archive struct {

	// Reference path for the archive on disk
	Path string

	// Manifests are valid Kubernetes manifests
	Manifests []*Manifest

	// Files is every file in the directory
	Files map[string]*fs.FileInfo
}

func Create

func Create(dir string, path string) (*Archive, error)

Create will attempt to create a kaarball from a directory

func Extract

func Extract(dir string, path string) (*Archive, error)

Extract will attempt to extract a kaarball

func NewArchive

func NewArchive(path string) *Archive

NewArchive will create a new archive from a registered path By convention the path should be the directory that may or may not exist for a specific archive.

path: directory to consider

func (*Archive) Extract

func (a *Archive) Extract(dir string) error

Extract will restore an archive from memory

dir: the name of the directory to write

func (*Archive) Load

func (a *Archive) Load(dir string) error

Load will recursively load the contents of a directory into memory

func (*Archive) LoadManifests

func (a *Archive) LoadManifests(path string) error

LoadManifests will attempt to parse a Kubernetes manifest and sync it's relevant embedded images locally

func (*Archive) WriteArchive

func (a *Archive) WriteArchive(path string) error

WriteArchive will write an archive to a given path

type EmbeddedImage

type EmbeddedImage struct {
}

type Manifest

type Manifest struct {
	// Path is the relative path of the manifest from the root directory
	Path    string
	Images  map[string]*EmbeddedImage
	Decoded runtime.Object
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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