config

package
v0.0.0-...-47d8c88 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = "cloud-burster.squarefactory.io/v1alpha1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloud

type Cloud struct {
	AuthorizedKeys []string        `yaml:"authorizedKeys"`
	PostScripts    PostScriptsOpts `yaml:"postScripts,omitempty"  validate:"omitempty"`
	Type           string          `yaml:"type"                   validate:"required"`
	*Network       `yaml:"network,omitempty"`
	GroupsHost     []GroupHost            `yaml:"groupsHost,omitempty"   validate:"omitempty,dive"`
	Hosts          []Host                 `yaml:"hosts,omitempty"        validate:"omitempty,dive"`
	CustomConfig   map[string]interface{} `yaml:"customConfig,omitempty" validate:"omitempty"`
	*Openstack     `yaml:"openstack,omitempty" validate:"required_if=Type openstack,excluded_unless=Type openstack"`
	*Exoscale      `yaml:"exoscale,omitempty" validate:"required_if=Type exoscale,excluded_unless=Type exoscale"`
	*Shadow        `yaml:"shadow,omitempty" validate:"required_if=Type shadow,excluded_unless=Type shadow"`
}

func (*Cloud) Validate

func (c *Cloud) Validate() error

type Config

type Config struct {
	APIVersion   string   `yaml:"apiVersion"   validate:"equalAPI"`
	Clouds       []Cloud  `yaml:"clouds"       validate:"dive"`
	SuffixSearch []string `yaml:"suffixSearch"`
}

func ParseFile

func ParseFile(filePath string) (*Config, error)

func (*Config) GenerateHosts

func (c *Config) GenerateHosts() (string, error)

GenerateHosts generates hosts for the DNS server

func (*Config) SearchHostByHostName

func (c *Config) SearchHostByHostName(hostname string) (*Host, *Cloud, error)

func (*Config) Validate

func (c *Config) Validate() error

type Exoscale

type Exoscale struct {
	ComputeEndpoint string `yaml:"computeEndpoint" validate:"omitempty,url"`
	APIKey          string `yaml:"apiKey"`
	APISecret       string `yaml:"apiSecret"`
	Zone            string `yaml:"zone"`
}

func (*Exoscale) Validate

func (c *Exoscale) Validate() error

type GitOpts

type GitOpts struct {
	Key string `yaml:"key,omitempty" validate:"omitempty"`
	URL string `yaml:"url,omitempty" validate:"omitempty"`
	Ref string `yaml:"ref,omitempty" validate:"omitempty"`
}

type GroupHost

type GroupHost struct {
	// NamePattern overrides the host name
	NamePattern string `yaml:"namePattern" validate:"required"`
	// IPCidr overrides the IP. Based on NamePattern, each host will have an IP allocated.
	IPCidr string `yaml:"ipCIDR"      validate:"required,cidr"`
	// IPOffset offsets the selection of IP.
	IPOffset int `yaml:"ipOffset"    validate:"omitempty"`
	// HostTemplate defines helps to define a Host
	HostTemplate Host `yaml:"template"`
}

func (*GroupHost) GenerateHosts

func (g *GroupHost) GenerateHosts() ([]Host, error)

func (*GroupHost) Validate

func (g *GroupHost) Validate() error

type Host

type Host struct {
	Name       string `yaml:"name,omitempty" validate:"omitempty"`
	DiskSize   int    `yaml:"diskSize"       validate:"required"`
	RAM        int    `yaml:"ram,omitempty" validate:"omitempty"`
	GPU        int    `yaml:"gpu,omitempty" validate:"omitempty"`
	FlavorName string `yaml:"flavorName"     validate:"required"`
	ImageName  string `yaml:"imageName"      validate:"required"`
	IP         string `yaml:"ip,omitempty"   validate:"omitempty,ip"`
}

func (*Host) Validate

func (c *Host) Validate() error

type Network

type Network struct {
	Name       string `yaml:"name"             validate:"required"`
	SubnetCIDR string `yaml:"subnetCIDR"       validate:"required,cidr"`
	DNS        string `yaml:"dns"              validate:"required,ip"`
	Search     string `yaml:"search,omitempty" validate:"omitempty"`
	Gateway    string `yaml:"gateway"          validate:"required,ip"`
}

func (*Network) Validate

func (c *Network) Validate() error

type Openstack

type Openstack struct {
	IdentityEndpoint string `yaml:"identityEndpoint" validate:"omitempty,url"`
	UserName         string `yaml:"username"`
	Password         string `yaml:"password"`
	TenantID         string `yaml:"tenantID"`
	TenantName       string `yaml:"tenantName"`
	DomainID         string `yaml:"domainID"`
	Region           string `yaml:"region"`
}

func (*Openstack) Validate

func (c *Openstack) Validate() error

type PostScriptsOpts

type PostScriptsOpts struct {
	Git GitOpts `yaml:"git,omitempty" validate:"omitempty"`
}

type Shadow

type Shadow struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Zone     string `yaml:"zone"`
	SSHKey   string `yaml:"sshKey"`
}

func (*Shadow) Validate

func (c *Shadow) Validate() error

Jump to

Keyboard shortcuts

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