manifest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const APIServerPort = 6443

APIServerPort is the port on which the ApiServer listens.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWS

type AWS struct {
	Name      string `validate:"required" yaml:"name"`
	AccessKey string `validate:"required,alphanum,len=20" yaml:"access_key"`
	SecretKey string `validate:"required,len=40" yaml:"secret_key"`
}

func (*AWS) Validate

func (c *AWS) Validate() error

type Azure

type Azure struct {
	Name           string `validate:"required" yaml:"name"`
	SubscriptionId string `validate:"required" yaml:"subscription_id"`
	TenantId       string `validate:"required" yaml:"tenant_id"`
	ClientId       string `validate:"required" yaml:"client_id"`
	ClientSecret   string `validate:"required" yaml:"client_secret"`
}

func (*Azure) Validate

func (c *Azure) Validate() error

type Cloudflare added in v0.1.1

type Cloudflare struct {
	Name     string `validate:"required" yaml:"name"`
	ApiToken string `validate:"required" yaml:"api_token"`
}

func (*Cloudflare) Validate added in v0.1.1

func (c *Cloudflare) Validate() error

type Cluster

type Cluster struct {
	Name    string `validate:"required" yaml:"name"`
	Version string `validate:"required,ver" yaml:"version"`
	Network string `validate:"required,cidrv4" yaml:"network"`
	Pools   Pool   `validate:"dive" yaml:"pools"`
}

func (*Cluster) Validate

func (c *Cluster) Validate() error

type DNS

type DNS struct {
	DNSZone  string `validate:"required" yaml:"dns_zone"`
	Provider string `validate:"required" yaml:"provider"`
	Hostname string `yaml:"hostname,omitempty"`
}

type DynamicNodePool

type DynamicNodePool struct {
	Name         string       `validate:"required" yaml:"name"`
	ProviderSpec ProviderSpec `validate:"required" yaml:"providerSpec"`
	Count        int64        `yaml:"count"`
	ServerType   string       `validate:"required" yaml:"server_type"`
	Image        string       `validate:"required" yaml:"image"`
	DiskSize     int64        `validate:"required" yaml:"disk_size"`
}

func (*DynamicNodePool) Validate

func (d *DynamicNodePool) Validate() error

type GCP

type GCP struct {
	Name string `validate:"required" yaml:"name"`
	// We can only validate that the supplied string is a
	// valid formatted JSON.
	Credentials string `validate:"required,json" yaml:"credentials"`
	GCPProject  string `validate:"required" yaml:"gcp_project"`
}

func (*GCP) Validate

func (c *GCP) Validate() error

type Hetzner

type Hetzner struct {
	Name string `validate:"required" yaml:"name"`

	// We can only validate the length of the token
	// as Hetzner doesn't specify the structure of the token,
	// only that it's a hash. We can also validate that the characters
	// are alphanumeric (i.e. excluding characters like !#@$%^&*...)
	// https://docs.hetzner.com/cloud/technical-details/faq#how-are-api-tokens-stored
	Credentials string `validate:"required,alphanum,len=64" yaml:"credentials"`
}

func (*Hetzner) Validate

func (c *Hetzner) Validate() error

type HetznerDNS added in v0.1.1

type HetznerDNS struct {
	Name     string `validate:"required" yaml:"name"`
	ApiToken string `validate:"required" yaml:"api_token"`
}

func (*HetznerDNS) Validate added in v0.1.1

func (c *HetznerDNS) Validate() error

type Kubernetes

type Kubernetes struct {
	Clusters []Cluster `yaml:"clusters"`
}

func (*Kubernetes) Validate

func (k *Kubernetes) Validate(m *Manifest) error

Validate validates the parsed data inside the Kubernetes section of the manifest. It checks for missing/invalid filled out values defined in the Kubernetes section of the manifest.

type LoadBalancer

type LoadBalancer struct {
	Roles    []Role                `yaml:"roles"`
	Clusters []LoadBalancerCluster `yaml:"clusters"`
}

func (*LoadBalancer) Validate

func (l *LoadBalancer) Validate(m *Manifest) error

Validate validates the parsed data inside the LoadBalancer section of the manifest. It checks for missing/invalid filled out values defined in the LoadBalancer section of the manifest.

type LoadBalancerCluster

type LoadBalancerCluster struct {
	Name        string   `validate:"required" yaml:"name"`
	Roles       []string `yaml:"roles"`
	DNS         DNS      `validate:"required" yaml:"dns,omitempty"`
	TargetedK8s string   `validate:"required" yaml:"targeted-k8s"`
	Pools       []string `yaml:"pools"`
}

func (*LoadBalancerCluster) Validate

func (c *LoadBalancerCluster) Validate() error

type Manifest

type Manifest struct {
	Name         string       `validate:"required" yaml:"name"`
	Providers    Provider     `yaml:"providers"`
	NodePools    NodePool     `yaml:"nodePools"`
	Kubernetes   Kubernetes   `yaml:"kubernetes"`
	LoadBalancer LoadBalancer `yaml:"loadBalancers"`
}

func (*Manifest) CreateNodepools

func (ds *Manifest) CreateNodepools(pools []string, isControl bool) ([]*pb.NodePool, error)

CreateNodepools will create a pb.Nodepool structs based on the manifest specification returns error if nodepool/provider not defined, nil otherwise

func (*Manifest) FindNodePool

func (ds *Manifest) FindNodePool(nodePoolName string) *DynamicNodePool

FindNodePool will search for the nodepool in manifest.DynamicNodePool based on the nodepool name returns *manifest.DynamicNodePool if found, nil otherwise

func (*Manifest) GetProvider

func (ds *Manifest) GetProvider(providerSpecName string) (*pb.Provider, error)

GetProvider will search for a Provider config by matching name from providerSpec returns *pb.Provider,nil if matching Provider config found otherwise returns nil,error

func (*Manifest) IsKubernetesClusterPresent

func (m *Manifest) IsKubernetesClusterPresent(name string) bool

IsKubernetesClusterPresent checks in the manifests if a cluster was defined with the specified name.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate validates the parsed manifest data.

type Node

type Node struct {
	PublicIP      string `validate:"required,ip_addr" yaml:"publicIP"`
	PrivateSSHKey string `validate:"required" yaml:"privateSshKey"`
}

type NodePool

type NodePool struct {
	Dynamic []DynamicNodePool `yaml:"dynamic"`
	Static  []StaticNodePool  `yaml:"static"`
}

func (*NodePool) Validate

func (p *NodePool) Validate(m *Manifest) error

Validate validates the parsed data inside the NodePool section of the manifest. It checks for missing/invalid filled out values defined in the NodePool section of the manifest.

type OCI

type OCI struct {
	Name           string `validate:"required" yaml:"name"`
	PrivateKey     string `validate:"required" yaml:"private_key"`
	KeyFingerprint string `validate:"required" yaml:"key_fingerprint"`
	TenancyOCID    string `validate:"required" yaml:"tenancy_ocid"`
	UserOCID       string `validate:"required" yaml:"user_ocid"`
	CompartmentID  string `validate:"required" yaml:"compartment_ocid"`
}

func (*OCI) Validate

func (c *OCI) Validate() error

type Pool

type Pool struct {
	Control []string `validate:"min=1" yaml:"control"`
	Compute []string `yaml:"compute"`
}

type Provider

type Provider struct {
	GCP        []GCP        `yaml:"gcp"`
	Hetzner    []Hetzner    `yaml:"hetzner"`
	AWS        []AWS        `yaml:"aws"`
	OCI        []OCI        `yaml:"oci"`
	Azure      []Azure      `yaml:"azure"`
	Cloudflare []Cloudflare `yaml:"cloudflare"`
	HetznerDNS []HetznerDNS `yaml:"hetznerdns"`
}

func (*Provider) Validate

func (p *Provider) Validate() error

Validate validates the parsed data inside the provider section of the manifest. It checks for missing/invalid filled out values defined in the Provider section of the manifest.

type ProviderSpec

type ProviderSpec struct {
	Name   string `validate:"required" yaml:"name"`
	Region string `validate:"required" yaml:"region"`
	Zone   string `validate:"required" yaml:"zone"`
}

type Role

type Role struct {
	Name       string `validate:"required" yaml:"name"`
	Protocol   string `validate:"required,oneof=tcp udp" yaml:"protocol"`
	Port       int32  `validate:"min=0,max=65535" yaml:"port"`
	TargetPort int32  `validate:"min=0,max=65535" yaml:"target_port"`
	Target     string `validate:"required,oneof=k8sAllNodes k8sControlPlane k8sComputePlane" yaml:"target"`
}

func (*Role) Validate

func (r *Role) Validate() error

type StaticNodePool

type StaticNodePool struct {
	Name  string `validate:"required" yaml:"name"`
	Nodes []Node `validate:"dive" yaml:"nodes"`
}

func (*StaticNodePool) Validate

func (s *StaticNodePool) Validate() error

Jump to

Keyboard shortcuts

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