rancher

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Wait4ClusterStateTimeout = 1800
	Wait4NodeStateTimeout    = 600
	ConnResetTriesMax        = 12
	ConnResetSleepTimeout    = 60
)

Default timeouts

View Source
const (
	HostNameLabel             = "kubernetes.io/hostname"
	NodeRoleLabelWorker       = "node-role.kubernetes.io/worker"
	NodeRoleLabelControlplane = "node-role.kubernetes.io/controlplane"
	NodeRoleLabelEtcd         = "node-role.kubernetes.io/etcd"
)

Variables

This section is empty.

Functions

func DiscoverNode added in v1.8.0

func DiscoverNode(d *schema.ResourceData, meta interface{}, nodeConfig *config.NodeConfig) (err error)

func DoGet

func DoGet(url, username, password, token, cacert string, insecure bool) ([]byte, error)

DoGet is core HTTP get routine

func GetMapString added in v1.9.5

func GetMapString(m interface{}, key string) string

Get string map value safely

func IsForbidden

func IsForbidden(err error) bool

IsForbidden checks Forbidden in return

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks NotFound in return

func NewListOpts

func NewListOpts(filters map[string]interface{}) *types.ListOpts

NewListOpts creates ListOpts

func NormalizeURL

func NormalizeURL(input string) string

NormalizeURL normalizes URL

func RootURL

func RootURL(url string) string

RootURL gets root URL

Types

type Rancher2Client added in v1.8.0

type Rancher2Client struct {
	Management    *managementClient.Client
	MachineClient dynamic.NamespaceableResourceInterface
	Retries       int
}

Rancher2Client is rancher2 client

func (*Rancher2Client) ClusterWaitForState added in v1.8.0

func (client *Rancher2Client) ClusterWaitForState(clusterID string, states string, timeout int) (err error)

ClusterWaitForState waits until cluster is in specified state

func (*Rancher2Client) ClusterWaitForTransitioning added in v1.8.0

func (client *Rancher2Client) ClusterWaitForTransitioning(clusterID string, timeout int) (err error)

ClusterWaitForTransitioning waits until cluster enters transitioning state

func (*Rancher2Client) DeleteNode added in v1.8.0

func (client *Rancher2Client) DeleteNode(nodeID string) (err error)

DeleteNode deletes Rancher node and node machine

func (*Rancher2Client) GetClusterByID added in v1.8.0

func (client *Rancher2Client) GetClusterByID(clusterID string) (cluster *managementClient.Cluster, err error)

Resilient to transient errors version of Cluster.ByID

func (*Rancher2Client) GetClusterList added in v1.8.0

func (client *Rancher2Client) GetClusterList(opts *types.ListOpts) (clusters *managementClient.ClusterCollection, err error)

Resilient to transient errors version of Cluster.List

func (*Rancher2Client) GetNodeByAddr added in v1.8.0

func (client *Rancher2Client) GetNodeByAddr(clusterID string, nodeIPAddr string) (cluster *managementClient.Cluster, node *managementClient.Node, nodeID string, err error)

GetNode gets Rancher node by cluster ID and node IP address

func (*Rancher2Client) GetNodeByID added in v1.8.0

func (client *Rancher2Client) GetNodeByID(nodeID string) (node *managementClient.Node, err error)

Resilient to transient errors version of Node.ByID

func (*Rancher2Client) GetNodeList added in v1.8.0

func (client *Rancher2Client) GetNodeList(opts *types.ListOpts) (nodes *managementClient.NodeCollection, err error)

Resilient to transient errors version of Node.List

func (*Rancher2Client) GetNodeMachine added in v1.9.5

func (client *Rancher2Client) GetNodeMachine(node *managementClient.Node) (machine *unstructured.Unstructured, err error)

GetNodeMachine gets Rancher node machine resource

func (*Rancher2Client) GetNodeRole added in v1.8.0

func (client *Rancher2Client) GetNodeRole(nodeID string) (controlplane bool, etcd bool, worker bool, err error)

GetNodeRole gets Rancher node role

func (*Rancher2Client) NodeCordon added in v1.8.0

func (client *Rancher2Client) NodeCordon(nodeID string) (err error)

NodeCordon cordon Rancher node

func (*Rancher2Client) NodeCordonDrain added in v1.8.0

func (client *Rancher2Client) NodeCordonDrain(nodeID string, nodeDrainInput *managementClient.NodeDrainInput) (err error)

NodeCordonDrain cordon/drain Rancher node

func (*Rancher2Client) NodeGetLabels added in v1.8.0

func (client *Rancher2Client) NodeGetLabels(nodeID string) (nodeLabels map[string]string, err error)

