Version: v0.0.0-...-8223eb1 Latest Latest

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 11 Imported by: 0



TODO: update this comment as things change. The podstore package provides a Store interface interacting with the /pods tree. Prior to this package, this is done through the consul.Store interface. The consul package is a hodge-podge of a lot of functionality for interacting with consul, but is largely used to interface with the /intent and /reality trees. /intent and /reality work great for scheduling pod manifests that are meant to run on a node "forever" (meaning until another pod manifest is scheduled over it) but it doesn't work great for one-off jobs, or for reporting back success/failure information.

The podstore package is the future of scheduling pods. It will write pods to the /pods tree with a uuid key name. In order to preserve the preparer's consul watching functionality, pods written to /pods will have a secondary reference in /intent at the normal location pointing to the /pods entry. The key in /intent will share the uuid of the /pods key it's referring to.



View Source
const PodTree = "pods"


This section is empty.


func IsIndexDeletionFailure

func IsIndexDeletionFailure(err error) bool

func IsNoPod

func IsNoPod(err error) bool


type IndexDeletionFailure

type IndexDeletionFailure struct {
	// contains filtered or unexported fields

Custom error type to be returned when a pod is removed but there is a failure removing the secondary index, so callers know not to retry the full deletion but errors can be reported.

func (IndexDeletionFailure) Error

func (u IndexDeletionFailure) Error() string

type KV

type KV interface {
	Get(key string, q *api.QueryOptions) (*api.KVPair, *api.QueryMeta, error)
	Delete(key string, w *api.WriteOptions) (*api.WriteMeta, error)
	Put(pair *api.KVPair, w *api.WriteOptions) (*api.WriteMeta, error)

Subset of api.KV{} functionality so we can mock it out for tests.

type NoPod

type NoPod struct {
	// contains filtered or unexported fields

func NoPodError

func NoPodError(key types.PodUniqueKey) NoPod

func (NoPod) Error

func (n NoPod) Error() string

type Pod

type Pod struct {
	Manifest manifest.Manifest
	Node     types.NodeName

The structure of values written to the /pods tree.

func (Pod) MarshalJSON

func (p Pod) MarshalJSON() ([]byte, error)

func (Pod) ToRaw

func (p Pod) ToRaw() (RawPod, error)

func (*Pod) UnmarshalJSON

func (p *Pod) UnmarshalJSON(b []byte) error

type PodIndex

type PodIndex struct {
	// The uuid of the pod. This can be used to retrieve the full pod from
	// the /pods tree
	PodKey types.PodUniqueKey `json:"pod_key"`

The structure of index values written to the /intent tree

type RawPod

type RawPod struct {
	Manifest string         `json:"manifest"`
	Node     types.NodeName `json:"node"`

Defines the JSON structure written to the /pods tree. The Pod type can't be used because manifest.Manifest doesn't marshal cleanly

type Store

type Store interface {
	ReadPod(key types.PodUniqueKey) (Pod, error)
	ReadPodFromIndex(index PodIndex) (Pod, error)
	Schedule(manifest manifest.Manifest, node types.NodeName) (types.PodUniqueKey, error)
	Unschedule(key types.PodUniqueKey) error

	DeleteRealityIndex(podKey types.PodUniqueKey, node types.NodeName) error
	WriteRealityIndex(ctx context.Context, podKey types.PodUniqueKey, node types.NodeName) error

func NewConsul

func NewConsul(consulKV KV) Store


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL