api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CertificateNameLimit    = 20
	CertificateContentLimit = 10000
)
View Source
const (
	KubeAPIServerConnectTypeFirstMasterIP KubeAPIServerConnectType = "firstMasterIP"
	KubeAPIServerConnectTypeKeepalived    KubeAPIServerConnectType = "keepalived"
	KubeAPIServerConnectTypeLoadBalancer  KubeAPIServerConnectType = "loadbalancer"

	ClusterNameLengthLimit         = 30
	ClusterShortNameLengthLimit    = 20
	ClusterIPLengthLimit           = 15
	ClusterNetInterfaceLengthLimit = 30
	ClusterLoadbalancerPortMinimum = 1
	ClusterLoadbalancerPortMaximum = 65535
	ClusterNodePortMinimum         = 1
	ClusterNodePortMaximum         = 65535
	LabelKeyLengthLimit            = 253
	AnnotationKeyLengthLimit       = 253
	DefaultClusterNodePortMinimum  = 30000
	DefaultClusterNodePortMaximum  = 32767
)
View Source
const (
	DeployStatusPending    DeployStatus = "pending"
	DeployStatusRunning    DeployStatus = "running"
	DeployStatusSuccessful DeployStatus = "successful"
	DeployStatusFailed     DeployStatus = "failed"
	DeployStatusAborted    DeployStatus = "aborted"

	DeployClusterStatusPending            DeployClusterStatus = "pending"
	DeployClusterStatusRunning            DeployClusterStatus = "running"
	DeployClusterStatusSuccessful         DeployClusterStatus = "successful"
	DeployClusterStatusFailed             DeployClusterStatus = "failed"
	DeployClusterStatusWorkedButHaveError DeployClusterStatus = "workedButHaveError"
)
View Source
const (
	AuthenticationTypePassword   AuthenticationType = "password"   // Use Password to authorize
	AuthenticationTypePrivateKey AuthenticationType = "privateKey" // Use RSA PrivateKey to authorize

	TaintEffectNoSchedule       TaintEffect = "NoSchedule"
	TaintEffectNoExecute        TaintEffect = "NoExecute"
	TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"

	NodeNameLengthLimit           = 64
	NodeDescriptionLengthLimit    = 100
	TaintKeyLengthLimit           = 253
	TaintValueLengthLimit         = 63
	NodeUsernameRegularExpression = `^[A-Za-z]([\w\-.]+)?$`

	NodeSSHPortMinimum = 1
	NodeSSHPortMaximum = 65535
)
View Source
const (
	ProgressSettingClusterInformation Progress = "settingClusterInformation"
	ProgressSettingNodesInformation   Progress = "settingNodesInformation"
	ProgressCheckingNodes             Progress = "checkingNodes"
	ProgressDeploying                 Progress = "deploying"
	ProgressDeployCompleted           Progress = "deployCompleted"

	WizardModeNormal   WizardMode = "normal"
	WizardModeAdvanced WizardMode = "advanced"
)

Variables

This section is empty.

Functions

func ValidateStringFunctionReturnErrorMessages

func ValidateStringFunctionReturnErrorMessages(function func(string) []string, value, keyName string) validator.ValidateFunc

Types

type Annotation

type Annotation struct {
	Key   string `json:"key" binding:"required" minimum:"1" maximum:"253"`
	Value string `json:"value" binding:"required" minimum:"1"`
}

func (*Annotation) Validate

func (annotation *Annotation) Validate() error

type AuthenticationType

type AuthenticationType string // Type of authorization,  password or privateKey

type CheckingItem

type CheckingItem struct {
	CheckingPoint string               `json:"point"`                                            // Check point
	Result        constant.CheckResult `json:"result" enums:"pending,running,successful,failed"` // Checking Result
	Error         *Error               `json:"error,omitempty"`
}

type CheckingResultResponseData

type CheckingResultResponseData struct {
	Name  string         `json:"name"`
	Items []CheckingItem `json:"items"`
}

type Cluster

