Documentation ¶
Index ¶
- Constants
- func Deploy(sched interfaces.Scheduler, options interfaces.DependencyGraphOptions, ...) (string, error)
- func EnsureNoCycles(dependencies []client.Dependency, resdefs map[string]client.ResourceDefinition) error
- func FromConfig(client client.Interface, cfg map[string]string) (interfaces.Scheduler, interfaces.DependencyGraphOptions, error)
- func GetStatus(client client.Interface, selector labels.Selector, ...) (interfaces.DeploymentStatus, interfaces.DeploymentReport, error)
- func New(client client.Interface, selector labels.Selector, concurrency int) interfaces.Scheduler
- func ProcessDeploymentTasks(client client.Interface, stopChan <-chan struct{})
- type ScheduledResource
- func (sr *ScheduledResource) GetNodeReport(name string) report.NodeReport
- func (sr *ScheduledResource) IsBlocked() bool
- func (sr *ScheduledResource) Key() string
- func (sr *ScheduledResource) RequestCreation(toCreate chan *ScheduledResource) bool
- func (sr *ScheduledResource) ResetStatus()
- func (sr *ScheduledResource) Status(meta map[string]string) (interfaces.ResourceStatus, error)
- func (sr *ScheduledResource) Wait(checkInterval time.Duration, timeout time.Duration, stopChan <-chan struct{}) (bool, error)
Constants ¶
const ( CheckInterval = time.Millisecond * 1000 WaitTimeout = time.Second * 600 )
CheckInterval is an interval between rechecking the tree for updates
Variables ¶
This section is empty.
Functions ¶
func Deploy ¶
func Deploy(sched interfaces.Scheduler, options interfaces.DependencyGraphOptions, inplace bool, stopChan <-chan struct{}) (string, error)
Deploy deploys the dependency graph either in-place or by creating deployment task for a standalone process
func EnsureNoCycles ¶
func EnsureNoCycles(dependencies []client.Dependency, resdefs map[string]client.ResourceDefinition) error
EnsureNoCycles ensures that dependency graph has no cycles
func FromConfig ¶
func FromConfig(client client.Interface, cfg map[string]string) (interfaces.Scheduler, interfaces.DependencyGraphOptions, error)
FromConfig deserializes setting map produced by Serialize method into Scheduler and DependencyGraphOptions objects
func GetStatus ¶
func GetStatus(client client.Interface, selector labels.Selector, options interfaces.DependencyGraphOptions) (interfaces.DeploymentStatus, interfaces.DeploymentReport, error)
GetStatus returns deployment status
func ProcessDeploymentTasks ¶
ProcessDeploymentTasks picks deployment tasks (configMap objects) one by one in chronological order, restores graph options from it and deploys the graph. This is the main function of long-running deployment process
Types ¶
type ScheduledResource ¶
type ScheduledResource struct { Requires []string RequiredBy []string Started bool Ignored bool Error error Existing bool interfaces.Resource // parentKey -> dependencyMetadata Meta map[string]map[string]string sync.RWMutex // contains filtered or unexported fields }
ScheduledResource is a wrapper for Resource with attached relationship data
func (*ScheduledResource) GetNodeReport ¶
func (sr *ScheduledResource) GetNodeReport(name string) report.NodeReport
GetNodeReport acts as a more verbose version of IsBlocked. It performs the same check as IsBlocked, but returns the DeploymentReport
func (*ScheduledResource) IsBlocked ¶
func (sr *ScheduledResource) IsBlocked() bool
IsBlocked checks whether a scheduled resource can be created. It checks status of resources it depends on, via API
func (*ScheduledResource) Key ¶
func (sr *ScheduledResource) Key() string
Key returns resource identifier with optional suffix
func (*ScheduledResource) RequestCreation ¶
func (sr *ScheduledResource) RequestCreation(toCreate chan *ScheduledResource) bool
RequestCreation does not create a scheduled resource immediately, but updates status and puts the scheduled resource to corresponding channel. Returns true if scheduled resource creation was actually requested, false otherwise.
func (*ScheduledResource) ResetStatus ¶
func (sr *ScheduledResource) ResetStatus()
ResetStatus resets cached status of scheduled resource
func (*ScheduledResource) Status ¶
func (sr *ScheduledResource) Status(meta map[string]string) (interfaces.ResourceStatus, error)
Status either returns cached copy of resource's status or retrieves it via Resource.Status. Only ResourceReady is cached to avoid inconsistency for resources that may go to failure state over time so that if resource becomes ready it stays in this status for the whole deployment duration. Errors returned by the resource are never cached, however if AC sees permanent problem with resource it may set the error field
func (*ScheduledResource) Wait ¶
func (sr *ScheduledResource) Wait(checkInterval time.Duration, timeout time.Duration, stopChan <-chan struct{}) (bool, error)
Wait periodically checks resource status and returns if the resource processing is finished, regardless successful or not. The actual result of processing could be obtained from returned error.