apps

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package apps contains all logic for interacting with apps inside of a devenv. This entails discovering the versions of currently installed applications and adding a new application. This does NOT contain deployapp functionality which is currently in pkg/app instead.

Package apps provides tools for working with development docker registries

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound denotes that an application was not found
	ErrNotFound = errors.New("Application not found")
)

This block contains typed errors

Functions

func DevImageRegistry added in v1.38.0

func DevImageRegistry(ctx context.Context, log logrus.FieldLogger, b *box.Config, devenvName string) (string, error)

DevImageRegistry returns the closest development image registry

Types

type App

type App struct {
	// Name is the name of the application, this should be
	// 1:1 with the Github repository.
	Name string `json:"name" yaml:"name"`

	// Version is the currently deployed version of an application.
	// This should generally be semver and may be forced to be
	Version string `json:"version" yaml:"version"`

	// DeployedAt was when this app was deployed
	DeployedAt time.Time `json:"deployed_at" yaml:"deployedAt"`
}

App is an application inside of a devenv

type InMemoryClient

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

InMemoryClient is an in memory client that implements the apps.Interface interface for usage in unit testing.

func NewInMemory

func NewInMemory(defaultApps []App) *InMemoryClient

NewInMemory returns an apps.Interface satisfying client that uses an in memory store. Suitable for unit testing

func (*InMemoryClient) Delete

func (i *InMemoryClient) Delete(_ context.Context, name string) error

Delete deletes an application

func (*InMemoryClient) Get

func (i *InMemoryClient) Get(_ context.Context, name string) (App, error)

Get returns an application, if it exists

func (*InMemoryClient) List

func (i *InMemoryClient) List(_ context.Context) ([]App, error)

List returns all known apps

func (*InMemoryClient) Reset added in v1.33.0

func (i *InMemoryClient) Reset(_ context.Context) error

Reset resets the entire apps store

func (*InMemoryClient) Set

func (i *InMemoryClient) Set(_ context.Context, a *App) error

Set sets the state of a deployed application

type Interface

type Interface interface {
	// List lists all known apps inside of a devenv
	List(ctx context.Context) ([]App, error)

	// Get returns information about an application if it exists in
	// a devenv.
	Get(ctx context.Context, name string) (App, error)

	// Set sets information about an application in the devenv
	Set(ctx context.Context, a *App) error

	// Delete deletes an application in the devenv
	Delete(ctx context.Context, name string) error

	// Reset deletes all application infomation and the underlying
	// datastore.
	Reset(ctx context.Context) error
}

Interface is an interface for interacting with apps in a devenv

type KubernetesConfigmapClient

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

KubernetesConfigmapClient is a Kubernetes backed client that implements the apps.Interface interface for storing information about apps.

func NewKubernetesConfigmapClient

func NewKubernetesConfigmapClient(k kubernetes.Interface, namespace string) *KubernetesConfigmapClient

NewKubernetesConfigmapClient returns an initialized KubernetesConfigmapClient/ If namespace is not set it is defaulted to "devenv"

func (*KubernetesConfigmapClient) Delete

func (k *KubernetesConfigmapClient) Delete(ctx context.Context, name string) error

Delete deletes an application, if it exists

func (*KubernetesConfigmapClient) Get

Get returns an application, if it exists

func (*KubernetesConfigmapClient) List

List returns all known apps

func (*KubernetesConfigmapClient) Reset added in v1.33.0

Reset resets the entire apps store

func (*KubernetesConfigmapClient) Set

Set sets the state of a deployed application

Jump to

Keyboard shortcuts

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