type Cluster struct {
	ShortName                string                   `json:"shortName" binding:"required" minLength:"1" maxLength:"20"`
	Name                     string                   `json:"name" binding:"required"`
	KubeAPIServerConnectType KubeAPIServerConnectType `json:"kubeAPIServerConnectType" binding:"required" enums:"firstMasterIP,keepalived,loadbalancer"` // kube-apiserver connect type
	VIP                      string                   `json:"vip,omitempty" maxLength:"15"`                                                              // keepalived listen virtual ip
	NetInterfaceName         string                   `json:"netInterfaceName,omitempty" maxLength:"30"`                                                 // keepalived listen net interface name
	LoadbalancerIP           string                   `json:"loadbalancerIP,omitempty" maxLength:"15"`                                                   // kube-apiserver loadbalancer ip when kubeAPIServerConnectType is loadbalancer required
	LoadbalancerPort         uint16                   `json:"loadbalancerPort,omitempty" minimum:"1" maximum:"65535"`                                    // kube-apiserver loadbalancer port when kubeAPIServerConnectType is loadbalancer required
	NodePortMinimum          uint16                   `json:"nodePortMinimum" minimum:"1" default:"30000"`
	NodePortMaximum          uint16                   `json:"nodePortMaximum" maximum:"65535" default:"32767"`
	Labels                   []Label                  `json:"labels"`
	Annotations              []Annotation             `json:"annotations"`
}

func (*Cluster) Validate

func (cluster *Cluster) Validate() error

type ConnectionData

type ConnectionData struct {
	SSHLoginData `json:",inline"`

	IP   string `json:"ip" binding:"required" minLength:"1" maxLength:"15"`               // node ip
	Port uint16 `json:"port" binding:"required" minimum:"1" maximum:"65535" default:"22"` // ssh port
}

func (*ConnectionData) Validate

func (node *ConnectionData) Validate() error

type DeployClusterStatus

type DeployClusterStatus string

type DeployStatus

type DeployStatus string

type DeploymentNode

type DeploymentNode struct {
	Name   string       `json:"name"`                                                     // node name
	Status DeployStatus `json:"result" enums:"pending,running,successful,failed,aborted"` // Checking Result
	Error  *Error       `json:"error,omitempty"`
}

type DeploymentResponseData

type DeploymentResponseData struct {
	Role  constant.MachineRole `json:"role" enums:"master,worker,etcd"`
	Nodes []DeploymentNode     `json:"nodes"`
}

type Error

type Error struct {
	Reason     string `json:"reason"`          // Reason of Error message
	Detail     string `json:"detail"`          // Why is it wrong, what is the judgment condition?
	FixMethods string `json:"fixMethods"`      // How to improve to meet the conditions
	LogId      uint64 `json:"logId,omitempty"` // ID used to get the log file
}

type GetCheckingResultResponse

type GetCheckingResultResponse struct {
	Nodes  []CheckingResultResponseData `json:"nodes"`
	Result constant.CheckResult         `json:"result" enums:"pending,running,successful,failed"` // Overall inspection status
}

type GetDeploymentReportResponse

type GetDeploymentReportResponse struct {
	Roles               []DeploymentResponseData `json:"roles"`
	DeployClusterStatus DeployClusterStatus      `json:"deployClusterStatus" enums:"pending,running,successful,failed,workedButHaveError"` // The cluster deployment status
	DeployClusterError  *Error                   `json:"deployClusterError,omitempty"`                                                     // Deploy cluster error message
}

type GetNodeListResponse

type GetNodeListResponse struct {
	Nodes []NodeData `json:"nodes"` // node list
}

type GetSSHCertificateListResponse

type GetSSHCertificateListResponse struct {
	Names []string `json:"names"`
}

type GetWizardResponse

type GetWizardResponse struct {
	ClusterData         Cluster                      `json:"cluster"`                                                                                                    // Cluster Information
	NodesData           []NodeData                   `json:"nodes"`                                                                                                      // Nodes Information
	CheckingData        []CheckingResultResponseData `json:"checkingData"`                                                                                               // Check result
	DeploymentData      []DeploymentResponseData     `json:"deploymentData"`                                                                                             // Deployment result
	Progress            Progress                     `json:"progress" enums:"settingClusterInformation,settingNodesInformation,checkingNodes,deploying,deployCompleted"` // Wizard progress
	Mode                WizardMode                   `json:"mode"`                                                                                                       // Wizard mode, normal or advanced
	CheckResult         constant.CheckResult         `json:"checkResult" enums:"pending,running,successful,failed"`                                                      // Nodes check result
	DeployClusterStatus DeployClusterStatus          `json:"deployClusterStatus" enums:"pending,running,successful,failed,workedButHaveError"`                           // Cluster deployment status
}

