nodes

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept added in v0.9.4

func Accept(client *golangsdk.ServiceClient, opts AcceptOpts) (string, error)

Accept sends a request to accept nodes into the specified cluster

func Delete

func Delete(client *golangsdk.ServiceClient, clusterID, nodeID string) error

Delete will permanently delete a particular node based on its unique ID and cluster ID.

func Reset added in v0.9.4

func Reset(client *golangsdk.ServiceClient, opts ResetOpts) (string, error)

Types

type AcceptOpts added in v0.9.4

type AcceptOpts struct {
	ClusterID string `json:"-"`
	// API type, fixed value List
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion" required:"true"`
	// List of nodes to be accepted
	NodeList []AddNode `json:"nodeList" required:"true"`
}

type AddNode added in v0.9.4

type AddNode struct {
	// Server ID
	ServerID string `json:"serverID" required:"true"`
	// Node reinstallation configuration parameters
	Spec ReinstallNodeSpec `json:"spec" required:"true"`
}

AddNode contains the parameters for a single node to be accepted

type BandwidthOpts

type BandwidthOpts struct {
	ChargeMode string `json:"chargemode,omitempty"`
	Size       int    `json:"size,omitempty"`
	ShareType  string `json:"sharetype,omitempty"`
}

type Conditions

type Conditions struct {
	// The type of component
	Type string `json:"type"`
	// The state of the component
	Status string `json:"status"`
	// The reason that the component becomes current
	Reason string `json:"reason"`
}

type CreateMetaData

type CreateMetaData struct {
	// Node name
	Name string `json:"name,omitempty"`
	// Node tag, key value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// Node annotation, key value pair format
	Annotations map[string]string `json:"annotations,omitempty"`
}

CreateMetaData required to create a Node

type CreateOpts

type CreateOpts struct {
	// API type, fixed value Node
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion" required:"true"`
	// Metadata required to create a Node
	Metadata CreateMetaData `json:"metadata"`
	// specifications to create a Node
	Spec Spec `json:"spec" required:"true"`
}

CreateOpts is a struct contains the parameters of creating Node

type EipSpec

type EipSpec struct {
	// The value of the iptype keyword
	IpType string `json:"iptype,omitempty"`
	// Elastic IP bandwidth parameters
	Bandwidth BandwidthOpts `json:"bandwidth,omitempty"`
}

type ExtendParam

type ExtendParam struct {
	// Node charging mode, 0 is on-demand charging.
	ChargingMode int `json:"chargingMode,omitempty"`
	// Specifies the IAM agency name.
	AgencyName string `json:"agency_name,omitempty"`
	// Classification of cloud server specifications.
	EcsPerformanceType string `json:"ecs:performancetype,omitempty"`
	// Order ID, mandatory when the node payment type is the automatic payment package period type.
	OrderID string `json:"orderID,omitempty"`
	// The Product ID.
	ProductID string `json:"productID,omitempty"`
	// The Public Key.
	PublicKey string `json:"publicKey,omitempty"`
	// The maximum number of instances a node is allowed to create.
	MaxPods int `json:"maxPods,omitempty"`
	// Script required before the installation.
	PreInstall string `json:"alpha.cce/preInstall,omitempty"`
	// Script required after the installation.
	PostInstall string `json:"alpha.cce/postInstall,omitempty"`
	// Whether auto-renew is enabled.
	IsAutoRenew string `json:"isAutoRenew,omitempty"`
	// Whether to deduct fees automatically.
	IsAutoPay string `json:"isAutoPay,omitempty"`
	// Available disk space of a single Docker container on the node using the device mapper.
	DockerBaseSize int `json:"dockerBaseSize,omitempty"`
	// ConfigMap of the Docker data disk.
	DockerLVMConfigOverride string `json:"DockerLVMConfigOverride,omitempty"`
}

type Job

type Job struct {
	// API type, fixed value "Job"
	Kind string `json:"kind"`
	// API version, fixed value "v3"
	Apiversion string `json:"apiVersion"`
	// Node metadata
	Metadata JobMetadata `json:"metadata"`
	// Node detailed parameters
	Spec JobSpec `json:"spec"`
	// Node status information
	Status JobStatus `json:"status"`
}

Job Structure

func GetJobDetails

