Documentation ¶
Overview ¶
Need to start DRYing up the registry code, this is terrible
Index ¶
- Constants
- Variables
- func CreateKVStore(filename string) etcd.Storer
- func MatchAllEvents(e *api.Event) bool
- func MatchAllLivePods(p *api.Pod) bool
- func MatchAllNodes(p *api.Node) bool
- func MatchAllPods(p *api.Pod) bool
- type EventRegistry
- func (reg *EventRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *EventRegistry) CreateEvent(e *api.Event) (*api.Event, error)
- func (reg *EventRegistry) Delete(name string) (api.MilpaObject, error)
- func (reg *EventRegistry) DeleteEvent(e *api.Event) (*api.Event, error)
- func (reg *EventRegistry) Get(name string) (api.MilpaObject, error)
- func (reg *EventRegistry) GetEvent(obj *api.ObjectReference, name string) (*api.Event, error)
- func (reg *EventRegistry) Handle(e events.Event) error
- func (reg *EventRegistry) List() (api.MilpaObject, error)
- func (reg *EventRegistry) ListEvents(filter func(*api.Event) bool) (*api.EventList, error)
- func (reg *EventRegistry) ListEventsByObject(obj *api.ObjectReference) (*api.EventList, error)
- func (reg *EventRegistry) ListEventsWithPrefix(prefix string, filter func(*api.Event) bool) (*api.EventList, error)
- func (reg *EventRegistry) New() api.MilpaObject
- func (reg *EventRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
- type LogRegistry
- func (reg *LogRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *LogRegistry) CreateLog(log *api.LogFile) (*api.LogFile, error)
- func (reg *LogRegistry) Delete(fullPath string) (api.MilpaObject, error)
- func (reg *LogRegistry) Get(compoundName string) (api.MilpaObject, error)
- func (reg *LogRegistry) GetLog(creatorName, logName string) (*api.LogFile, error)
- func (reg *LogRegistry) List() (api.MilpaObject, error)
- func (reg *LogRegistry) ListLogs(creatorName, logName string) (*api.LogFileList, error)
- func (reg *LogRegistry) New() api.MilpaObject
- func (reg *LogRegistry) PutLog(log *api.LogFile) (*api.LogFile, error)
- func (reg *LogRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
- type MetricsRegistry
- func (reg *MetricsRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *MetricsRegistry) Delete(name string) (api.MilpaObject, error)
- func (reg *MetricsRegistry) Get(name string) (api.MilpaObject, error)
- func (reg *MetricsRegistry) List() (api.MilpaObject, error)
- func (reg *MetricsRegistry) New() api.MilpaObject
- func (reg *MetricsRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
- type MetricsStore
- func (m *MetricsStore) DeletePods(podNames ...string)
- func (m *MetricsStore) GetLatestMetrics() *api.MetricsList
- func (m *MetricsStore) GetPodMetrics(podName string) *api.MetricsList
- func (m *MetricsStore) Insert(podName string, t api.Time, r api.ResourceMetrics)
- func (m *MetricsStore) ListPods() []string
- type NodeLister
- type NodeRegistry
- func (reg *NodeRegistry) AtomicUpdate(id string, modifier modifyNodeFunc) (*api.Node, error)
- func (reg *NodeRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *NodeRegistry) CreateNode(n *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) Delete(name string) (api.MilpaObject, error)
- func (reg *NodeRegistry) Get(id string) (api.MilpaObject, error)
- func (reg *NodeRegistry) GetNode(name string) (*api.Node, error)
- func (reg *NodeRegistry) List() (api.MilpaObject, error)
- func (reg *NodeRegistry) ListAllNodes(filter func(*api.Node) bool) (*api.NodeList, error)
- func (reg *NodeRegistry) ListNodes(filter func(*api.Node) bool) (*api.NodeList, error)
- func (reg *NodeRegistry) MarkForTermination(node *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) New() api.MilpaObject
- func (reg *NodeRegistry) PurgeNode(node *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) SetNodeDeletionTimestamp(node *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *NodeRegistry) UpdateNode(n *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) UpdateStatus(node *api.Node) (*api.Node, error)
- func (reg *NodeRegistry) Validate(obj api.MilpaObject) error
- type PodLister
- type PodMetrics
- type PodRegistry
- func (reg *PodRegistry) AtomicUpdate(name string, modifier modifyPodFunc) (*api.Pod, error)
- func (reg *PodRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *PodRegistry) CreatePod(p *api.Pod) (*api.Pod, error)
- func (reg *PodRegistry) Delete(name string) (api.MilpaObject, error)
- func (reg *PodRegistry) Get(name string) (api.MilpaObject, error)
- func (reg *PodRegistry) GetPod(k string) (*api.Pod, error)
- func (reg *PodRegistry) List() (api.MilpaObject, error)
- func (reg *PodRegistry) ListPods(filter func(*api.Pod) bool) (*api.PodList, error)
- func (reg *PodRegistry) MarkPodForTermination(pod *api.Pod) (*api.Pod, error)
- func (reg *PodRegistry) New() api.MilpaObject
- func (reg *PodRegistry) TerminatePod(pod *api.Pod, phase api.PodPhase, msg string) error
- func (reg *PodRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
- func (reg *PodRegistry) UpdatePodSpecAndLabels(p *api.Pod) (*api.Pod, error)
- func (reg *PodRegistry) UpdatePodStatus(p *api.Pod, reason string) (*api.Pod, error)
- func (reg *PodRegistry) Validate(obj api.MilpaObject) error
- type Registryer
Constants ¶
const ( EventDirectory string = "milpa/events/" EventDirectoryPlaceholder string = "milpa/events/." EventTrashDirectory string = "milpa/trash/events/" EventTrashDirectoryPlaceholder string = "milpa/trash/events/." DefaultTTL time.Duration = 1 * time.Hour )
const ( LogDirectory string = "milpa/logs" LogDirectoryPlaceholder string = "milpa/logs/." DefaultLogTTL time.Duration = 1 * time.Hour )
const ( NodePath string = "milpa/nodes" NodeTrashPath string = "milpa/trash/nodes" NodeDirectoryPlaceholder string = "milpa/nodes/." NodeTrashDirectoryPlaceholder string = "milpa/trash/nodes/." )
const ( PodPath string = "milpa/pods" PodTrashPath string = "milpa/trash/pods" PodDirectoryPlaceholder string = "milpa/pods/." PodTrashDirectoryPlaceholder string = "milpa/trash/pods/." )
const MilpaRoot = "milpa/"
Variables ¶
var (
ErrAlreadyExists = errors.New("Object already exists")
)
Functions ¶
func CreateKVStore ¶
func MatchAllEvents ¶
func MatchAllLivePods ¶
func MatchAllNodes ¶
func MatchAllPods ¶
Types ¶
type EventRegistry ¶
func NewEventRegistry ¶
func NewEventRegistry(kvstore etcd.Storer, codec api.MilpaCodec, es *events.EventSystem) *EventRegistry
func SetupTestEventRegistry ¶
func SetupTestEventRegistry() (*EventRegistry, func())
func (*EventRegistry) Create ¶
func (reg *EventRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
func (*EventRegistry) CreateEvent ¶
func (*EventRegistry) Delete ¶
func (reg *EventRegistry) Delete(name string) (api.MilpaObject, error)
func (*EventRegistry) DeleteEvent ¶
func (*EventRegistry) Get ¶
func (reg *EventRegistry) Get(name string) (api.MilpaObject, error)
func (*EventRegistry) GetEvent ¶
func (reg *EventRegistry) GetEvent(obj *api.ObjectReference, name string) (*api.Event, error)
func (*EventRegistry) List ¶
func (reg *EventRegistry) List() (api.MilpaObject, error)
func (*EventRegistry) ListEvents ¶
func (*EventRegistry) ListEventsByObject ¶
func (reg *EventRegistry) ListEventsByObject(obj *api.ObjectReference) (*api.EventList, error)
func (*EventRegistry) ListEventsWithPrefix ¶
func (*EventRegistry) New ¶
func (reg *EventRegistry) New() api.MilpaObject
func (*EventRegistry) Update ¶
func (reg *EventRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
type LogRegistry ¶
func NewLogRegistry ¶
func NewLogRegistry(kvstore etcd.Storer, codec api.MilpaCodec, es *events.EventSystem) *LogRegistry
func SetupTestLogRegistry ¶
func SetupTestLogRegistry() (*LogRegistry, func())
func (*LogRegistry) Create ¶
func (reg *LogRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
func (*LogRegistry) Delete ¶
func (reg *LogRegistry) Delete(fullPath string) (api.MilpaObject, error)
func (*LogRegistry) Get ¶
func (reg *LogRegistry) Get(compoundName string) (api.MilpaObject, error)
func (*LogRegistry) GetLog ¶
func (reg *LogRegistry) GetLog(creatorName, logName string) (*api.LogFile, error)
func (*LogRegistry) List ¶
func (reg *LogRegistry) List() (api.MilpaObject, error)
func (*LogRegistry) ListLogs ¶
func (reg *LogRegistry) ListLogs(creatorName, logName string) (*api.LogFileList, error)
func (*LogRegistry) New ¶
func (reg *LogRegistry) New() api.MilpaObject
func (*LogRegistry) Update ¶
func (reg *LogRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
type MetricsRegistry ¶
type MetricsRegistry struct {
MetricsStore
}
func NewMetricsRegistry ¶
func NewMetricsRegistry(numDatapoints int) *MetricsRegistry
func (*MetricsRegistry) Create ¶
func (reg *MetricsRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
func (*MetricsRegistry) Delete ¶
func (reg *MetricsRegistry) Delete(name string) (api.MilpaObject, error)
func (*MetricsRegistry) Get ¶
func (reg *MetricsRegistry) Get(name string) (api.MilpaObject, error)
func (*MetricsRegistry) List ¶
func (reg *MetricsRegistry) List() (api.MilpaObject, error)
func (*MetricsRegistry) New ¶
func (reg *MetricsRegistry) New() api.MilpaObject
func (*MetricsRegistry) Update ¶
func (reg *MetricsRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
type MetricsStore ¶
func NewMetricsStore ¶
func NewMetricsStore(numDatapoints int) *MetricsStore
func (*MetricsStore) DeletePods ¶
func (m *MetricsStore) DeletePods(podNames ...string)
func (*MetricsStore) GetLatestMetrics ¶
func (m *MetricsStore) GetLatestMetrics() *api.MetricsList
get the most recent metrics from all pods
func (*MetricsStore) GetPodMetrics ¶
func (m *MetricsStore) GetPodMetrics(podName string) *api.MetricsList
Get all the metrics for a pod Todo: update this to return not found
func (*MetricsStore) Insert ¶
func (m *MetricsStore) Insert(podName string, t api.Time, r api.ResourceMetrics)
todo: fix this to take a pointer to a metric and calculate the window lightweight: t, ResourceMetrics
func (*MetricsStore) ListPods ¶
func (m *MetricsStore) ListPods() []string
type NodeLister ¶
type NodeRegistry ¶
type NodeRegistry struct { etcd.Storer Codec api.MilpaCodec // contains filtered or unexported fields }
func NewNodeRegistry ¶
func NewNodeRegistry(kvstore etcd.Storer, codec api.MilpaCodec, es *events.EventSystem) *NodeRegistry
func SetupTestNodeRegistry ¶
func SetupTestNodeRegistry() (*NodeRegistry, func())
func (*NodeRegistry) AtomicUpdate ¶
func (reg *NodeRegistry) AtomicUpdate(id string, modifier modifyNodeFunc) (*api.Node, error)
func (*NodeRegistry) Create ¶
func (reg *NodeRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
func (*NodeRegistry) CreateNode ¶
func (*NodeRegistry) Delete ¶
func (reg *NodeRegistry) Delete(name string) (api.MilpaObject, error)
func (*NodeRegistry) Get ¶
func (reg *NodeRegistry) Get(id string) (api.MilpaObject, error)
func (*NodeRegistry) List ¶
func (reg *NodeRegistry) List() (api.MilpaObject, error)
func (*NodeRegistry) ListAllNodes ¶
This is a terrible function but is helpful for tests in the node controller it's possible listnodes should just do this functionality...
func (*NodeRegistry) MarkForTermination ¶
func (*NodeRegistry) New ¶
func (reg *NodeRegistry) New() api.MilpaObject
func (*NodeRegistry) SetNodeDeletionTimestamp ¶
func (*NodeRegistry) Update ¶
func (reg *NodeRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
func (*NodeRegistry) UpdateNode ¶
func (*NodeRegistry) UpdateStatus ¶
func (*NodeRegistry) Validate ¶
func (reg *NodeRegistry) Validate(obj api.MilpaObject) error
type PodLister ¶
type PodLister interface { GetPod(string) (*api.Pod, error) ListPods(func(*api.Pod) bool) (*api.PodList, error) }
These Lister Interfaces were added to enforce read only registries that prevent callers from modifying core objects they have no business messing with.
type PodMetrics ¶
type PodMetrics struct {
// contains filtered or unexported fields
}
////////////////////////////////////////////////////////////////////
func NewPodMetrics ¶
func NewPodMetrics(name string, numDatpoints int) *PodMetrics
type PodRegistry ¶
type PodRegistry struct { etcd.Storer Codec api.MilpaCodec // contains filtered or unexported fields }
func NewPodRegistry ¶
func NewPodRegistry(kvstore etcd.Storer, codec api.MilpaCodec, es *events.EventSystem, sv *validation.StatefulValidator) *PodRegistry
func SetupTestPodRegistry ¶
func SetupTestPodRegistry() (*PodRegistry, func())
func (*PodRegistry) AtomicUpdate ¶
func (reg *PodRegistry) AtomicUpdate(name string, modifier modifyPodFunc) (*api.Pod, error)
func (*PodRegistry) Create ¶
func (reg *PodRegistry) Create(obj api.MilpaObject) (api.MilpaObject, error)
func (*PodRegistry) Delete ¶
func (reg *PodRegistry) Delete(name string) (api.MilpaObject, error)
While this is called delete, that's simply because it's the handler for the milpactl call to "Delete". Really, it specifies that we should terminate this pod and then delete it
func (*PodRegistry) Get ¶
func (reg *PodRegistry) Get(name string) (api.MilpaObject, error)
func (*PodRegistry) List ¶
func (reg *PodRegistry) List() (api.MilpaObject, error)
func (*PodRegistry) MarkPodForTermination ¶
func (*PodRegistry) New ¶
func (reg *PodRegistry) New() api.MilpaObject
func (*PodRegistry) TerminatePod ¶
func (*PodRegistry) Update ¶
func (reg *PodRegistry) Update(obj api.MilpaObject) (api.MilpaObject, error)
func (*PodRegistry) UpdatePodSpecAndLabels ¶
func (*PodRegistry) UpdatePodStatus ¶
func (*PodRegistry) Validate ¶
func (reg *PodRegistry) Validate(obj api.MilpaObject) error
type Registryer ¶
type Registryer interface { New() api.MilpaObject Create(obj api.MilpaObject) (api.MilpaObject, error) Update(obj api.MilpaObject) (api.MilpaObject, error) Get(id string) (api.MilpaObject, error) List() (api.MilpaObject, error) Delete(id string) (api.MilpaObject, error) }