stackpointio

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFormattedInstanceList

func GetFormattedInstanceList(instances []Instance) []string

GetFormattedInstanceList takes a list of Instance objects and makes a formatted list of strings for the user

func GetIDFromEnv

func GetIDFromEnv(name string) (int, error)

GetEnvID grabs string from environment and converts to integer

func InstanceInList

func InstanceInList(instances []Instance, i string) bool

InstanceInList returns true if instance is in list of Instances

func PrettyPrint

func PrettyPrint(v interface{})

PrettyPrint to break down objects

func StringInSlice

func StringInSlice(s string, list []string) bool

StringInSlice utlity function, like in_array, userful for validation of machine types

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient references an api token and an http endpoint

func NewClient

func NewClient(token, endpoint string) *APIClient

NewClient returns a new api client

func NewClientFromEnv

func NewClientFromEnv() (*APIClient, error)

NewClientFromEnv creates a new client from environment variables

func (*APIClient) AddNode

func (c *APIClient) AddNode(orgID, clusterID int, newNode NodeAdd) ([]Node, error)

AddNodes sends a request to add master nodes to a cluster, returns list of Node objects created

func (*APIClient) AddNodesToNodePool

func (c *APIClient) AddNodesToNodePool(orgID, clusterID, nodepoolID int, newNode NodeAddToPool) ([]Node, error)

AddNodesToNodePool sends a request to add worker nodes to a nodepool, returns list of Node objects created

func (*APIClient) CreateCluster

func (c *APIClient) CreateCluster(orgID int, cluster Cluster) (*Cluster, error)

CreateCluster requests cluster creation

func (*APIClient) CreateKeyset

func (c *APIClient) CreateKeyset(orgID int, keyset Keyset) (*Keyset, error)

CreateKeyset creates keyset

func (*APIClient) CreateNodePool

func (c *APIClient) CreateNodePool(orgID, clusterID int, newPool NodePool) (*NodePool, error)

CreateNodePool creates a new nodepool for a cluster, returns NodePool object

func (*APIClient) DeleteCluster

func (c *APIClient) DeleteCluster(orgID, clusterID int) error

DeleteCluster deletes cluster

func (*APIClient) DeleteKeyset

func (c *APIClient) DeleteKeyset(orgID, keysetID int) error

DeleteKeyset deletes keyset

func (*APIClient) DeleteNode

func (c *APIClient) DeleteNode(orgID, clusterID, nodeID int) error

DeleteNode makes an API call to begin deleting a node

func (*APIClient) GetCluster

func (c *APIClient) GetCluster(orgID, clusterID int) (*Cluster, error)

GetCluster gets a single cluster by primary ID and organization

func (*APIClient) GetClusterState

func (c *APIClient) GetClusterState(orgID, clusterID int) (string, error)

GetClusterState returns state of cluster

func (*APIClient) GetClusters

func (c *APIClient) GetClusters(orgID int) ([]Cluster, error)

GetClusters gets all clusters associated with an organization

func (*APIClient) GetInstanceSpecs

func (c *APIClient) GetInstanceSpecs(prov string) ([]Instance, error)

GetMachSpecs returns list of machine types for cloud provider type

func (*APIClient) GetKeyset

func (c *APIClient) GetKeyset(orgID, keysetID int) (*Keyset, error)

GetKeyset returns keyset for Org ID and Keyset ID

func (*APIClient) GetKeysets

func (c *APIClient) GetKeysets(orgID int) ([]Keyset, error)

GetKeysets gets list of keysets for Org ID

func (*APIClient) GetNode

func (c *APIClient) GetNode(orgID, clusterID, nodeID int) (*Node, error)

GetNode retrieves data for a single node

func (*APIClient) GetNodePool

func (c *APIClient) GetNodePool(orgID, clusterID, nodepoolID int) (*NodePool, error)

GetNodePool gets a NodePool for a cluster, returns NodePool object

func (*APIClient) GetNodePoolState

func (c *APIClient) GetNodePoolState(orgID, clusterID, nodepoolID int) (string, error)

