instances

package
v0.0.0-...-dd9b6ef Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InstanceNameMismatchError indicates a request's Instance.Name and OldInstance.Name do not match
	InstanceNameMismatchError = status.Error(codes.FailedPrecondition, "Instance.Name and OldInstance.Name do not match")
)

Functions

func NamesEquate

func NamesEquate(instance *Instance) error

NamesEquate ensures Instance Name and OldInstance Name are the same

Types

type GetRequest

type GetRequest struct {
	*pb.GetOptions
	*pb.InstanceList
	// contains filtered or unexported fields
}

GetRequest represents a get request

func NewGetRequest

func NewGetRequest(getOptions *pb.GetOptions, server *Server) *GetRequest

NewGetRequest returns an instantiated GetRequest

func (*GetRequest) Run

func (request *GetRequest) Run() error

Run runs the GetRequest

type GetTemplatesRequest

type GetTemplatesRequest struct {
	*pb.InstanceList
	// contains filtered or unexported fields
}

GetTemplatesRequest represents a get request

func NewGetTemplatesRequest

func NewGetTemplatesRequest(server *Server) *GetTemplatesRequest

NewGetTemplatesRequest returns an instantiated GetTemplatesRequest

func (*GetTemplatesRequest) Run

func (request *GetTemplatesRequest) Run() error

Run runs the GetTemplatesRequest

type Instance

type Instance struct {
	*pb.Instance
	InstanceDir  string
	InstanceFile string
	// contains filtered or unexported fields
}

Instance represents an overlay Instance

func NewInstance

func NewInstance(pbInstance *pb.Instance, server *Server) *Instance

NewInstance returns an instantiated Instance

func (*Instance) Apply

func (instance *Instance) Apply(skipCommit bool) error

Apply creates or updates the instance in the stateStore

func (*Instance) Delete

func (instance *Instance) Delete() error

Delete deletes the instance in the stateStore

func (*Instance) KustomizeBuild

func (instance *Instance) KustomizeBuild() error

KustomizeBuild runs `kustomize build <dir>` to validate that it succeeds

func (*Instance) LoadStatuses

func (instance *Instance) LoadStatuses() error

LoadStatuses loads status information from Kubernetes into the Instance struct

func (*Instance) PipeKustomizeToKubectl

func (instance *Instance) PipeKustomizeToKubectl(suppressOutput bool, args ...string) ([]byte, error)

PipeKustomizeToKubectl runs `kustomize build <dir>` and pipes it's output into a kubectl command

type Item

type Item struct {
	Kind     string            `yaml:"kind"`
	Metadata Metadata          `yaml:"metadata"`
	Labels   map[string]string `yaml:"labels"`
	Status   ItemStatus        `yaml:"status"`
}

Item represents a Kubernetes Object

type ItemStatus

type ItemStatus struct {
	AvailableReplicas int32 `yaml:"availableReplicas"`
	ReadyReplicas     int32 `yaml:"readyReplicas"`
	DesiredReplicas   int32 `yaml:"replicas"`
	UpdatedReplicas   int32 `yaml:"updatedReplicas"`
}

ItemStatus respresents the status of a Kubernetes Object

type ItemStatuses

type ItemStatuses struct {
	Items []Item `yaml:"items"`
}

ItemStatuses represents a list of ItemStatuses

type Metadata

type Metadata struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
}

Metadata represents a Kubernetes Object's Metadata

type Server

type Server struct {
	InstancesDir         string
	TemplatesDir         string
	StateStore           state.Engine
	EnableKustomizeBuild bool
	EnableKubectl        bool
}

Server is the interface for interacting with Instances

func NewInstancesServer

func NewInstancesServer(instancesDir, templatesDir string, stateStore state.Engine, enableKustomizeBuild, enableKubectl bool) *Server

NewInstancesServer returns an instantiated InstanceServer

func (*Server) Apply

func (server *Server) Apply(ctx context.Context, pbInstance *pb.Instance) (*pb.Instance, error)

Apply adds/updates the given Instance, applies it to Kubernetes if desired, and commits the changes, rolling back as necessary

func (*Server) Delete

func (server *Server) Delete(ctx context.Context, pbInstance *pb.Instance) (*pb.Instance, error)

Delete deletes an Instance from Kubernetes and then from the State Store

func (*Server) Get

func (server *Server) Get(ctx context.Context, getOptions *pb.GetOptions) (*pb.InstanceList, error)

Get returns Instance(s) from the State Store, optionally with status information from Kubernetes

func (*Server) GetTemplates

func (server *Server) GetTemplates(ctx context.Context, _ *pb.Empty) (*pb.InstanceList, error)

GetTemplates returns a list of Instance templates from the State Store

Jump to

Keyboard shortcuts

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