hub

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Name is the application name
	Name string `json:"name"`
	// Version is the application version
	Version string `json:"version"`
	// Created is the application creation timestamp
	Created time.Time `json:"created"`
	// SizeBytes is the application size in bytes
	SizeBytes int64 `json:"sizeBytes"`
	// Description is the image description
	Description string `json:"description"`
	// Type is the image type, for example application or cluster
	Type string `json:"type"`
}

App represents a single application item in the hub

type Config

type Config struct {
	// Bucket is the S3 bucket name
	Bucket string
	// Prefix is the S3 path prefix
	Prefix string
	// Region is the S3 region
	Region string
	// FieldLogger is used for logging
	logrus.FieldLogger
	// S3 is optional S3 API client
	S3 s3iface.S3API
}

Config is the S3-backed hub configuration

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

CheckAndSetDefaults validates config and sets defaults

type Hub

type Hub interface {
	// List returns a list of applications in the hub
	List(withPrereleases bool) ([]App, error)
	// Download downloads the specified application installer into provided file
	Download(*os.File, loc.Locator) error
	// Get returns application installer tarball of the specified version
	Get(loc.Locator) (io.ReadCloser, error)
	// GetLatestVersion returns latest version of the specified application
	GetLatestVersion(name string) (string, error)
}

Hub defines an interface for the hub that stores Telekube application installers

The current hub implementation is backed by S3 and all application installers are stored in the bucket of the following structure:

hub.gravitational.io ∟ gravity

∟ oss
  ∟ index.yaml
  ∟ app
    ∟ telekube
      ∟ 5.2.0
        ∟ linux
          ∟ x86_64
            ∟ telekube-5.2.0-linux-x86_64.tar
            ∟ telekube-5.2.0-linux-x86_64.tar.sha256
      ∟ latest: // same as versioned sub-bucket
      ∟ stable: // same as versioned sub-bucket

The index file, index.yaml, provides information about installers stored in the bucket and is updated every time a new version is published. The index file format is the same as Helm's chart repository index file.

type S3Hub

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

S3Hub is the S3-backed hub implementation

func New

func New(config Config) (*S3Hub, error)

New returns a new S3-backed hub instance

func (*S3Hub) Download

func (h *S3Hub) Download(f *os.File, locator loc.Locator) (err error)

Download downloads the specified application installer into provided file

func (*S3Hub) Get

func (h *S3Hub) Get(locator loc.Locator) (io.ReadCloser, error)

Get returns application installer tarball of the specified version

func (*S3Hub) GetLatestVersion

func (h *S3Hub) GetLatestVersion(name string) (string, error)

GetLatestVersion returns the latest version of the specified application in the hub

func (*S3Hub) List

func (h *S3Hub) List(withPrereleases bool) (items []App, err error)

List returns a list of applications in the hub

Jump to

Keyboard shortcuts

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