nodes

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2015 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package nodes provides information and interaction with the Node API resource for the Rackspace Cloud Load Balancer service.

Nodes are responsible for servicing the requests received through the load balancer's virtual IP. A node is usually a virtual machine. By default, the load balancer employs a basic health check that ensures the node is listening on its defined port. The node is checked at the time of addition and at regular intervals as defined by the load balancer's health check configuration. If a back-end node is not listening on its port, or does not meet the conditions of the defined check, then connections will not be forwarded to the node, and its status is changed to OFFLINE. Only nodes that are in an ONLINE status receive and can service traffic from the load balancer.

All nodes have an associated status that indicates whether the node is ONLINE, OFFLINE, or DRAINING. Only nodes that are in ONLINE status can receive and service traffic from the load balancer. The OFFLINE status represents a node that cannot accept or service traffic. A node in DRAINING status represents a node that stops the traffic manager from sending any additional new connections to the node, but honors established sessions. If the traffic manager receives a request and session persistence requires that the node is used, the traffic manager uses it. The status is determined by the passive or active health monitors.

If the WEIGHTED_ROUND_ROBIN load balancer algorithm mode is selected, then the caller should assign the relevant weights to the node as part of the weight attribute of the node element. When the algorithm of the load balancer is changed to WEIGHTED_ROUND_ROBIN and the nodes do not already have an assigned weight, the service automatically sets the weight to 1 for all nodes.

One or more secondary nodes can be added to a specified load balancer so that if all the primary nodes fail, traffic can be redirected to secondary nodes. The type attribute allows configuring the node as either PRIMARY or SECONDARY.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *gophercloud.ServiceClient, loadBalancerID int, limit *int) pagination.Pager

List is the operation responsible for returning a paginated collection of load balancer nodes. It requires the node ID, its parent load balancer ID, and optional limit integer (passed in either as a pointer or a nil poitner).

func ListEvents

func ListEvents(client *gophercloud.ServiceClient, loadBalancerID int, opts ListEventsOptsBuilder) pagination.Pager

ListEvents is the operation responsible for listing all the events associated with the activity between the node and the load balancer. The events report errors found with the node. The detailedMessage provides the detailed reason for the error.

Types

type Condition

type Condition string

Condition represents the condition of a node.

const (
	// ENABLED indicates that the node is permitted to accept new connections.
	ENABLED Condition = "ENABLED"

	// DISABLED indicates that the node is not permitted to accept any new
	// connections regardless of session persistence configuration. Existing
	// connections are forcibly terminated.
	DISABLED Condition = "DISABLED"

	// DRAINING indicates that the node is allowed to service existing
	// established connections and connections that are being directed to it as a
	// result of the session persistence configuration.
	DRAINING Condition = "DRAINING"
)

type CreateOpt

type CreateOpt struct {
	// Required - the IP address or CIDR for this back-end node. It can either be
	// a private IP (ServiceNet) or a public IP.
	Address string

	// Optional - the port on which traffic is sent and received.
	Port int

	// Optional - the condition of the node. See the consts in Results.go.
	Condition Condition

	// Optional - the type of the node. See the consts in Results.go.
	Type Type

	// Optional - a pointer to an integer between 0 and 100.
	Weight *int
}

CreateOpt represents the options to create a single node.

type CreateOpts

type CreateOpts []CreateOpt

CreateOpts is a slice of CreateOpt structs, that allow the user to create multiple nodes in a single operation (one node per CreateOpt).

func (CreateOpts) ToNodeCreateMap

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

ToNodeCreateMap converts a slice of options into a map that can be used for the JSON.

type CreateOptsBuilder

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

CreateOptsBuilder is the interface responsible for generating the JSON for a Create operation.

type CreateResult

type CreateResult struct {
	pagination.SinglePageBase
}

CreateResult represents the result of a create operation. Since multiple nodes can be added in one operation, this result represents multiple nodes and should be treated as a typical pagination Page. Use its ExtractNodes method to get out a slice of Node structs.

func Create

func Create(client *gophercloud.ServiceClient, loadBalancerID int, opts CreateOptsBuilder) CreateResult

Create is the operation responsible for creating a new node on a load balancer. Since every load balancer exists in both ServiceNet and the public Internet, both private and public IP addresses can be used for nodes.

If nodes need time to boot up services before they become operational, you can temporarily prevent traffic from being sent to that node by setting the Condition field to DRAINING. Health checks will still be performed; but once your node is ready, you can update its condition to ENABLED and have it handle traffic.

func (CreateResult) ExtractNodes

func (res CreateResult) ExtractNodes() ([]Node, error)

ExtractNodes extracts a slice of Node structs from a CreateResult.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func BulkDelete

func BulkDelete(c *gophercloud.ServiceClient, loadBalancerID int, nodeIDs []int) DeleteResult

BulkDelete is the operation responsible for batch deleting multiple nodes in a single operation. It accepts a slice of integer IDs and will remove them from the load balancer. The maximum limit is 10 node removals at once.

func Delete

func Delete(c *gophercloud.ServiceClient, lbID, nodeID int) DeleteResult

Delete is the operation responsible for permanently deleting a node.

type GetResult

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