func GetJobDetails(client *golangsdk.ServiceClient, jobID string) (*Job, error)

GetJobDetails retrieves a particular job based on its unique ID

type JobMetadata

type JobMetadata struct {
	// ID of the job
	ID string `json:"uid"`
}

type JobResult added in v0.9.4

type JobResult struct {
	// Job ID for tracking the acceptance process
	JobID string `json:"jobid"`
}

JobResult contains the response from accepting nodes

type JobSpec

type JobSpec struct {
	// Type of job
	Type string `json:"type"`
	// ID of the cluster where the job is located
	ClusterID string `json:"clusterUID"`
	// ID of the IaaS resource for the job operation
	ResourceID string `json:"resourceID"`
	// The name of the IaaS resource for the job operation
	ResourceName string `json:"resourceName"`
	// List of child jobs
	SubJobs []Job `json:"subJobs"`
	// ID of the parent job
	OwnerJob string `json:"ownerJob"`
}

type JobStatus

type JobStatus struct {
	// Job status
	Phase string `json:"phase"`
	// The reason why the job becomes the current state
	Reason string `json:"reason"`
	// The job becomes the current state details
	Message string `json:"message"`
}

type ListNode

type ListNode struct {
	// API type, fixed value "List"
	Kind string `json:"kind"`
	// API version, fixed value "v3"
	Apiversion string `json:"apiVersion"`
	// all Clusters
	Nodes []Nodes `json:"items"`
}

ListNode describes the Node Structure of cluster

type ListOpts

type ListOpts struct {
	Name  string `json:"name"`
	Uid   string `json:"uid"`
	Phase string `json:"phase"`
}

ListOpts allows the filtering of list data using given parameters.

type LoginSpec

type LoginSpec struct {
	// Select the key pair name when logging in by key pair mode
	SshKey string `json:"sshKey,omitempty"`
	// Select the user/password when logging in
	UserPassword UserPassword `json:"userPassword,omitempty"`
}

type LvmConfig added in v0.9.4

type LvmConfig struct {
	// LVM write mode. linear indicates the linear mode. striped indicates the striped mode,
	// in which multiple disks are used to form a strip to improve disk performance.
	LvType string `json:"lvType" required:"true"`
	// Path to which the disk is attached.
	Path string `json:"path,omitempty"`
}

type MatchLabels added in v0.9.4

type MatchLabels struct {
	// Matched disk size.
	Size string `json:"size,omitempty"`
	// EVS disk type.
	VolumeType string `json:"volumeType,omitempty"`
	// Disk encryption identifier.
	MetadataEncrypted string `json:"metadataEncrypted,omitempty"`
	// Customer master key ID of an encrypted disk.
	MetadataCmkid string `json:"metadataCmkid,omitempty"`
	// Number of disks to be selected.
	Count string `json:"count,omitempty"`
}

type Metadata

type Metadata struct {
	// Node name
	Name string `json:"name"`
	// Node ID
	Id string `json:"uid"`
	// Node tag, key value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// Node annotation, key/value pair format
	Annotations map[string]string `json:"annotations,omitempty"`
}

Metadata required to create a node

type NodeItem added in v0.9.4

type NodeItem struct {
	// Node ID
	UID string `json:"uid" required:"true"`
}

NodeItem represents a node to be removed

type NodeLifecycleConfig added in v0.9.4

type NodeLifecycleConfig struct {
	// Pre-installation script
	PreInstall string `json:"preInstall,omitempty"`
	// Post-installation script
	PostInstall string `json:"postInstall,omitempty"`
}

NodeLifecycleConfig contains node lifecycle configuration

type NodeNicSpec

type NodeNicSpec struct {
	// The primary Nic of the Node
	PrimaryNic PrimaryNic `json:"primaryNic,omitempty"`
}

NodeNicSpec spec of the node

type Nodes

type Nodes struct {
	//  API type, fixed value " Host "
	Kind string `json:"kind"`
	// API version, fixed value v3
	Apiversion string `json:"apiVersion"`
	// Node metadata
	Metadata Metadata `json:"metadata"`
	// Node detailed parameters
	Spec Spec `json:"spec"`
	// Node status information
	Status Status `json:"status"`
}

Nodes of the cluster

func Create

func Create(client *golangsdk.ServiceClient, clusterID string, opts CreateOpts) (*Nodes, error)