type HelmRelease

type HelmRelease struct {
	Cluster string `json:"cluster"`
	// empty Name means to generate a name, only used in installing a release.
	Name         string     `json:"name,omitempty"`
	Namespace    string     `json:"namespace"`
	Chart        string     `json:"chart,omitempty"`
	ChartRepo    string     `json:"chartRepo,omitempty"`
	ChartVersion string     `json:"chartVersion,omitempty"`
	Values       HelmValues `json:"values,omitempty"`
	Revision     uint32     `json:"revision,omitempty"`
	Manifest     string     `json:"manifest,omitempty"`
}

HelmRelease presents a helm release.

type HelmValues

type HelmValues map[string]interface{}

type KubeAPIServerConnectType

type KubeAPIServerConnectType string

type Label

type Label struct {
	Key   string `json:"key" binding:"required" minimum:"1" maximum:"253"`
	Value string `json:"value" binding:"required" minimum:"1"`
}

func (*Label) Validate

func (label *Label) Validate() error

type NodeBaseData

type NodeBaseData struct {
	Name                string                 `json:"name" binding:"required" minLength:"1" maxLength:"64"` // node name
	Description         string                 `json:"description"`                                          // node description
	MachineRoles        []constant.MachineRole `json:"roles" default:"" enums:"master,worker,etcd"`          // machine role, Master and worker roles are mutually exclusive.
	Labels              []Label                `json:"labels"`                                               // Node labels
	Taints              []Taint                `json:"taints"`                                               // Node taints
	DockerRootDirectory string                 `json:"dockerRootDirectory" default:"/var/lib/docker"`        // Docker Root Directory
}

func (*NodeBaseData) Validate

func (node *NodeBaseData) Validate() error

type NodeData

type NodeData struct {
	NodeBaseData   `json:",inline"`
	ConnectionData `json:",inline"`
}

func (*NodeData) Validate

func (node *NodeData) Validate() error

type Progress

type Progress string

type SSHCertificate

type SSHCertificate struct {
	Name    string `json:"name" binding:"required" minimum:"1" maximum:"20"`
	Content string `json:"content" binding:"required"`
}

func (*SSHCertificate) Validate

func (cert *SSHCertificate) Validate() error

type SSHLoginData

type SSHLoginData struct {
	Username           string             `json:"username" binding:"required" maxLength:"128"`   // ssh username
	AuthenticationType AuthenticationType `json:"authorizationType" enums:"password,privateKey"` // type of authorization
	Password           string             `json:"password,omitempty"`                            // login password
	PrivateKeyName     string             `json:"privateKeyName,omitempty"`                      // the private key name of login
}

func (*SSHLoginData) Validate

func (login *SSHLoginData) Validate() error

func (*SSHLoginData) ValidateWithoutPassword

func (login *SSHLoginData) ValidateWithoutPassword() error

type SuccessfulOption

type SuccessfulOption struct {
	Success bool `json:"success"`
}

type Taint

type Taint struct {
	Key    string      `json:"key" binding:"required" minimum:"1" maximum:"63"`
	Value  string      `json:"value" binding:"required" minimum:"1" maximum:"63"`
	Effect TaintEffect `json:"effect" enums:"NoSchedule,NoExecute,PreferNoSchedule"`
}

func (*Taint) Validate

func (taint *Taint) Validate() error

type TaintEffect

type TaintEffect string // Taint Effect, NoSchedule, NoExecute or PreferNoSchedule

type TestConnectionResponse

type TestConnectionResponse struct {
	SuccessfulOption `json:",inline"`

	Error *Error `json:"error,omitempty"` // Error Detail
}

type UpdateNodeData

type UpdateNodeData struct {
	NodeBaseData `json:",inline"`
	SSHLoginData `json:",inline"`

	Port uint16 `json:"port" binding:"required" minimum:"1" maximum:"65535" default:"22"` // ssh port
}

func (*UpdateNodeData) Validate

func (node *UpdateNodeData) Validate() error

type WizardMode

type WizardMode string

Jump to

Keyboard shortcuts

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