Documentation
¶
Overview ¶
Package gce implements core.HostProvider on Google Compute Engine by driving the gcloud CLI through setup.Gcloud. One VM per project is named provr-<project>-1, which is also its tailnet hostname and core.Host.ID.
Index ¶
- Constants
- Variables
- type Options
- type Provider
- func (p *Provider) Delete(ctx context.Context, hostID string) error
- func (p *Provider) Ensure(ctx context.Context, spec core.HostSpec) (core.Host, error)
- func (p *Provider) HostName(project string) string
- func (p *Provider) List(ctx context.Context, project string) ([]core.Host, error)
- func (p *Provider) Stop(ctx context.Context, hostID string) error
- type Tailnet
Constants ¶
const ( // FirstBootTimeout bounds the wait after creating a host. FirstBootTimeout = 5 * time.Minute // StartTimeout bounds the wait after starting a stopped host. StartTimeout = 2 * time.Minute )
Ready-wait budgets.
Variables ¶
var ErrNotReady = errors.New("host not ready")
ErrNotReady is returned when a host does not become ready in time.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// GCPProject is the GCP project id that hosts the VMs. Required.
GCPProject string
// Project is the provr project name. Required.
Project string
// Runner executes gcloud. Required.
Runner execx.Runner
// Impersonate is the service account to impersonate; defaults to
// setup.OperatorEmail(GCPProject) when empty.
Impersonate string
// SSHBinary is the ssh executable; defaults to "ssh".
SSHBinary string
// Tailnet manages auth keys and devices. Required.
Tailnet Tailnet
// Tag is the ACL tag given to joined hosts; defaults to
// setup.TailscaleTag.
Tag string
// TempDir holds the short-lived auth key file; defaults to os.TempDir().
TempDir string
// LockDir holds the per-project lock files; defaults to ~/.provr/locks.
LockDir string
}
Options configures a Provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a GCE-backed host provider.
func (*Provider) Delete ¶
Delete removes the host, its boot disk and its tailnet devices. A missing host is not an error.
func (*Provider) Ensure ¶
Ensure returns the project's running host with room for another preview, starting a stopped host or creating a missing one. It holds the project lock for the whole call so concurrent callers create only one host.
func (*Provider) HostName ¶
HostName returns the instance name and tailnet hostname of the project's host: provr-<project>-1.
type Tailnet ¶
type Tailnet interface {
CreateKey(ctx context.Context, spec api.KeySpec) (api.Key, error)
RevokeKey(ctx context.Context, id string) error
ListDevices(ctx context.Context) ([]api.Device, error)
DeleteDevice(ctx context.Context, id string) error
}
Tailnet is the subset of the Tailscale API the join flow uses. It is satisfied by *api.Client.