achim

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

README

achim

Advanced Cloud Hyperscaling Infrastructure Manager (reimplementation in Go) using the urfave/cli and Egoscale libraries.

Status

This Go implementation is a port from the Python implementation

  • command structure (and existing achim command, if different)
    • tenant
      • add ([new])
      • default ([new])
      • remove ([new])
    • instance
      • create (create-instance)
      • deprotect
      • destroy
      • inventory (export-inventory)
      • label (label-all-instances)
      • list (list-instances)
      • overview (export-group-overview)
      • probe
      • protect
      • resize embiggen (resize-disk)
      • scale (scale-instance)
      • start
      • stop
      • type (list-instance-types)
    • group
      • create (create-group)
      • file-from-text
      • playbook (export-user-playbook)
    • dns
      • flush
      • sync (sync-dns)
    • network
      • attach
      • create (create-network)
      • cleanup (cleanup-network)
      • flush (flush-networks)
      • list (list-network)
      • destroy (destroy-network)
    • scenario
      • create (create-scenario)
        • TODO: network labels (if needed)
        • TODO: cloud init data (if needed)
      • export-overview (export-scenario-overview)
    • image
      • list (list-images)

Documentation

Index

Constants

View Source
const (
	MinDiskSizeGB = 10
	MaxDiskSizeGB = 250
)
View Source
const ConfigFilePerm = 0600

Variables

This section is empty.

Functions

func AddTenant

func AddTenant(tenant Tenant, path string) error

func Attach added in v0.0.4

func Attach(ctx context.Context, network, instance, ip string) error

func CleanupNetworks added in v0.0.4

func CleanupNetworks(ctx context.Context) error

func CreateGroup added in v0.0.2

func CreateGroup(ctx context.Context, params NewGroupParams) error

func CreateInstance

func CreateInstance(ctx context.Context, params NewInstanceParams) error

func CreateNetwork added in v0.0.4

func CreateNetwork(ctx context.Context, network NewNetworkParams) error

func CreateScenario added in v0.0.6

func CreateScenario(ctx context.Context, params NewScenarioParams) error

func DeleteNetworks added in v0.0.4

func DeleteNetworks(ctx context.Context, predicate NetworkPredicate) ([]v3.PrivateNetwork, error)

func DeprotectInstances

func DeprotectInstances(ctx context.Context, by string) error

func DestroyInstances

func DestroyInstances(ctx context.Context, by string) error

func DestroyNetworks added in v0.0.4

func DestroyNetworks(ctx context.Context, by string) error

func EmbiggenDisk

func EmbiggenDisk(ctx context.Context, by string, gb int64) error

func ExportInstanceOverview added in v0.1.0

func ExportInstanceOverview(ctx context.Context, by, file string) error

func ExportInventory added in v0.0.3

func ExportInventory(ctx context.Context, file, by string) error

func ExportPlaybook added in v0.0.3

func ExportPlaybook(ctx context.Context, groupfile, playbookPath string) error

func ExportScenarioOverview added in v0.1.0

func ExportScenarioOverview(ctx context.Context, scenario, by, file string, hidePassword bool) error

func FlushNetworks added in v0.0.4

func FlushNetworks(ctx context.Context) error

func FlushRecords added in v0.0.3

func FlushRecords(ctx context.Context, domain string) error

func FormatInstance

func FormatInstance(instance v3.Instance) string

func GetAllowedSizes added in v0.0.6

func GetAllowedSizes(ctx context.Context) (map[string]*v3.InstanceType, error)

func GetInstanceTypeBySize

func GetInstanceTypeBySize(ctx context.Context, size string) (*v3.InstanceType, error)

func GetNetworks added in v0.0.4

func GetNetworks(ctx context.Context, by string) ([]v3.PrivateNetwork, error)

func GetSSHKeyByName

func GetSSHKeyByName(ctx context.Context, name string) (*v3.SSHKey, error)

func GetTemplateByName

