nodes

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestOpts golangsdk.RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json"},
}

Functions

func GetStructNestedField

func GetStructNestedField(v *Nodes, field string, structDriller []string) string

Types

type AddNode

type AddNode struct {
	ServerID string      `json:"serverID" required:"true"`
	Spec     AddNodeSpec `json:"spec" required:"true"`
}

type AddNodeResponse

type AddNodeResponse struct {
	JobID string `json:"jobid"`
}

type AddNodeSpec

type AddNodeSpec struct {
	// The OS of the node
	Os string `json:"os" required:"true"`
	// Node login parameters
	Login LoginSpec `json:"login" required:"true"`
	//Node name
	Name string `json:"name,omitempty"`
	// ECS server config of the node
	ServerConfig *ServerConfig `json:"serverConfig,omitempty"`
	// Volume management config of the node
	VolumeConfig *VolumeConfig `json:"volumeConfig,omitempty"`
	// Runtime config of the node
	RuntimeConfig *RuntimeConfig `json:"runtimeConfig,omitempty"`
	// Kubernetes options of the node
	K8sOptions *K8sOptions `json:"k8sOptions,omitempty"`
	// Custom lifecycle config of the node
	Lifecycle *Lifecycle `json:"lifecycle,omitempty"`
	// Extended parameter
	ExtendParam map[string]interface{} `json:"extendParam,omitempty"`
}

type AddOpts

type AddOpts struct {
	// 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 add
	NodeList []AddNode `json:"nodeList" required:"true"`
}

func (AddOpts) ToNodeAddMap

func (opts AddOpts) ToNodeAddMap() (map[string]interface{}, error)

type AddOptsBuilder

type AddOptsBuilder interface {
	ToNodeAddMap() (map[string]interface{}, error)
}

type AddResult

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

func Add

func Add(c *golangsdk.ServiceClient, clusterid string, opts AddOptsBuilder) (r AddResult)

func Reset

func Reset(c *golangsdk.ServiceClient, clusterid string, opts ResetOptsBuilder) (r AddResult)

func (AddResult) Extract

func (r AddResult) Extract() (*Nodes, error)

Extract is a function that accepts a result and extracts a node.

func (AddResult) ExtractAddNode

func (r AddResult) ExtractAddNode() (*AddNodeResponse, error)

func (AddResult) ExtractJob

func (r AddResult) ExtractJob() (*Job, error)

ExtractJob is a function that accepts a result and extracts a job.

func (AddResult) ExtractNode

func (r AddResult) ExtractNode() ([]Nodes, error)

ExtractNode is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

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"`
}

Metadata 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"`
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

func (CreateOpts) ToNodeCreateMap

func (opts CreateOpts) ToNodeCreateMap() (map[string]interface{}, error)

ToNodeCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToNodeCreateMap() (map[string]interface{}, error)
}

Create accepts a CreateOpts struct and uses the values to create a new logical Node. When it is created, the Node does not have an internal interface

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Node.

func Create

func Create(c *golangsdk.ServiceClient, clusterid string, opts CreateOptsBuilder) (r CreateResult)

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

func (CreateResult) Extract

func (r CreateResult) Extract() (*Nodes, error)

Extract is a function that accepts a result and extracts a node.

func (CreateResult) ExtractAddNode

func (r CreateResult) ExtractAddNode() (*AddNodeResponse, error)

func (CreateResult) ExtractJob

func (r CreateResult) ExtractJob() (*Job, error)

ExtractJob is a function that accepts a result and extracts a job.

func (CreateResult) ExtractNode

func (r CreateResult) ExtractNode() ([]Nodes, error)

ExtractNode is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(c *golangsdk.ServiceClient, clusterid, nodeid string) (r DeleteResult)

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

func Remove

func Remove(c *golangsdk.ServiceClient, clusterid string, opts RemoveOptsBuilder) (r DeleteResult)

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 FilterStruct

type FilterStruct struct {
	Value   string
	Driller []string
}

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Node.

func Get

func Get(c *golangsdk.ServiceClient, clusterid, nodeid string) (r GetResult)

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

func GetJobDetails

func GetJobDetails(c *golangsdk.ServiceClient, jobid string) (r GetResult)

GetJobDetails retrieves a particular job based on its unique ID

func (GetResult) Extract

func (r GetResult) Extract() (*Nodes, error)

Extract is a function that accepts a result and extracts a node.

func (GetResult) ExtractAddNode

func (r GetResult) ExtractAddNode() (*AddNodeResponse, error)

func (GetResult) ExtractJob

func (r GetResult) ExtractJob() (*Job, error)

ExtractJob is a function that accepts a result and extracts a job.

func (GetResult) ExtractNode

func (r GetResult) ExtractNode() ([]Nodes, error)

ExtractNode is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

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"`
}

Describes the Job Structure

type JobMetadata

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

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 K8sOptions

