agent

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent runs gcpemu helper processes inside containers the emulator launches (GKE node metadata proxy, Cloud SQL server-side proxy). The emulator copies its own static binary into the container and starts it with GCPEMU_AGENT=<name>; Main dispatches to the registered agent.

Index

Constants

View Source
const BinaryEnv = "GCPEMU_AGENT_BINARY"

BinaryEnv overrides the binary copied into containers (tests set it to a CGO_ENABLED=0 build of ./cmd/gcpemu).

View Source
const ContainerPath = "/gcpemu/gcpemu"

ContainerPath is where the binary is placed inside containers.

View Source
const EnvVar = "GCPEMU_AGENT"

EnvVar selects the agent to run.

Variables

This section is empty.

Functions

func Binary

func Binary() (string, error)

Binary returns the path of a static linux binary of gcpemu for the host architecture, suitable for copying into containers.

func BuildForTests

func BuildForTests(moduleRoot, dir string) (string, error)

BuildForTests compiles ./cmd/gcpemu with CGO_ENABLED=0 into dir (once per process) and sets GCPEMU_AGENT_BINARY. moduleRoot is the repository root.

func Main

func Main()

Main runs the selected agent and exits if GCPEMU_AGENT is set; otherwise it returns immediately. Call it first thing in main (and in TestMain of packages whose tests start agents in-process).

func Register

func Register(name string, f Func)

Register installs an agent; call it from an init function.

Types

type Func

type Func func(ctx context.Context, args []string) error

Func is an agent entry point. It runs until ctx is cancelled (SIGTERM).

Jump to

Keyboard shortcuts

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