service

package
v0.0.0-...-ae22146 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	// NewRequest makes an API request to configured management server
	NewRequest(api string, args map[string]string, out interface{}) (map[string]interface{}, error)

	// Close terminates the client
	Close()
}

APIClient is an interface to communicate to CloudStack via HTTP calls

func NewAPIClient

func NewAPIClient(config *Config) APIClient

NewAPIClient returns a new APIClient

type CKSService

type CKSService interface {
	// GetClusterDetails returns the details of the CKS Cluster
	GetClusterDetails(clusterID string) (*Cluster, error)

	// ScaleCluster scales up / down the worker nodes in a cluster
	ScaleCluster(clusterID string, workerCount int) (*Cluster, error)

	// RemoveNodesFromCluster removes the given nodes from a cluster. However all masters can not be removed
	RemoveNodesFromCluster(clusterID string, nodeIDs ...string) (*Cluster, error)

	// Close terminates the service
	Close()
}

CKSService provides all the functionality of CloudStack Kubernetes Service

func NewCKSService

func NewCKSService(config *Config) CKSService

NewCKSService returns a new CKS Service

type Cluster

type Cluster struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Minsize           int               `json:"minsize"`
	Maxsize           int               `json:"maxsize"`
	WorkerCount       int               `json:"size"`
	MasterCount       int               `json:"masternodes"`
	VirtualMachines   []*VirtualMachine `json:"virtualmachines"`
	VirtualMachineMap map[string]*VirtualMachine
}

Cluster contains the CKS Cluster details

type ClusterResponse

type ClusterResponse struct {
	Cluster *Cluster `json:"kubernetescluster"`
}

ClusterResponse is the response returned by the scaleKubernetesCluster API

type ClustersResponse

type ClustersResponse struct {
	Count    int        `json:"count"`
	Clusters []*Cluster `json:"kubernetescluster"`
}

ClustersResponse contains the CKS Clusters and their total count

type Config

type Config struct {
	APIKey       string
	SecretKey    string
	Endpoint     string
	Timeout      int
	PollInterval int
}

Config contains the parameters used to configure a new APIClient

type JobResponse

type JobResponse struct {
	JobStatus float64     `json:"jobstatus"`
	JobID     string      `json:"jobid"`
	JobResult interface{} `json:"jobresult"`
}

JobResponse contains the async job details

type ListClusterResponse

type ListClusterResponse struct {
	ClustersResponse *ClustersResponse `json:"listkubernetesclustersresponse"`
}

ListClusterResponse is the response returned by the listKubernetesClusters API

type QueryAsyncJobResponse

type QueryAsyncJobResponse struct {
	JobResponse *JobResponse `json:"queryasyncjobresultresponse"`
}

QueryAsyncJobResponse is the response returned by the queryAsyncJobResult API

type VirtualMachine

type VirtualMachine struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	State string `json:"state"`
}

VirtualMachine represents a node in a CKS cluster

Jump to

Keyboard shortcuts

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