daemon

package
v0.0.0-...-3f67607 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	V              string
	Cluster        cluster.Cluster
	Manifests      cluster.Manifests
	Registry       registry.Registry
	ImageRefresh   chan image.Name
	Repo           git.Repo
	Checkout       *git.Checkout
	Jobs           *job.Queue
	JobStatusCache *job.StatusCache
	EventWriter    event.EventWriter
	Logger         log.Logger
	// bookkeeping
	*LoopVars
}

Daemon is the fully-functional state of a daemon (compare to `NotReadyDaemon`).

func (*Daemon) Export

func (d *Daemon) Export(ctx context.Context) ([]byte, error)

func (*Daemon) GitPollLoop

func (d *Daemon) GitPollLoop(stop chan struct{}, wg *sync.WaitGroup, logger log.Logger)

func (*Daemon) GitRepoConfig

func (d *Daemon) GitRepoConfig(ctx context.Context, regenerate bool) (flux.GitConfig, error)

func (*Daemon) JobStatus

func (d *Daemon) JobStatus(ctx context.Context, jobID job.ID) (job.Status, error)

JobStatus - Ask the daemon how far it's got committing things; in particular, is the job queued? running? committed? If it is done, the commit ref is returned.

func (*Daemon) ListImages

func (d *Daemon) ListImages(ctx context.Context, spec update.ResourceSpec) ([]flux.ImageStatus, error)

List the images available for set of services

func (*Daemon) ListServices

func (d *Daemon) ListServices(ctx context.Context, namespace string) ([]flux.ControllerStatus, error)

func (*Daemon) LogEvent

func (d *Daemon) LogEvent(ev event.Event) error

func (*Daemon) NotifyChange

func (d *Daemon) NotifyChange(ctx context.Context, change remote.Change) error

Tell the daemon to synchronise the cluster with the manifests in the git repo. This has an error return value because upstream there may be comms difficulties or other sources of problems; here, we always succeed because it's just bookkeeping.

func (*Daemon) Ping

func (d *Daemon) Ping(ctx context.Context) error

func (*Daemon) SyncStatus

func (d *Daemon) SyncStatus(ctx context.Context, commitRef string) ([]string, error)

Ask the daemon how far it's got applying things; in particular, is it past the supplied release? Return the list of commits between where we have applied and the ref given, inclusive. E.g., if you send HEAD, you'll get all the commits yet to be applied. If you send a hash and it's applied _past_ it, you'll get an empty list.

func (*Daemon) UpdateManifests

func (d *Daemon) UpdateManifests(ctx context.Context, spec update.Spec) (job.ID, error)

Apply the desired changes to the config files

func (*Daemon) Version

func (d *Daemon) Version(ctx context.Context) (string, error)

type DaemonJobFunc

type DaemonJobFunc func(ctx context.Context, jobID job.ID, working *git.Checkout, logger log.Logger) (*event.CommitEventMetadata, error)

Let's use the CommitEventMetadata as a convenient transport for the results of a job; if no commit was made (e.g., if it was a dry run), leave the revision field empty.

type LoopVars

type LoopVars struct {
	GitPollInterval      time.Duration
	RegistryPollInterval time.Duration
	// contains filtered or unexported fields
}

func (*LoopVars) AskForImagePoll

func (d *LoopVars) AskForImagePoll()

Ask for an image poll, or if there's one waiting, let that happen.

func (*LoopVars) AskForSync

func (d *LoopVars) AskForSync()

Ask for a sync, or if there's one waiting, let that happen.

type NotReadyDaemon

type NotReadyDaemon struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NotReadyDaemon is a stub implementation used to serve a subset of the API when we have yet to successfully clone the config repo.

func NewNotReadyDaemon

func NewNotReadyDaemon(version string, cluster cluster.Cluster, gitRemote flux.GitRemoteConfig) (nrd *NotReadyDaemon)

NotReadyDaemon is a state of the daemon that has not proceeded past getting the git repo set up. Since this typically needs some actions on the part of the user, this state can last indefinitely; so, it has its own code.

func (*NotReadyDaemon) Export

func (nrd *NotReadyDaemon) Export(ctx context.Context) ([]byte, error)

func (*NotReadyDaemon) GitRepoConfig

func (nrd *NotReadyDaemon) GitRepoConfig(ctx context.Context, regenerate bool) (flux.GitConfig, error)

func (*NotReadyDaemon) JobStatus

func (nrd *NotReadyDaemon) JobStatus(context.Context, job.ID) (job.Status, error)

func (*NotReadyDaemon) ListImages

func (*NotReadyDaemon) ListServices

func (nrd *NotReadyDaemon) ListServices(ctx context.Context, namespace string) ([]flux.ControllerStatus, error)

func (*NotReadyDaemon) NotifyChange

func (nrd *NotReadyDaemon) NotifyChange(context.Context, remote.Change) error

func (*NotReadyDaemon) Ping

func (nrd *NotReadyDaemon) Ping(ctx context.Context) error

func (*NotReadyDaemon) Reason

func (nrd *NotReadyDaemon) Reason() error

func (*NotReadyDaemon) SyncStatus

func (nrd *NotReadyDaemon) SyncStatus(context.Context, string) ([]string, error)

func (*NotReadyDaemon) UpdateManifests

func (nrd *NotReadyDaemon) UpdateManifests(context.Context, update.Spec) (job.ID, error)

func (*NotReadyDaemon) UpdateStatus

func (nrd *NotReadyDaemon) UpdateStatus(status flux.GitRepoStatus, reason error)

func (*NotReadyDaemon) Version

func (nrd *NotReadyDaemon) Version(ctx context.Context) (string, error)

type Ref

type Ref struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Ref is a cell containing a platform implementation, that we can update atomically. The point of this is to be able to have a platform in use (e.g., answering RPCs), and swap it later when the state changes.

func NewRef

func NewRef(platform remote.Platform) (pr *Ref)

func (*Ref) Export

func (pr *Ref) Export(ctx context.Context) ([]byte, error)

func (*Ref) GitRepoConfig

func (pr *Ref) GitRepoConfig(ctx context.Context, regenerate bool) (flux.GitConfig, error)

func (*Ref) JobStatus

func (pr *Ref) JobStatus(ctx context.Context, id job.ID) (job.Status, error)

func (*Ref) ListImages

func (pr *Ref) ListImages(ctx context.Context, spec update.ResourceSpec) ([]flux.ImageStatus, error)

func (*Ref) ListServices

func (pr *Ref) ListServices(ctx context.Context, namespace string) ([]flux.ControllerStatus, error)

func (*Ref) NotifyChange

func (pr *Ref) NotifyChange(ctx context.Context, change remote.Change) error

func (*Ref) Ping

func (pr *Ref) Ping(ctx context.Context) error

func (*Ref) Platform

func (pr *Ref) Platform() remote.Platform

func (*Ref) SyncStatus

func (pr *Ref) SyncStatus(ctx context.Context, ref string) ([]string, error)

func (*Ref) UpdateManifests

func (pr *Ref) UpdateManifests(ctx context.Context, spec update.Spec) (job.ID, error)

func (*Ref) UpdatePlatform

func (pr *Ref) UpdatePlatform(platform remote.Platform)

func (*Ref) Version

func (pr *Ref) Version(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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