Documentation
¶
Overview ¶
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.
Index ¶
Constants ¶
const PodTree = "pods"
Variables ¶
This section is empty.
Functions ¶
func IsIndexDeletionFailure ¶
Types ¶
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
type Pod ¶
The structure of values written to the /pods tree.
func (Pod) MarshalJSON ¶
func (*Pod) UnmarshalJSON ¶
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 ¶
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 }