envoy

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CurrentVersionWorkingDirFile is used for stable "versions" and "help" output
	CurrentVersionWorkingDirFile = filepath.Join("$PWD", ".envoy-version")
	// CurrentVersionHomeDirFile is used for stable "versions" and "help" output
	CurrentVersionHomeDirFile = filepath.Join("$FUNC_E_HOME", "version")
)

Functions

func CurrentVersion

func CurrentVersion(homeDir string) (v version.Version, source string, err error)

CurrentVersion returns the first version in priority of VersionUsageList and its source or an error. The "source" and error messages returned include unexpanded variables to clarify the intended context.

func FuncEVersions

func FuncEVersions(ctx context.Context, envoyVersionsURL string, p version.Platform, v version.Version) (version.ReleaseVersions, error)

FuncEVersions returns a version map from a remote URL. eg globals.DefaultEnvoyVersionsURL.

func GetHomeVersion

func GetHomeVersion(homeDir string) (v version.Version, homeVersionFile string, err error)

GetHomeVersion returns the default version in the "homeDir" and path to to it (homeVersionFile). When "v" is empty, homeVersionFile is not yet initialized.

func InstallIfNeeded

func InstallIfNeeded(ctx context.Context, o *globals.GlobalOpts, v version.Version) (string, error)

InstallIfNeeded downloads an Envoy binary corresponding to the given version and returns a path to it or an error.

func VersionUsageList

func VersionUsageList() string

VersionUsageList is the priority order of Envoy version sources. This includes unresolved variables as it is both used statically for markdown generation, and also at runtime.

func WriteCurrentVersion

func WriteCurrentVersion(v version.Version, homeDir string) error

WriteCurrentVersion writes the version to CurrentVersionWorkingDirFile or CurrentVersionHomeDirFile depending on if the former is present.

Types

type Runtime

type Runtime struct {
	Out io.Writer
	Err io.Writer

	// FakeInterrupt is exposed for unit tests to pretend "func-e run" received a Ctrl+C or Ctrl+Break.
	// End-to-end tests should kill the func-e process to achieve the same.
	FakeInterrupt context.CancelFunc
	// contains filtered or unexported fields
}

Runtime manages an Envoy lifecycle

func NewRuntime

func NewRuntime(opts *globals.RunOpts) *Runtime

NewRuntime creates a new Runtime that runs envoy in globals.RunOpts RunDir opts allows a user running envoy to control the working directory by ID or path, allowing explicit cleanup.

func (*Runtime) GetAdminAddress

func (r *Runtime) GetAdminAddress() (string, error)

GetAdminAddress returns the current admin address in host:port format, or empty if not yet available. Exported for shutdown.enableEnvoyAdminDataCollection, which is always on due to shutdown.EnableHooks.

func (*Runtime) GetRunDir

func (r *Runtime) GetRunDir() string

GetRunDir returns the run-specific directory files can be written to.

func (*Runtime) RegisterShutdownHook

func (r *Runtime) RegisterShutdownHook(f func(context.Context) error)

RegisterShutdownHook registers the passed functions to be run after Envoy has started and just before func-e instructs Envoy to exit

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context, args []string) (err error)

Run execs the binary at the path with the args passed. It is a blocking function that can be shutdown via SIGINT.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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