cloud

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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 cloud creates and deletes servers through cloud provider APIs for provider-backed node pools (§6.5). Each provider implements Provider; servers carry a pool label so they can be listed back.

Index

Constants

This section is empty.

Variables

View Source
var Types = []string{"hetzner", "digitalocean", "webhook"}

Types lists the supported providers.

Functions

This section is empty.

Types

type Config

type Config struct {
	Token string `json:"token,omitempty"` // hetzner, digitalocean, webhook (optional bearer)
	URL   string `json:"url,omitempty"`   // webhook; base URL override for the others (tests)
}

Config holds every provider type's settings; only the type's are used. Tokens and URLs are secrets (sealed at rest).

func (Config) Validate

func (c Config) Validate(typ string) (string, error)

Validate checks a configuration and returns a summary safe to show.

type Provider

type Provider interface {
	CreateServer(ctx context.Context, s ServerSpec) (Server, error)
	DeleteServer(ctx context.Context, id string) error
	// ListServers lists servers carrying a label.
	ListServers(ctx context.Context, labelKey, labelValue string) ([]Server, error)
}

Provider is a cloud API.

func New

func New(typ string, c Config) (Provider, error)

New returns a provider client.

type Server

type Server struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
	IP     string `json:"ip"`
}

Server is a provider's server.

type ServerSpec

type ServerSpec struct {
	Name     string            `json:"name"`
	Region   string            `json:"region"`
	Type     string            `json:"type"`  // instance type / size
	Image    string            `json:"image"` // OS image
	SSHKeys  []string          `json:"sshKeys,omitempty"`
	UserData string            `json:"userData"` // cloud-init: joins the cluster
	Labels   map[string]string `json:"labels"`
}

ServerSpec describes a server to create.

Jump to

Keyboard shortcuts

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