func GetTemplateByName(ctx context.Context, name string) (*v3.Template, error)

func GroupFileFromText added in v0.0.2

func GroupFileFromText(inputPath, outputPath string) error

func LabelInstances

func LabelInstances(ctx context.Context, label, value, by string) error

func ListImages

func ListImages(ctx context.Context, contains string) ([]string, error)

func ListInstanceTypes

func ListInstanceTypes(ctx context.Context, family string) ([]v3.InstanceType, error)

func ListInstances

func ListInstances(ctx context.Context, by string) ([]v3.Instance, error)

func ListNetworks added in v0.0.4

func ListNetworks(ctx context.Context, by string) error

func ParseYAMLFile added in v0.0.6

func ParseYAMLFile[T any](path string) (*T, error)

func ProbeInstances

func ProbeInstances(ctx context.Context, by, suffix, domain string, secure bool) error

func ProtectInstances

func ProtectInstances(ctx context.Context, by string) error

func RemoveTenant

func RemoveTenant(name, path string) error

func ScaleInstances

func ScaleInstances(ctx context.Context, by string, size string) error

func SetDefaultTenant

func SetDefaultTenant(name, path string) error

func StartInstances

func StartInstances(ctx context.Context, by string) error

func StopInstances

func StopInstances(ctx context.Context, by string) error

func SyncRecords added in v0.0.3

func SyncRecords(ctx context.Context, domain string) error

Types

type DNSEntry added in v0.0.3

type DNSEntry struct {
	Name    string
	Content string
}

type Group added in v0.0.2

type Group struct {
	Name  string `yaml:"name"`
	Users []User `yaml:"users"`
}

func ParseGroupFile added in v0.0.2

func ParseGroupFile(yamlPath string) (*Group, error)

type InstanceCreationCache added in v0.0.6

type InstanceCreationCache struct {
	TemplatesByImageName map[string]*v3.Template
	InstanceTypesBySize  map[string]*v3.InstanceType
}

type InstanceGroup added in v0.0.2

type InstanceGroup struct {
	Names         []string
	Key           *v3.SSHKey
	Autostart     bool
	Template      *v3.Template
	InstanceType  *v3.InstanceType
	DiskSizeGB    int64
	Labels        []labels.Label
	CloudInitData map[string]string
}

func (*InstanceGroup) Create added in v0.0.2

func (p *InstanceGroup) Create(ctx context.Context) error

type NetworkIPConfig added in v0.0.4

type NetworkIPConfig struct {
	StartIP net.IP
	EndIP   net.IP
	Netmask net.IP
}

type NetworkPredicate added in v0.0.4

type NetworkPredicate func(network v3.PrivateNetwork) bool

type NewGroupParams added in v0.0.2

type NewGroupParams struct {
	GroupFile string
	Key       string
	Autostart bool
	Image     string
	Size      string
	Labels    string
	CloudInit string
}

type NewInstanceGroupParam added in v0.0.3

type NewInstanceGroupParam struct {
	Names     map[string]User
	Key       string
	Autostart bool
	Image     string
	Size      string
	Labels    string
	CloudInit string
}

func (*NewInstanceGroupParam) Compile added in v0.0.3

type NewInstanceParams

type NewInstanceParams struct {
	Name      string
	Key       string
	Autostart bool
	Image     string
	Size      string
	Labels    string
	CloudInit string
}

type NewNetworkParams added in v0.0.4

type NewNetworkParams struct {
	Name        string
	Description string
	Labels      string
	StartIP     string
	EndIP       string
	Netmask     string
}

func (*NewNetworkParams) ParseIPs added in v0.0.4

func (n *NewNetworkParams) ParseIPs() (*NetworkIPConfig, error)

type NewScenarioParams added in v0.0.6

type NewScenarioParams struct {
	ScenarioFile string
	GroupFile    string
	KeyName      string
	Autostart    bool
	Labels       string
}

type Play added in v0.0.3

