model

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KIND_STATUS       = "Status"
	KIND_CLUSTER      = "Cluster"
	KIND_CLUSTER_LIST = "ClusterList"
	KIND_NODE         = "Node"
	KIND_NODE_LIST    = "NodeList"
)
View Source
const (
	STATUS_CREATED      = "created"
	STATUS_PROVISIONING = "provisioning"
	STATUS_COMPLETED    = "completed"
	STATUS_FAILED       = "failed"
)
View Source
const (
	STATUS_UNKNOWN   = 0
	STATUS_SUCCESS   = 1
	STATUS_NOT_EXIST = 404
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Model
	Status        string `json:"status"`
	UId           string `json:"uid"`
	MCIS          string `json:"mcis"`
	Namespace     string `json:"namespace"`
	ClusterConfig string `json:"clusterConfig"`
	Nodes         []Node `json:"nodes"`
}

func NewCluster

func NewCluster(namespace string, name string) *Cluster

func (*Cluster) Complete

func (c *Cluster) Complete(cluster *Cluster)

func (*Cluster) Delete

func (c *Cluster) Delete(cluster *Cluster) error

func (*Cluster) Fail

func (c *Cluster) Fail(cluster *Cluster)

func (*Cluster) Insert

func (c *Cluster) Insert(cluster *Cluster)

func (*Cluster) Select

func (c *Cluster) Select(cluster *Cluster) (*Cluster, error)

func (*Cluster) Update

func (c *Cluster) Update(cluster *Cluster)

type ClusterList

type ClusterList struct {
	Kind  string    `json:"kind"`
	Items []Cluster `json:"items"`
}

func NewClusterList

func NewClusterList() *ClusterList

func (*ClusterList) SelectList

func (c *ClusterList) SelectList(namespace string, clusters *ClusterList) (*ClusterList, error)

type ClusterReq

type ClusterReq struct {
	Name                  string `json:"name"`
	ControlPlaneNodeSpec  string `json:"controlPlaneNodeSpec"`
	ControlPlaneNodeCount int    `json:"controlPlaneNodeCount"`
	WorkerNodeSpec        string `json:"workerNodeSpec"`
	WorkerNodeCount       int    `json:"workerNodeCount"`
}

type Model

type Model struct {
	Name string `json:"name"`
	Kind string `json:"kind"`
}

type Node

type Node struct {
	Model
	Credential string `json:"credential"`
	PublicIP   string `json:"publicIp"`
	UId        string `json:"uid"`
	Role       string `json:"role"`
	Spec       string `json:"spec"`
}

func NewNode

func NewNode(vm VM) *Node

func NewNodeDef

func NewNodeDef(nodeName string) *Node

func (*Node) Delete

func (n *Node) Delete(namespace string, clusterName string, node *Node) error

func (*Node) Insert

func (n *Node) Insert(namespace string, clusterName string, node *Node) (*Node, error)

func (*Node) Select

func (n *Node) Select(namespace string, clusterName string, node *Node) (*Node, error)

type NodeList

type NodeList struct {
	Kind  string `json:"kind"`
	Items []Node `json:"items"`
}

func NewNodeList

func NewNodeList() *NodeList

func (*NodeList) SelectList

func (n *NodeList) SelectList(namespace string, clusterName string, nodes *NodeList) (*NodeList, error)

type NodeReq

type NodeReq struct {
	Config          string `json:"config"`
	WorkerNodeSpec  string `json:"workerNodeSpec"`
	WorkerNodeCount int    `json:"workerNodeCount"`
}

type Status

type Status struct {
	Kind    string `json:"kind"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func NewStatus

func NewStatus() *Status

type VM

type VM struct {
	Name         string   `json:"name"`
	Config       string   `json:"connectionName"`
	VPC          string   `json:"vNetId"`
	Subnet       string   `json:"subnetId"`
	Firewall     []string `json:"securityGroupIds"`
	SSHKey       string   `json:"sshKeyId"`
	Image        string   `json:"imageId"`
	Spec         string   `json:"specId"`
	UserAccount  string   `json:"vmUserAccount"`
	UserPassword string   `json:"vmUserPassword"`
	Description  string   `json:"description"`
	PublicIP     string   `json:"publicIP"` // output
	Credential   string   // private
	UId          string   `json:"uid"`
	Role         string   `json:"role"`
}

func (*VM) Bootstrap

func (v *VM) Bootstrap(sshInfo *ssh.SSHInfo) (bool, error)

func (*VM) ConnectionTest

func (v *VM) ConnectionTest(sshInfo *ssh.SSHInfo, vm *VM) error

func (*VM) ControlPlaneInit

func (v *VM) ControlPlaneInit(sshInfo *ssh.SSHInfo, ip string) (string, string, error)

func (*VM) CopyScripts

func (v *VM) CopyScripts(sshInfo *ssh.SSHInfo, vm *VM) error

func (*VM) WorkerJoin

func (v *VM) WorkerJoin(sshInfo *ssh.SSHInfo, workerJoinCmd *string) (bool, error)

func (*VM) WorkerJoinForAddNode

func (v *VM) WorkerJoinForAddNode(sshInfo *ssh.SSHInfo, workerJoinCmd *string) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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