type K8sOptions struct {
	// Tag of a Kubernetes node, key value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// taints to created nodes to configure anti-affinity
	Taints []TaintSpec `json:"taints,omitempty"`
	// The maximum number of pods allowed to be created on a node
	MaxPods int `json:"maxPods,omitempty"`
	// NIC queue number configuration
	NicMultiQueue string `json:"nicMultiqueue,omitempty"`
	// NIC pre-binding ratio configuration
	NicThreshold string `json:"nicThreshold,omitempty"`
}

type LVMConfigSpec

type LVMConfigSpec struct {
	// LVM write mode, values can be linear and striped
	LvType string `json:"lvType" required:"true"`
	// Path to which the disk is attached, this parameter takes effect only in user configuration
	// The value is an absolute path
	Path string `json:"path,omitempty"`
}

type Lifecycle

type Lifecycle struct {
	// Preinstall script
	Preinstall string `json:"preInstall,omitempty"`
	// Postinstall script
	PostInstall string `json:"postInstall,omitempty"`
}

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"`
}

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 ListResult

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

ListResult represents the result of a list operation. Call its ExtractNode method to interpret it as a Nodes.

func (ListResult) Extract

func (r ListResult) Extract() (*Nodes, error)

Extract is a function that accepts a result and extracts a node.

func (ListResult) ExtractAddNode

func (r ListResult) ExtractAddNode() (*AddNodeResponse, error)

func (ListResult) ExtractJob

func (r ListResult) ExtractJob() (*Job, error)

ExtractJob is a function that accepts a result and extracts a job.

func (ListResult) ExtractNode

func (r ListResult) ExtractNode() ([]Nodes, error)

ExtractNode is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

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 MatchLabelsSpec

type MatchLabelsSpec struct {
	// Matched disk size if left unspecified, the disk size is not limited
	Size string `json:"size,omitempty"`
	// EVS disk type
	VolumeType string `json:"volumeType,omitempty"`
	// Disk encryption identifier
	// 0 indicates that the disk is not encrypted, and 1 indicates that the disk is encrypted
	MetadataEncrypted string `json:"metadataEncrypted,omitempty"`
	// Customer master key ID of an encrypted disk
	MetadataCmkid string `json:"metadataCmkid,omitempty"`
	// Number of disks to be selected, if left blank, all disks of this type are 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, keyvalue pair format
	Annotations map[string]string `json:"annotations,omitempty"`
}

Metadata required to create a node

type NodeItem

type NodeItem struct {
	Uid string `json:"uid,omitempty"`
}

type NodeNicSpec

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

Gives the Nic 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"`
}

Individual nodes of the cluster

func FilterNodes

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

func List

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

List returns collection of nodes.

type PrimaryNic

type PrimaryNic struct {
	// The Subnet ID of the primary Nic
	SubnetId string `json:"subnetId,omitempty"`
	// Fixed ips of the primary Nic
	FixedIps []string `json:"fixedIps,omitempty"`
}

Gives the Primary Nic 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 RemoveNodeSpec

type RemoveNodeSpec struct {
	Login LoginSpec  `json:"login" required:"true"`
	Nodes []NodeItem `json:"nodes,omitempty"`
}

type RemoveOpts

type RemoveOpts struct {
	//  API type, fixed value RemoveNodesTask
	Kind string `json:"kind,omitempty"`
	// API version, fixed value v3
	Apiversion string `json:"apiVersion,omitempty"`

	Spec RemoveNodeSpec `json:"spec" required:"true"`
}

func (RemoveOpts) ToNodeRemoveMap

func (opts RemoveOpts) ToNodeRemoveMap() (map[string]interface{}, error)

type RemoveOptsBuilder

type RemoveOptsBuilder interface {
	ToNodeRemoveMap() (map[string]interface{}, error)
}

type ResetNode

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

type ResetOpts

type ResetOpts struct {
	// 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"`
}

func (ResetOpts) ToNodeResetMap

func (opts ResetOpts) ToNodeResetMap() (map[string]interface{}, error)

type ResetOptsBuilder

type ResetOptsBuilder interface {
	ToNodeResetMap() (map[string]interface{}, error)
}

type RootVolume

type RootVolume struct {
	// Custom image ID
	ImageID string `json:"imageID,omitempty"`
	// User master key ID, default to empty, means the disk in not encrypted
	CmkID string `json:"cmkID,omitempty"`
}

type RunTimeSpec

type RunTimeSpec struct {
	// the name of runtime: docker or containerd
	Name string `json:"name,omitempty"`
}

type RuntimeConfig

type RuntimeConfig struct {
	// The available disk space of a single Docker container on the node in device mapper mode
	DockerBaseSize int `json:"dockerBaseSize,omitempty"`
	// The runtime spec
	Runtime *RunTimeSpec `json:"runtime,omitempty"`
}

type RuntimeConfigSpec

type RuntimeConfigSpec struct {
	// LVM write mode, values can be linear and striped
	LvType string `json:"lvType" required:"true"`
}