NodeGetLabels get Rancher node labels

func (*Rancher2Client) NodeGetState added in v1.8.0

func (client *Rancher2Client) NodeGetState(nodeID string) (state string, err error)

NodeGetState gets Rancher node state

func (*Rancher2Client) NodeGetTaints added in v1.8.0

func (client *Rancher2Client) NodeGetTaints(nodeID string) (taints []managementClient.Taint, err error)

NodeGetTaints get Rancher node taints

func (*Rancher2Client) NodeSetAnnotationsLabelsTaints added in v1.8.0

func (client *Rancher2Client) NodeSetAnnotationsLabelsTaints(nodeID string, annotations map[string]string, labels map[string]string, taints []managementClient.Taint) (err error)

NodeSetAnnotationsLabelsTaints sets Rancher node annotations, labels, and taints

func (*Rancher2Client) NodeUncordon added in v1.8.0

func (client *Rancher2Client) NodeUncordon(nodeID string) (err error)

NodeUncordon uncordon Rancher node

func (*Rancher2Client) NodeUpdateLabels added in v1.8.0

func (client *Rancher2Client) NodeUpdateLabels(nodeID string, oldLabels map[string]interface{}, newLabels map[string]interface{}) (err error)

NodeUpdateLabels updates Rancher node labels

func (*Rancher2Client) NodeUpdateTaints added in v1.8.0

func (client *Rancher2Client) NodeUpdateTaints(nodeID string, oldTaints []interface{}, newTaints []interface{}) (err error)

NodeUpdateTaints updates Rancher node taints

func (*Rancher2Client) NodeWaitForState added in v1.8.0

func (client *Rancher2Client) NodeWaitForState(nodeID string, states string, timeout int) (err error)

NodeWaitForState waits until Rancher node in specified state

type Rancher2Config added in v1.8.0

type Rancher2Config struct {
	config.RancherConfig
	Client Rancher2Client
}

Rancher2Config is rancher2 client configuration

func (*Rancher2Config) InitializeClient added in v1.8.0

func (c *Rancher2Config) InitializeClient() (err error)

InitializeClient initializes Rancher Management Client

type Rancher2Node added in v1.8.0

type Rancher2Node struct {
	RancherClient    *Rancher2Client
	NodeConfig       *config.NodeConfig
	NodeDrainInput   *rancherManagementClient.NodeDrainInput
	ClusterID        string
	ClusterProvider  string
	NodeID           string
	NodeControlPlane bool
	NodeEtcd         bool
	NodeWorker       bool
}

RancherNode is rancher2 node definition

func Rancher2APIInitialize added in v1.8.0

func Rancher2APIInitialize(d *schema.ResourceData, meta interface{}, nodeConfig *config.NodeConfig, waitForNode bool) (node *Rancher2Node, err error)

func (*Rancher2Node) IsNodeControlPlane added in v1.8.0

func (node *Rancher2Node) IsNodeControlPlane() bool

func (*Rancher2Node) IsNodeEtcd added in v1.8.0

func (node *Rancher2Node) IsNodeEtcd() bool

func (*Rancher2Node) IsNodeWorker added in v1.8.0

func (node *Rancher2Node) IsNodeWorker() bool

func (*Rancher2Node) IsProviderRKE1 added in v1.8.4

func (node *Rancher2Node) IsProviderRKE1() bool

func (*Rancher2Node) IsProviderRKE2 added in v1.8.4

func (node *Rancher2Node) IsProviderRKE2() bool

func (*Rancher2Node) RancherAPIClusterWaitForState added in v1.8.0

func (node *Rancher2Node) RancherAPIClusterWaitForState(state string, timeout int) (err error)

func (*Rancher2Node) RancherAPIClusterWaitForTransitioning added in v1.8.0

func (node *Rancher2Node) RancherAPIClusterWaitForTransitioning(timeout int) (err error)

func (*Rancher2Node) RancherAPINodeCordon added in v1.8.0

func (node *Rancher2Node) RancherAPINodeCordon() (err error)

func (*Rancher2Node) RancherAPINodeCordonDrain added in v1.8.0

func (node *Rancher2Node) RancherAPINodeCordonDrain() (err error)

func (*Rancher2Node) RancherAPINodeDelete added in v1.8.0

func (node *Rancher2Node) RancherAPINodeDelete() (err error)

func (*Rancher2Node) RancherAPINodeGetID added in v1.8.0

func (node *Rancher2Node) RancherAPINodeGetID(d *schema.ResourceData, meta interface{}) (err error)