GetResult represents the result of a get operation.

func Get

func Get(c *gophercloud.ServiceClient, lbID, nodeID int) GetResult

Get is the operation responsible for showing details for a single node.

func (GetResult) Extract

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

type ListEventsOpts

type ListEventsOpts struct {
	Marker string `q:"marker"`
	Limit  int    `q:"limit"`
}

ListEventsOpts allows the filtering and sorting of paginated collections through the API.

func (ListEventsOpts) ToEventsListQuery

func (opts ListEventsOpts) ToEventsListQuery() (string, error)

ToEventsListQuery formats a ListOpts into a query string.

type ListEventsOptsBuilder

type ListEventsOptsBuilder interface {
	ToEventsListQuery() (string, error)
}

ListEventsOptsBuilder allows extensions to add additional parameters to the List request.

type Node

type Node struct {
	// The IP address or CIDR for this back-end node.
	Address string

	// The unique ID for this node.
	ID int

	// The port on which traffic is sent and received.
	Port int

	// The node's status.
	Status Status

	// The node's condition.
	Condition Condition

	// The priority at which this node will receive traffic if a weighted
	// algorithm is used by its parent load balancer. Ranges from 1 to 100.
	Weight int

	// Type of node.
	Type Type
}

Node represents a back-end device, usually a virtual machine, that can handle traffic. It is assigned traffic based on its parent load balancer.

func ExtractNodes

func ExtractNodes(page pagination.Page) ([]Node, error)

ExtractNodes accepts a Page struct, specifically a NodePage struct, and extracts the elements into a slice of Node structs. In other words, a generic collection is mapped into a relevant slice.

type NodeEvent

type NodeEvent struct {
	ID              int
	DetailedMessage string
	NodeID          int
	Type            string
	Description     string
	Category        string
	Severity        string
	RelativeURI     string
	AccountID       int
	LoadBalancerID  int
	Title           string
	Author          string
	Created         string
}

NodeEvent represents a service event that occurred between a node and a load balancer.

func ExtractNodeEvents

func ExtractNodeEvents(page pagination.Page) ([]NodeEvent, error)

ExtractNodeEvents accepts a Page struct, specifically a NodeEventPage struct, and extracts the elements into a slice of NodeEvent structs. In other words, the collection is mapped into a relevant slice.

type NodeEventPage

type NodeEventPage struct {
	pagination.SinglePageBase
}

NodeEventPage is a concrete type which embeds the common SinglePageBase struct, and is used when traversing node event collections.

func (NodeEventPage) IsEmpty

func (r NodeEventPage) IsEmpty() (bool, error)

IsEmpty is a concrete function which indicates whether an NodeEventPage is empty or not.

type NodePage

type NodePage struct {
	pagination.SinglePageBase
}

NodePage is the page returned by a pager when traversing over a collection of nodes.

func (NodePage) IsEmpty

func (p NodePage) IsEmpty() (bool, error)

IsEmpty checks whether a NodePage struct is empty.

type Status

type Status string

Status indicates whether the node can accept service traffic. If a node is not listening on its port or does not meet the conditions of the defined active health check for the load balancer, then the load balancer does not forward connections, and its status is listed as OFFLINE.

const (
	// ONLINE indicates that the node is healthy and capable of receiving traffic
	// from the load balancer.
	ONLINE Status = "ONLINE"

	// OFFLINE indicates that the node is not in a position to receive service
	// traffic. It is usually switched into this state when a health check is not
	// satisfied with the node's response time.
	OFFLINE Status = "OFFLINE"
)

type Type

type Type string

Type indicates whether the node is of a PRIMARY or SECONDARY nature.

const (
	// PRIMARY nodes are in the normal rotation to receive traffic from the load
	// balancer.
	PRIMARY Type = "PRIMARY"

	// SECONDARY nodes are only in the rotation to receive traffic from the load
	// balancer when all the primary nodes fail. This provides a failover feature
	// that automatically routes traffic to the secondary node in the event that
	// the primary node is disabled or in a failing state. Note that active
	// health monitoring must be enabled on the load balancer to enable the
	// failover feature to the secondary node.
	SECONDARY Type = "SECONDARY"
)

type UpdateOpts

type UpdateOpts struct {
	// Optional - the condition of the node. See the consts in Results.go.
	Condition Condition

	// Optional - the type of the node. See the consts in Results.go.
	Type Type

	// Optional - a pointer to an integer between 0 and 100.
	Weight *int
}

UpdateOpts represent the options for updating an existing node.

func (UpdateOpts) ToNodeUpdateMap

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

ToNodeUpdateMap converts an options struct into a JSON-like map.

type UpdateOptsBuilder

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

UpdateOptsBuilder represents a type that can be converted into a JSON-like map structure.

type UpdateResult

type UpdateResult struct {
	gophercloud.ErrResult
}

UpdateResult represents the result of an update operation.

func Update

func Update(c *gophercloud.ServiceClient, lbID, nodeID int, opts UpdateOptsBuilder) UpdateResult

Update is the operation responsible for updating an existing node. A node's IP, port, and status are immutable attributes and cannot be modified.

Jump to

Keyboard shortcuts

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