Documentation ¶
Index ¶
- func HostPortIsLocal(hostport string) bool
- type AmbassadorWatcher
- func (w *AmbassadorWatcher) FetchEnvoyReady(ctx context.Context)
- func (w *AmbassadorWatcher) IsAlive() bool
- func (w *AmbassadorWatcher) IsReady() bool
- func (w *AmbassadorWatcher) NoteSnapshotProcessed()
- func (w *AmbassadorWatcher) NoteSnapshotSent()
- func (w *AmbassadorWatcher) SetFetchTime(fetchTime timeFetcher)
- type DiagdWatcher
- type EnvoyFetcherResponse
- type EnvoyWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostPortIsLocal ¶
HostPortIsLocal returns true IFF the host:port string from a URL refers to the local host. The comparison is simple: if it's "localhost" or "127.0.0.1" or "::1", it refers to the local host.
Note that HostPortIsLocal _requires_ the ":port" part, because net.SplitHostPort requires it, and because the whole point here is that IPv6 is a pain. Sigh.
Types ¶
type AmbassadorWatcher ¶
type AmbassadorWatcher struct { // At the point that the DiagdWatcher finishes processing the very first // snapshot, we have to hand the snapshot to Envoy and allow Envoy to start // up. This takes finite time, so we have to allow for that. GraceEnd time.Time // contains filtered or unexported fields }
AmbassadorWatcher encapsulates state and methods for keeping an eye on a running Ambassador, and deciding if it's healthy.
func NewAmbassadorWatcher ¶
func NewAmbassadorWatcher(ew *EnvoyWatcher, dw *DiagdWatcher) *AmbassadorWatcher
NewAmbassadorWatcher creates a new AmbassadorWatcher, given a fetcher.
Honestly, this is slightly pointless -- it's here for parallelism with the EnvoyWatcher and the DiagdWatcher.
func (*AmbassadorWatcher) FetchEnvoyReady ¶
func (w *AmbassadorWatcher) FetchEnvoyReady(ctx context.Context)
FetchEnvoyReady will check whether Envoy's statistics are fetchable.
func (*AmbassadorWatcher) IsAlive ¶
func (w *AmbassadorWatcher) IsAlive() bool
IsAlive returns true IFF the Ambassador as a whole can be considered alive.
func (*AmbassadorWatcher) IsReady ¶
func (w *AmbassadorWatcher) IsReady() bool
IsReady returns true IFF the Ambassador as a whole can be considered ready.
func (*AmbassadorWatcher) NoteSnapshotProcessed ¶
func (w *AmbassadorWatcher) NoteSnapshotProcessed()
NoteSnapshotProcessed will note that a snapshot has been processed.
func (*AmbassadorWatcher) NoteSnapshotSent ¶
func (w *AmbassadorWatcher) NoteSnapshotSent()
NoteSnapshotSent will note that a snapshot has been sent.
func (*AmbassadorWatcher) SetFetchTime ¶
func (w *AmbassadorWatcher) SetFetchTime(fetchTime timeFetcher)
SetFetchTime will change the function we use to get the current time.
type DiagdWatcher ¶
type DiagdWatcher struct { // When did we last send a snapshot to diagd? LastSent time.Time // When did we last hear that diagd had processed a snapshot? LastProcessed time.Time // When does our grace period end? The grace period is ten minutes after // the most recent event (boot, or the last time a snapshot was sent). GraceEnd time.Time // contains filtered or unexported fields }
DiagdWatcher encapsulates state and methods for keeping an eye on a running diagd, and deciding if it's healthy.
func NewDiagdWatcher ¶
func NewDiagdWatcher() *DiagdWatcher
NewDiagdWatcher creates a new DiagdWatcher.
func (*DiagdWatcher) IsAlive ¶
func (w *DiagdWatcher) IsAlive() bool
IsAlive returns true IFF diagd should be considered alive.
func (*DiagdWatcher) IsReady ¶
func (w *DiagdWatcher) IsReady() bool
IsReady returns true IFF diagd should be considered ready.
func (*DiagdWatcher) NoteSnapshotProcessed ¶
func (w *DiagdWatcher) NoteSnapshotProcessed()
NoteSnapshotProcessed marks the time at which we have processed a snapshot.
func (*DiagdWatcher) NoteSnapshotSent ¶
func (w *DiagdWatcher) NoteSnapshotSent()
NoteSnapshotSent marks the time at which we have sent a snapshot.
func (*DiagdWatcher) SetFetchTime ¶
func (w *DiagdWatcher) SetFetchTime(fetchTime timeFetcher)
SetFetchTime will change the function we use to get the current time _AND RESETS THE BOOT GRACE PERIOD_. This is here for testing, _NOT_ to allow switching timers on the fly for some crazy reason.
type EnvoyFetcherResponse ¶
EnvoyFetcherResponse is a simple response struct for an envoyFetcher.
XXX I'm a little torn about this -- should we just return a net/http Response? That looks like it's not necessarily easy to synthesize, though, so let's just keep it simple.
type EnvoyWatcher ¶
type EnvoyWatcher struct { // Did the last ready check succeed? LastSucceeded bool // contains filtered or unexported fields }
EnvoyWatcher encapsulates state and methods for keeping an eye on a running Envoy, and deciding if it's healthy.
func NewEnvoyWatcher ¶
func NewEnvoyWatcher() *EnvoyWatcher
NewEnvoyWatcher creates a new EnvoyWatcher, given a fetcher.
func (*EnvoyWatcher) FetchEnvoyReady ¶
func (w *EnvoyWatcher) FetchEnvoyReady(ctx context.Context)
FetchEnvoyReady will check whether Envoy's ready endpoint is fetchable.
func (*EnvoyWatcher) IsAlive ¶
func (w *EnvoyWatcher) IsAlive() bool
IsAlive returns true IFF Envoy should be considered alive.
func (*EnvoyWatcher) IsReady ¶
func (w *EnvoyWatcher) IsReady() bool
IsReady returns true IFF Envoy should be considered ready. Currently Envoy is considered ready whenever it's alive; this method is here for future-proofing.
func (*EnvoyWatcher) SetReadyCheck ¶
func (w *EnvoyWatcher) SetReadyCheck(readyCheck envoyFetcher)
SetReadyCheck will change the function we use to get check if Envoy is ready. This is here for testing; the assumption is that you'll call it at instantiation if you need to, then leave it alone.