type Play struct {
	Become bool   `yaml:"become"`
	Hosts  string `yaml:"hosts"`
	Name   string `yaml:"name"`
	Tasks  []Task `yaml:"tasks"`
}

type Scenario added in v0.0.6

type Scenario struct {
	Name      string             `yaml:"name"`
	Instances []ScenarioInstance `yaml:"instances"`
	Networks  []ScenarioNetwork  `yaml:"networks"`
}

func ParseScenarioFile added in v0.0.6

func ParseScenarioFile(path string) (*Scenario, error)

func (*Scenario) CompileFor added in v0.0.6

func (s *Scenario) CompileFor(ctx context.Context, g *Group) *ScenarioSetup

func (*Scenario) ValidateExternally added in v0.0.6

func (s *Scenario) ValidateExternally(ctx context.Context) (*InstanceCreationCache, error)

ValidateExternally validates all the image and size definitions in the instances section.

func (*Scenario) ValidateInternally added in v0.0.6

func (s *Scenario) ValidateInternally() error

ValidateInternally validates all the IP addresses in the network section and whether or not the connections defined refer existing instances.

type ScenarioInstance added in v0.0.6

type ScenarioInstance struct {
	Name       string `yaml:"name"`
	Image      string `yaml:"image"`
	Size       string `yaml:"size"`
	DiskSizeGB int64  `yaml:"disk-gb"`
}

type ScenarioNetwork added in v0.0.6

type ScenarioNetwork struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	StartIP     string `yaml:"start-ip"`
	EndIP       string `yaml:"end-ip"`
	Netmask     string `yaml:"netmask"`
	Connects    []ScenarioNetworkConnection
}

type ScenarioNetworkConnection added in v0.0.6

type ScenarioNetworkConnection struct {
	Instance string `yaml:"instance"`
	IP       string `yaml:"ip"`
}

type ScenarioSetup added in v0.0.6

type ScenarioSetup struct {
	Instances      map[string]ScenarioInstance
	InstanceOwners map[string]string
	Networks       map[string]ScenarioNetwork
	NetworkOwners  map[string]string
	Attachments    map[string]map[string]net.IP
}

type Task added in v0.0.3

type Task struct {
	Name          string            `yaml:"name"`
	User          TaskUser          `yaml:"user,omitempty"`
	AuthorizedKey TaskAuthorizedKey `yaml:"authorized_key,omitempty"`
}

type TaskAuthorizedKey added in v0.0.3

type TaskAuthorizedKey struct {
	Key  string `yaml:"key"`
	User string `yaml:"user"`
}

type TaskUser added in v0.0.3

type TaskUser struct {
	Append     bool     `yaml:"append"`
	CreateHome bool     `yaml:"create_home"`
	Groups     []string `yaml:"groups"`
	Home       string   `yaml:"home"`
	Name       string   `yaml:"name"`
	Password   string   `yaml:"password"`
	Shell      string   `yaml:"shell"`
}

type Tenant

type Tenant struct {
	Name   string `json:"name"`
	Key    string `json:"key"`
	Secret string `json:"secret"`
	Zone   string `json:"zone"`
}

func GetDefaultTenant

func GetDefaultTenant(path string) (*Tenant, error)

func GetTenant

func GetTenant(name, path string) (*Tenant, error)

func (Tenant) Client

func (t Tenant) Client() (*v3.Client, error)

func (Tenant) IsNonEmpty

func (t Tenant) IsNonEmpty() bool

type TenantFile

type TenantFile struct {
	Default string            `json:"default"`
	Tenants map[string]Tenant `json:"tenants"`
}

func ReadTenants

func ReadTenants(path string) (*TenantFile, error)

type User added in v0.0.2

type User struct {
	Email  string `yaml:"email"`
	Name   string `yaml:"name"`
	SSHKey string `yaml:"ssh-key"`
}

Directories

Path Synopsis
cmd
achim command

Jump to

Keyboard shortcuts

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