func (*Rancher2Node) RancherAPINodeGetLabels added in v1.8.0

func (node *Rancher2Node) RancherAPINodeGetLabels() (labels map[string]string, err error)

func (*Rancher2Node) RancherAPINodeGetTaints added in v1.8.0

func (node *Rancher2Node) RancherAPINodeGetTaints() (taints []rancherManagementClient.Taint, err error)

func (*Rancher2Node) RancherAPINodeSetAnnotationsLabelsTaints added in v1.8.0

func (node *Rancher2Node) RancherAPINodeSetAnnotationsLabelsTaints() (err error)

func (*Rancher2Node) RancherAPINodeUncordon added in v1.8.0

func (node *Rancher2Node) RancherAPINodeUncordon() (err error)

func (*Rancher2Node) RancherAPINodeUpdateLabels added in v1.8.0

func (node *Rancher2Node) RancherAPINodeUpdateLabels(oldLabels map[string]interface{}, newLabels map[string]interface{}) (err error)

func (*Rancher2Node) RancherAPINodeUpdateTaints added in v1.8.0

func (node *Rancher2Node) RancherAPINodeUpdateTaints(oldTaints []interface{}, newTaints []interface{}) (err error)

func (*Rancher2Node) RancherAPINodeWaitForGracePeriod added in v1.8.0

func (node *Rancher2Node) RancherAPINodeWaitForGracePeriod(timeout int) (err error)

func (*Rancher2Node) RancherAPINodeWaitForState added in v1.8.0

func (node *Rancher2Node) RancherAPINodeWaitForState(state string, timeout int) (err error)

type RancherNode added in v1.8.0

type RancherNode interface {
	RancherAPINodeGetID(d *schema.ResourceData, meta interface{}) error
	RancherAPIClusterWaitForState(state string, timeout int) error
	RancherAPIClusterWaitForTransitioning(timeout int) error
	RancherAPINodeWaitForState(state string, timeout int) error
	RancherAPINodeWaitForGracePeriod(timeout int) error
	RancherAPINodeCordon() error
	RancherAPINodeCordonDrain() error
	RancherAPINodeUncordon() error
	RancherAPINodeDelete() error
	RancherAPINodeSetAnnotationsLabelsTaints() error
	RancherAPINodeGetLabels() (map[string]string, error)
	RancherAPINodeUpdateLabels(oldLabels map[string]interface{}, newLabels map[string]interface{}) error
	RancherAPINodeGetTaints() ([]rancherManagementClient.Taint, error)
	RancherAPINodeUpdateTaints(oldTaints []interface{}, newTaints []interface{}) error
	IsNodeControlPlane() bool
	IsNodeWorker() bool
	IsNodeEtcd() bool
	IsProviderRKE1() bool
	IsProviderRKE2() bool
}

func RancherAPIInitialize added in v1.8.0

func RancherAPIInitialize(d *schema.ResourceData, meta interface{}, nodeConfig *config.NodeConfig, waitForNode bool) (node RancherNode, err error)

type RkeClient added in v1.8.0

type RkeClient struct {
	Management *kubernetes.Clientset
}

RkeClient is RKE client

func (*RkeClient) GetNode added in v1.8.0

func (client *RkeClient) GetNode(nodeIpAddr string) (nodeName string, err error)

GetNode gets RKE node by node IP address

func (*RkeClient) GetNodeRole added in v1.8.0

func (client *RkeClient) GetNodeRole(nodeName string) (controlplane bool, etcd bool, worker bool, err error)

GetNodeRole gets RKE node role

func (*RkeClient) NodeCordon added in v1.8.0

func (client *RkeClient) NodeCordon(nodeName string) (err error)

NodeCordon cordon RKE node

func (*RkeClient) NodeCordonDrain added in v1.8.0

func (client *RkeClient) NodeCordonDrain(nodeName string, nodeDrainInput *rancherManagementClient.NodeDrainInput) (err error)

NodeCordonDrain cordon and drain RKE node

func (*RkeClient) NodeGetLabels added in v1.8.0

func (client *RkeClient) NodeGetLabels(nodeName string) (nodeLabels map[string]string, err error)

NodeGetLabels get RKE node labels

func (*RkeClient) NodeGetTaints added in v1.8.0

func (client *RkeClient) NodeGetTaints(nodeName string) (nodeTaints []v1.Taint, err error)

NodeGetTaints get RKE node taints

func (*RkeClient) NodeSetAnnotationsLabelsTaints added in v1.8.0

func (client *RkeClient) NodeSetAnnotationsLabelsTaints(nodeName string, annotations map[string]string, labels map[string]string, taints []v1.Taint) (err error)