GetNodePoolState returns state of nodepool

func (*APIClient) GetNodePools

func (c *APIClient) GetNodePools(orgID, clusterID int) ([]NodePool, error)

GetNodePools gets the NodePools for a cluster, returns list of NodePool objects

func (*APIClient) GetNodeState

func (c *APIClient) GetNodeState(orgID, clusterID, nodeID int) (string, error)

GetNodeState returns state of node

func (*APIClient) GetNodes

func (c *APIClient) GetNodes(orgID, clusterID int) ([]Node, error)

GetNodes gets the nodes associated with a cluster and organization

func (*APIClient) GetOrganization

func (c *APIClient) GetOrganization(orgID int) (*Organization, error)

GetOrganization retrieves data for a single organization

func (*APIClient) GetOrganizations

func (c *APIClient) GetOrganizations() ([]Organization, error)

GetOrganizations retrieves data organizations that the client can access

type Cluster

type Cluster struct {
	ID                 int        `json:"pk"`
	Name               string     `json:"name"`
	OrganizationKey    int        `json:"org"`
	InstanceID         string     `json:"instance_id"`
	Provider           string     `json:"provider"`
	ProviderKey        int        `json:"provider_keyset"`
	ProviderKeyName    string     `json:"provider_keyset_name"`
	ProviderResourceGp string     `json:"provider_resource_group,omitempty"`
	ProviderNetworkID  string     `json:"provider_network_id,omitempty"`
	ProviderNetworkCdr string     `json:"provider_network_cidr,omitempty"`
	ProviderSubnetID   string     `json:"provider_subnet_id,omitempty"`
	ProviderSubnetCidr string     `json:"provider_subnet_cidr,omitempty"`
	ProviderBalancerID string     `json:"provider_balancer_id,omitempty"`
	Region             string     `json:"region"`
	Zone               string     `json:"zone,omitempty"`
	State              string     `json:"state,omitempty"`
	ProjectID          string     `json:"project_id,omitempty"`
	Owner              int        `json:"owner"`
	Notified           bool       `json:"notified,omitempty"`
	KubernetesVersion  string     `json:"k8s_version"`
	Created            time.Time  `json:"created"`
	Updated            time.Time  `json:"updated,omitempty"`
	DashboardEnabled   bool       `json:"k8s_dashboard_enabled"`
	DashboardInstalled bool       `json:"k8s_dashboard_installed"`
	KubeconfigPath     string     `json:"kubeconfig_path"`
	RbacEnabled        bool       `json:"k8s_rbac_enabled"`
	MasterCount        int        `json:"master_count"`
	WorkerCount        int        `json:"worker_count"`
	MasterSize         string     `json:"master_size"`
	WorkerSize         string     `json:"worker_size"`
	NodeCount          int        `json:"node_count"`
	EtcdType           string     `json:"etcd_type"`
	Platform           string     `json:"platform"`
	Image              string     `json:"image"`
	Channel            string     `json:"channel"`
	SSHKeySet          int        `json:"user_ssh_keyset"`
	Solutions          []Solution `json:"solutions"`
}

Cluster describes a Kubernetes cluster in the StackPointCloud system

type Instance

type Instance struct {
	Name  string
	Specs MachineSpecs
}

type Key

type Key struct {
	ID          int    `json:"pk"`
	Type        string `json:"key_type"`
	Value       string `json:"key"`
	Fingerprint string `json:"fingerprint"`
	User        int    `json:"user"`
}

Key struct

type Keyset

type Keyset struct {
	Name       string `json:"name"`
	ID         int    `json:"pk"`
	Category   string `json:"category"`
	Entity     string `json:"entity"`
	Org        int    `json:"org"`
	Workspaces []int  `json:"workspaces"`
	User       int    `json:"user"`
	IsDefault  bool   `json:"is_default"`
	Keys       []Key  `json:"keys"`
	Created    string `json:"created"`
}

Keyset struct

type MachineSpecs

type MachineSpecs struct {
	Memory int
	CPU    int
	Name   string
}