Create accepts a CreateOpts struct and uses the values to create a new logical node.

func FilterNodes

func FilterNodes(nodes []Nodes, opts ListOpts) []Nodes

FilterNodes filters a list of Nodes based on the given ListOpts.

func Get

func Get(client *golangsdk.ServiceClient, clusterID, nodeID string) (*Nodes, error)

Get retrieves a particular nodes based on its unique ID and cluster ID.

func List

func List(client *golangsdk.ServiceClient, clusterID string, opts ListOpts) ([]Nodes, error)

List returns collection of nodes.

func Update

func Update(client *golangsdk.ServiceClient, clusterID, nodeID string, opts UpdateOpts) (*Nodes, error)

Update allows nodes to be updated.

type PrimaryNic

type PrimaryNic struct {
	// The Subnet ID of the primary Nic
	SubnetId string `json:"subnetId,omitempty"`

	// FixedIPs define list of private IPs
	FixedIPs []string `json:"fixedIps,omitempty"`
}

PrimaryNic of the node

type PublicIPSpec

type PublicIPSpec struct {
	// List of existing elastic IP IDs
	Ids []string `json:"ids,omitempty"`
	// The number of elastic IPs to be dynamically created
	Count int `json:"count,omitempty"`
	// Elastic IP parameters
	Eip EipSpec `json:"eip,omitempty"`
}

type ReinstallExtendParam added in v0.9.4

type ReinstallExtendParam struct {
	// ID of the user image
	AlphaCCENodeImageID string `json:"alpha.cce/NodeImageID,omitempty"`
}

ReinstallExtendParam contains extended parameters

type ReinstallK8sOptionsConfig added in v0.9.4

type ReinstallK8sOptionsConfig struct {
	// Node labels
	Labels map[string]string `json:"labels,omitempty"`
	// Node taints
	Taints []TaintSpec `json:"taints,omitempty"`
	// Maximum number of pods
	MaxPods int `json:"maxPods,omitempty"`
}

ReinstallK8sOptionsConfig contains Kubernetes configuration options

type ReinstallNodeSpec added in v0.9.4

type ReinstallNodeSpec struct {
	// Operating system
	OS string `json:"os" required:"true"`
	// Node login mode
	Login LoginSpec `json:"login" required:"true"`
	// Node name
	Name string `json:"name,omitempty"`
	// Server configuration
	ServerConfig *ReinstallServerConfig `json:"serverConfig,omitempty"`
	// Volume management configuration
	VolumeConfig *ReinstallVolumeConfig `json:"volumeConfig,omitempty"`
	// Container runtime configuration
	RuntimeConfig *ReinstallRuntimeConfig `json:"runtimeConfig,omitempty"`
	// Kubernetes node configuration
	K8sOptions *ReinstallK8sOptionsConfig `json:"k8sOptions,omitempty"`
	// Node lifecycle configuration
	Lifecycle *NodeLifecycleConfig `json:"lifecycle,omitempty"`
	// Custom initialization flags
	InitializedConditions []string `json:"initializedConditions,omitempty"`
	// Extended parameters
	ExtendParam *ReinstallExtendParam `json:"extendParam,omitempty"`
}

ReinstallNodeSpec contains the configuration for node reinstallation

type ReinstallRuntimeConfig added in v0.9.4

type ReinstallRuntimeConfig struct {
	// Available disk space of a single container
	DockerBaseSize int `json:"dockerBaseSize,omitempty"`
	// Container runtime
	Runtime *RuntimeSpec `json:"runtime,omitempty"`
}

ReinstallRuntimeConfig contains container runtime configuration

type ReinstallServerConfig added in v0.9.4

type ReinstallServerConfig struct {
	// Cloud server labels
	UserTags []tag.ResourceTag `json:"userTags,omitempty"`
	// System disk configurations
	RootVolume *ReinstallVolumeSpec `json:"rootVolume,omitempty"`
}

ReinstallServerConfig contains server configuration parameters

type ReinstallVolumeConfig added in v0.9.4

type ReinstallVolumeConfig struct {
	// Docker data disk configurations
	LvmConfig string `json:"lvmConfig,omitempty"`
	// Disk initialization management
	Storage *Storage `json:"storage,omitempty"`
}