NodeSetAnnotationsLabelsTaints sets Rancher node annotations, labels, and taints

func (*RkeClient) NodeUncordon added in v1.8.0

func (client *RkeClient) NodeUncordon(nodeName string) (err error)

NodeUncordon uncordon RKE node

func (*RkeClient) NodeUpdateLabels added in v1.8.0

func (client *RkeClient) NodeUpdateLabels(nodeName string, oldLabels map[string]interface{}, newLabels map[string]interface{}) (err error)

NodeUpdateLabels updates RKE node labels

func (*RkeClient) NodeUpdateTaints added in v1.8.0

func (client *RkeClient) NodeUpdateTaints(nodeName string, oldTaints []interface{}, newTaints []interface{}) (err error)

NodeUpdateTaints updates RKE node taints

type RkeNode added in v1.8.0

type RkeNode struct {
	RancherClient    *RkeClient
	NodeConfig       *config.NodeConfig
	NodeDrainInput   *rancherManagementClient.NodeDrainInput
	ClusterID        string
	NodeID           string
	NodeControlPlane bool
	NodeEtcd         bool
	NodeWorker       bool
}

RkeNode is Rancher RKE node definition

func RkeAPIInitialize added in v1.8.0

func RkeAPIInitialize(d *schema.ResourceData, meta interface{}, nodeConfig *config.NodeConfig, waitForNode bool) (node *RkeNode, err error)

func (*RkeNode) IsNodeControlPlane added in v1.8.0

func (node *RkeNode) IsNodeControlPlane() bool

func (*RkeNode) IsNodeEtcd added in v1.8.0

func (node *RkeNode) IsNodeEtcd() bool

func (*RkeNode) IsNodeWorker added in v1.8.0

func (node *RkeNode) IsNodeWorker() bool

func (*RkeNode) IsProviderRKE1 added in v1.8.4

func (node *RkeNode) IsProviderRKE1() bool

func (*RkeNode) IsProviderRKE2 added in v1.8.4

func (node *RkeNode) IsProviderRKE2() bool

func (*RkeNode) RancherAPIClusterWaitForState added in v1.8.0

func (node *RkeNode) RancherAPIClusterWaitForState(state string, timeout int) (err error)

func (*RkeNode) RancherAPIClusterWaitForTransitioning added in v1.8.0

func (node *RkeNode) RancherAPIClusterWaitForTransitioning(timeout int) (err error)

func (*RkeNode) RancherAPINodeCordon added in v1.8.0

func (node *RkeNode) RancherAPINodeCordon() (err error)

func (*RkeNode) RancherAPINodeCordonDrain added in v1.8.0

func (node *RkeNode) RancherAPINodeCordonDrain() (err error)

func (*RkeNode) RancherAPINodeDelete added in v1.8.0

func (node *RkeNode) RancherAPINodeDelete() (err error)

func (*RkeNode) RancherAPINodeGetID added in v1.8.0

func (node *RkeNode) RancherAPINodeGetID(d *schema.ResourceData, meta interface{}) (err error)

func (*RkeNode) RancherAPINodeGetLabels added in v1.8.0

func (node *RkeNode) RancherAPINodeGetLabels() (labels map[string]string, err error)

func (*RkeNode) RancherAPINodeGetTaints added in v1.8.0

func (node *RkeNode) RancherAPINodeGetTaints() (taints []rancherManagementClient.Taint, err error)

func (*RkeNode) RancherAPINodeSetAnnotationsLabelsTaints added in v1.8.0

func (node *RkeNode) RancherAPINodeSetAnnotationsLabelsTaints() (err error)

func (*RkeNode) RancherAPINodeUncordon added in v1.8.0

func (node *RkeNode) RancherAPINodeUncordon() (err error)

func (*RkeNode) RancherAPINodeUpdateLabels added in v1.8.0

func (node *RkeNode) RancherAPINodeUpdateLabels(oldLabels map[string]interface{}, newLabels map[string]interface{}) (err error)

func (*RkeNode) RancherAPINodeUpdateTaints added in v1.8.0

func (node *RkeNode) RancherAPINodeUpdateTaints(oldTaints []interface{}, newTaints []interface{}) (err error)

func (*RkeNode) RancherAPINodeWaitForGracePeriod added in v1.8.0

func (node *RkeNode) RancherAPINodeWaitForGracePeriod(timeout int) (err error)

func (*RkeNode) RancherAPINodeWaitForState added in v1.8.0

func (node *RkeNode) RancherAPINodeWaitForState(state string, timeout int) (err error)

Jump to

Keyboard shortcuts

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