Documentation
¶
Overview ¶
Package fleet finds the fleet repo and loads one environment from it.
Index ¶
- func Available(root string) string
- func Environments(root string) ([]string, error)
- func FindRoot(cwd string, getenv func(string) string) (string, error)
- func Init(root, name string) ([]string, error)
- func InitRoot(cwd string, getenv func(string) string) (string, error)
- type Difference
- type Env
- type EnvDiff
- type Secrets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Environments ¶
Environments returns the environment name under the root, sorted.
func FindRoot ¶
FindRoot returns the fleet root: $TOPS_ROOT if set, else the nearest directory from cwd upwards that contains environments.
func Init ¶
Init creates environment name under root: its cluster.yaml, overrides.yaml and secrets.env, and any base/ file that is missing. It never overwrites a file, and returns what it created, relative to root.
Types ¶
type Difference ¶
Difference is one path whose value differs. A nil From or To is a path the environment does not have: a namespace it does not keep, a key its overrides do not set.
type Env ¶
type Env struct {
Name string
Root string // the fleet root
Dir string // the environment directory under the fleet root
File string // cluster.yaml, relative to the fleet root, for messages
Cluster *spec.Cluster
}
Env is one environment loaded from the fleet root.
func Load ¶
Load reads environments/<name>/cluster.yaml under root, applies the defaults and resolves ssh.key and ssh.knownHosts against the environment directory.
func (*Env) Catalog ¶
Catalog is the settings catalog of the spec's Temporal minor: 1.31 for 1.31.3.
func (*Env) ReadSecrets ¶
ReadSecrets reads secrets.env next to cluster.yaml: it must be a regular file with mode 0600 owned by the current user, parse, and set every key the spec needs.
func (*Env) SecretsNotIgnored ¶
SecretsNotIgnored returns a warning when git would commit the environment's secrets.env: the fleet repo's .gitignore must cover it. Outside a git repository, or without git, there is nothing to check. git check-ignore exits 1 for a path that is not ignored or is already tracked, so a secret committed once still warns.
type EnvDiff ¶
type EnvDiff struct {
Promotable []Difference `json:"promotable"`
ByDesign []Difference `json:"byDesign"`
}
EnvDiff is what differs between two environments, by group (TRD "Diff and promote"). Promotable differences are what tops promote would write; by-design ones are each environment's own, such as its cluster name and nodes.