ReinstallVolumeConfig contains volume management configuration

type ReinstallVolumeSpec added in v0.9.4

type ReinstallVolumeSpec struct {
	// Custom image ID
	ImageID string `json:"imageID,omitempty"`
	// User master key ID
	CmkID string `json:"cmkID,omitempty"`
}

ReinstallVolumeSpec contains volume specifications

type RemoveNodesOpts added in v0.9.4

type RemoveNodesOpts struct {
	ClusterID string `json:"-"`
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion,omitempty"`
	// API type, fixed value RemoveNodesTask
	Kind string `json:"kind,omitempty"`
	// Configuration information
	Spec RemoveNodesSpec `json:"spec" required:"true"`
}

RemoveNodesOpts contains parameters for removing nodes from a cluster

type RemoveNodesResponse added in v0.9.4

type RemoveNodesResponse struct {
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion,omitempty"`
	// API type, fixed value RemoveNodesTask
	Kind string `json:"kind,omitempty"`
	// Configuration information
	Spec RemoveNodesSpec `json:"spec"`
	// Job status
	Status TaskStatus `json:"status"`
}

RemoveNodesResponse represents the response from the remove nodes operation

func Remove added in v0.9.4

Remove sends a request to remove nodes from the specified cluster

type RemoveNodesSpec added in v0.9.4

type RemoveNodesSpec struct {
	// Node login mode
	Login LoginSpec `json:"login" required:"true"`
	// List of nodes to be operated
	Nodes []NodeItem `json:"nodes" required:"true"`
}

RemoveNodesSpec contains the configuration for node removal

type ResetNode added in v0.9.4

type ResetNode struct {
	NodeID string            `json:"nodeID" required:"true"`
	Spec   ReinstallNodeSpec `json:"spec" required:"true"`
}

type ResetOpts added in v0.9.4

type ResetOpts struct {
	ClusterID string `json:"-"`
	// API type, fixed value List
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiVersion" required:"true"`
	// List of nodes to reset
	NodeList []ResetNode `json:"nodeList" required:"true"`
}

type RuntimeConfig added in v0.9.4

type RuntimeConfig struct {
	// LVM write mode. linear indicates the linear mode. striped indicates the striped mode,
	// in which multiple disks are used to form a strip to improve disk performance.
	LvType string `json:"lvType" required:"true"`
}

type RuntimeSpec added in v0.6.1

type RuntimeSpec struct {
	// Container runtime. The default value is docker.
	// Enumeration values: docker, containerd
	Name string `json:"name,omitempty"`
}

type Spec

type Spec struct {
	// Node specifications
	Flavor string `json:"flavor" required:"true"`
	// The value of the available partition name
	Az string `json:"az" required:"true"`
	// The OS of the node
	Os string `json:"os,omitempty"`
	// ID of the dedicated host to which nodes will be scheduled
	DedicatedHostID string `json:"dedicatedHostId,omitempty"`
	// Node login parameters
	Login LoginSpec `json:"login" required:"true"`
	// System disk parameter of the node
	RootVolume VolumeSpec `json:"rootVolume" required:"true"`
	// The data disk parameter of the node must currently be a disk
	DataVolumes []VolumeSpec `json:"dataVolumes" required:"true"`
	// Disk initialization management parameter.
	Storage *Storage `json:"storage,omitempty"`
	// Elastic IP parameters of the node
	PublicIP PublicIPSpec `json:"publicIP,omitempty"`
	// The billing mode of the node: the value is 0 (on demand)
	BillingMode int `json:"billingMode,omitempty"`
	// Number of nodes when creating in batch
	Count int `json:"count" required:"true"`
	// The node nic spec
	NodeNicSpec NodeNicSpec `json:"nodeNicSpec,omitempty"`
	// Extended parameter
	ExtendParam ExtendParam `json:"extendParam,omitempty"`
	// UUID of an ECS group
	EcsGroupID string `json:"ecsGroupId,omitempty"`
	// Tag of a VM, key value pair format
	UserTags []tags.ResourceTag `json:"userTags,omitempty"`
	// Tag of a Kubernetes node, key value pair format
	K8sTags map[string]string `json:"k8sTags,omitempty"`
	// taints to created nodes to configure anti-affinity
	Taints []TaintSpec `json:"taints,omitempty"`
	// Container runtime. The default value is docker.
	Runtime RuntimeSpec `json:"runtime,omitempty"`
}