type Node

type Node struct {
	ID           int       `json:"pk"`
	Name         string    `json:"name,omitempty"`
	ClusterID    int       `json:"cluster"`
	InstanceID   string    `json:"instance_id"`
	NodePoolID   int       `json:"pool,omitempty"`
	NodePoolName string    `json:"pool_name,omitempty"`
	Role         string    `json:"role"`
	Group        string    `json:"group_name,omitempty"`
	PrivateIP    string    `json:"private_ip"`
	PublicIP     string    `json:"public_ip"`
	Platform     string    `json:"platform"`
	Image        string    `json:"image"`
	Location     string    `json:"location"`
	Size         string    `json:"size"`
	State        string    `json:"state,omitempty"`
	Created      time.Time `json:"created"`
	Updated      time.Time `json:"updated,omitempty"`
}

Node describes a node in a cluster. The string field Size is provider-specific

type NodeAdd

type NodeAdd struct {
	Size               string `json:"size"`
	Count              int    `json:"node_count"`
	Group              string `json:"group,omitempty"`
	Role               string `json:"role,omitempty"`
	Zone               string `json:"zone,omitempty"`
	ProviderSubnetID   string `json:"provider_subnet_id,omitempty"`
	ProviderSubnetCidr string `json:"provider_subnet_cidr,omitempty"`
}

NodeAdd is used for adding master nodes only (endpoint /clusters/<cluster_id>/add_node)

type NodeAddToPool

type NodeAddToPool struct {
	Count              int    `json:"node_count"`
	Group              string `json:"group,omitempty"`
	NodePoolID         int    `json:"node_pool"`
	Role               string `json:"role,omitempty"`
	Zone               string `json:"zone,omitempty"`
	ProviderSubnetID   string `json:"provider_subnet_id,omitempty"`
	ProviderSubnetCidr string `json:"provider_subnet_cidr,omitempty"`
}

NodeAddToPool is used for adding worker nodes to pools (endpoint /clusters/<cluster_id>/nodepools/add)

type NodePool

type NodePool struct {
	ID                 int       `json:"pk"`
	Name               string    `json:"name"`
	ClusterID          int       `json:"cluster"`
	InstanceID         string    `json:"instance_id"`
	Size               string    `json:"instance_size"`
	CPU                string    `json:"cpu,omitempty"`
	Memory             string    `json:"memory,omitempty"`
	Labels             string    `json:"labels,omitempty"`
	Autoscaled         bool      `json:"autoscaled"`
	MinCount           int       `json:"min_count,omitempty"`
	MaxCount           int       `json:"max_count,omitempty"`
	Zone               string    `json:"zone,omitempty"`
	ProviderSubnetID   string    `json:"provider_subnet_id,omitempty"`
	ProviderSubnetCidr string    `json:"provider_subnet_cidr,omitempty"`
	NodeCount          int       `json:"node_count"`
	Platform           string    `json:"platform"`
	Channel            string    `json:"channel"`
	Role               string    `json:"role,omitempty"`
	State              string    `json:"state,omitempty"`
	Default            bool      `json:"is_default"`
	Created            time.Time `json:"created"`
	Updated            time.Time `json:"updated,omitempty"`
	Deleted            time.Time `json:"deleted,omitempty"`
}

NodePool defines the characteristics of a grouping of nodes

type Organization

type Organization struct {
	Name string `json:"name"`
	ID   int    `json:"pk"`
}

Organization is the top level of the hierarchy

type ProviderSpecs

type ProviderSpecs struct {
	Name    string      `json:"name"`
	Filters interface{} `json:"filters"`
	Config  interface{} `json:"config"`
}

Provider instance structs

type Solution

type Solution struct {
	ID       int    `json:"pk"`
	Solution string `json:"solution"`
	Keyset   int    `json:"keyset,omitempty"` // only for turbonomic and sysdig
	MaxNodes int    `json:"max_nodes"`        // only for autoscaler
}

Solution is a application or process running with or on a kubernetes cluster

Jump to

Keyboard shortcuts

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