type ServerConfig

type ServerConfig struct {
	// Tag of a VM, key value pair format
	UserTags []tags.ResourceTag `json:"userTags,omitempty"`
	// System disk parameter of the node
	RootVolume *RootVolume
}

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 configuration management parameters
	// If omit, disk management is performed according to the DockerLVMConfigOverride parameter in extendParam
	Storage *StorageSpec `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 map[string]interface{} `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"`
	// The runtime spec
	RunTime *RunTimeSpec `json:"runtime,omitempty"`
	// taints to created nodes to configure anti-affinity
	Taints []TaintSpec `json:"taints,omitempty"`
	// The name of the created partition
	Partition string `json:"partition,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"`
}

Gives the current status of the node

type StorageGroupsSpec

type StorageGroupsSpec struct {
	// Name of a virtual storage group, each group name must be unique
	Name string `json:"name" required:"true"`
	// Storage space for Kubernetes and runtime components
	// Only one group can be set to true, default value is false
	CceManaged bool `json:"cceManaged,omitempty"`
	// This parameter corresponds to name in storageSelectors
	// A group can match multiple selectors, but a selector can match only one group
	SelectorNames []string `json:"selectorNames" required:"true"`
	// Detailed management of space configuration in a group
	VirtualSpaces []VirtualSpacesSpec `json:"virtualSpaces" required:"true"`
}

type StorageSelectorsSpec

type StorageSelectorsSpec struct {
	// Selector name, used as the index of selectorNames in storageGroup, the name of each selector must be unique
	Name string `json:"name" required:"true"`
	// Specifies the storage type. Currently, only evs and local are supported
	// The local storage does not support disk selection. All local disks will form a VG
	// Therefore, only one storageSelector of the local type is allowed
	StorageType string `json:"storageType" required:"true"`
	// Matching field of an EVS volume
	MatchLabels MatchLabelsSpec `json:"matchLabels,omitempty"`
}

type StorageSpec

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

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 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

func (UpdateOpts) ToNodeUpdateMap

func (opts UpdateOpts) ToNodeUpdateMap() (map[string]interface{}, error)

ToNodeUpdateMap builds an update body based on UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToNodeUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Node.

func Update

func Update(c *golangsdk.ServiceClient, clusterid, nodeid string, opts UpdateOptsBuilder) (r UpdateResult)

Update allows nodes to be updated.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Nodes, error)

Extract is a function that accepts a result and extracts a node.

func (UpdateResult) ExtractAddNode

func (r UpdateResult) ExtractAddNode() (*AddNodeResponse, error)

func (UpdateResult) ExtractJob

func (r UpdateResult) ExtractJob() (*Job, error)

ExtractJob is a function that accepts a result and extracts a job.

func (UpdateResult) ExtractNode

func (r UpdateResult) ExtractNode() ([]Nodes, error)

ExtractNode is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type UserPassword

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

type VirtualSpacesSpec

type VirtualSpacesSpec struct {
	// virtualSpace name, currently, only kubernetes, runtime, and user are supported
	// kubernetes and user require lvmConfig to be configured, runtime requires runtimeConfig to be configured
	Name string `json:"name" required:"true"`
	// Size of a virtual space, only an integer percentage is supported, example: 90%
	// Note that the total percentage of all virtual spaces in a group cannot exceed 100%
	Size string `json:"size" required:"true"`
	// LVM configurations, applicable to kubernetes and user spaces
	// One virtual space supports only one config
	LVMConfig *LVMConfigSpec `json:"lvmConfig,omitempty"`
	// runtime configurations, applicable to the runtime space
	// One virtual space supports only one config
	RuntimeConfig *RuntimeConfigSpec `json:"runtimeConfig,omitempty"`
}

type VolumeConfig

type VolumeConfig struct {
	// Docker data disk configurations
	LvmConfig string `json:"lvmConfig,omitempty"`
}

type VolumeMetadata

type VolumeMetadata struct {
	// Whether the EVS disk is encrypted.
	// The value 0 indicates that the EVS disk is not encrypted,
	// and the value 1 indicates that the EVS disk is encrypted.
	SystemEncrypted string `json:"__system__encrypted,omitempty"`
	// CMK ID, which indicates encryption in metadata.
	SystemCmkid string `json:"__system__cmkid,omitempty"`
}

type VolumeSpec

type VolumeSpec struct {
	// Disk size in GB
	Size int `json:"size" required:"true"`
	// Disk type
	VolumeType string `json:"volumetype" required:"true"`
	//hw:passthrough
	HwPassthrough bool `json:"hw:passthrough,omitempty"`
	// Disk extension parameter
	ExtendParam map[string]interface{} `json:"extendParam,omitempty"`
	// Disk encryption information.
	Metadata *VolumeMetadata `json:"metadata,omitempty"`
}

Jump to

Keyboard shortcuts

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