Spec describes Nodes specification

type Status

type Status struct {
	// The state of the Node
	Phase string `json:"phase"`
	// The virtual machine ID of the node in the ECS
	ServerID string `json:"ServerID"`
	// Elastic IP of the node
	PublicIP string `json:"PublicIP"`
	// Private IP of the node
	PrivateIP string `json:"privateIP"`
	// The ID of the Job that is operating asynchronously in the Node
	JobID string `json:"jobID"`
	// Reasons for the Node to become current
	Reason string `json:"reason"`
	// Details of the node transitioning to the current state
	Message string `json:"message"`
	// The status of each component in the Node
	Conditions Conditions `json:"conditions"`
}

Status gives the current status of the node

type Storage added in v0.9.4

type Storage struct {
	// Disk selection. Matched disks are managed according to matchLabels and storageType.
	StorageSelectors []StorageSelector `json:"storageSelectors" required:"true"`
	// A storage group consists of multiple storage devices. It is used to divide storage space.
	StorageGroups []StorageGroup `json:"storageGroups" required:"true"`
}

type StorageGroup added in v0.9.4

type StorageGroup struct {
	// Name of a virtual storage group, which must be unique.
	Name string `json:"name" required:"true"`
	// Storage space for Kubernetes and runtime components.
	CceManaged bool `json:"cceManaged,omitempty"`
	// This parameter corresponds to name in storageSelectors.
	SelectorNames []string `json:"selectorNames" required:"true"`
	// Detailed management of space configuration in a group.
	VirtualSpaces []VirtualSpace `json:"virtualSpaces" required:"true"`
}

type StorageSelector added in v0.9.4

type StorageSelector struct {
	// Selector name, used as the index of selectorNames in storageGroup.
	Name string `json:"name" required:"true"`
	// Specifies the storage type. Currently, only evs (EVS volumes) and local (local volumes) are supported.
	StorageType string `json:"storageType" required:"true"`
	// Matching field of an EVS volume.
	MatchLabels *MatchLabels `json:"matchLabels,omitempty"`
}

type TaintSpec

type TaintSpec struct {
	Key   string `json:"key" required:"true"`
	Value string `json:"value" required:"true"`
	// Available options are NoSchedule, PreferNoSchedule, and NoExecute
	Effect string `json:"effect" required:"true"`
}

TaintSpec to created nodes to configure anti-affinity

type TaskStatus added in v0.9.4

type TaskStatus struct {
	// Job ID for tracking the removal process
	JobID string `json:"jobID"`
}

TaskStatus contains the job status information

type UpdateMetadata

type UpdateMetadata struct {
	Name string `json:"name,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	Metadata UpdateMetadata `json:"metadata,omitempty"`
}

UpdateOpts contains all the values needed to update a new node

type UserPassword

type UserPassword struct {
	Username string `json:"username" required:"true"`
	Password string `json:"password" required:"true"`
}

type UserTag added in v0.9.4

type UserTag struct {
	// Key of the cloud server label
	Key string `json:"key,omitempty"`
	// Value of the cloud server label
	Value string `json:"value,omitempty"`
}

UserTag represents a key-value pair label for cloud servers

type VirtualSpace added in v0.9.4

type VirtualSpace struct {
	// Name of a virtualSpace.
	Name string `json:"name" required:"true"`
	// Size of a virtualSpace. The value must be an integer in percentage.
	Size string `json:"size" required:"true"`
	// LVM configurations, applicable to kubernetes and user spaces.
	LvmConfig *LvmConfig `json:"lvmConfig,omitempty"`
	// runtime configurations, applicable to the runtime space.
	RuntimeConfig *RuntimeConfig `json:"runtimeConfig,omitempty"`
}

type VolumeSpec

type VolumeSpec struct {
	// Disk Size in GB
	Size int `json:"size" required:"true"`
	// Disk VolumeType
	VolumeType string `json:"volumetype" required:"true"`
	// Metadata contains data disk encryption information
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// Disk extension parameter
	ExtendParam map[string]interface{} `json:"extendParam,omitempty"`
}

Directories

Path Synopsis
node unit tests
node unit tests

Jump to

Keyboard shortcuts

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