client

package
v0.0.0-...-690846a Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultDir is the default path for the token and certificate
	// files.
	DefaultDir = "/var/run/secrets/kubernetes.io/serviceaccount/"
	// DefaultTokenFile is the default file with the bearer token used
	// in requests to the Kubernetes API server.
	DefaultTokenFile = DefaultDir + "token"
	// DefaultCAFile is the default root certificate used by requests
	// with a bearer token, sent to the Kubernetes API Server.
	DefaultCAFile = DefaultDir + "ca.crt"
)
View Source
const (
	// DefaultAWSRegion is the default Region used by the AWS client.
	DefaultAWSRegion = "eu-central-1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWS

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

AWS executes HTTP requests to the AWS API.

func NewAWSClient

func NewAWSClient(region string) (*AWS, error)

NewAWSClient creates a new client targeted to the specified region of the current AWS account.

func (*AWS) GetInstancesToRetire

func (c *AWS) GetInstancesToRetire() ([]string, error)

GetInstancesToRetire returns the list of EC2 instances with scheduled events.

type Kubernetes

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

Kubernetes executes HTTP requests to the Kubernetes API Server.

func NewKubernetesClient

func NewKubernetesClient(k8sURL, caFile, tokenFile string) (
	*Kubernetes,
	error,
)

NewKubernetesClient creates a new HTTP client pointing to the Kubernetes API server specified by k8sURL.

func (*Kubernetes) GetMatchingNodes

func (c *Kubernetes) GetMatchingNodes(
	instNames []string,
	labelFilter map[string]string,
) ([]string, error)

GetMatchingNodes returns the nodes from the cluster matching the specified instance list.

If labelFilter is set, only nodes with the specified labels are matched.

func (*Kubernetes) LabelNode

func (c *Kubernetes) LabelNode(node, key, value string, dryRun bool) error

LabelNode labels the specified node with the provided key/value pair.

No labelling is done if dryRun is set.

type Metadata

type Metadata struct {
	Name   string            `json:"name,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
}

Metadata contains the node's name and labels.

type Node

type Node struct {
	Metadata Metadata `json:"metadata"`
}

Node contains the metadata information of a node. nodes.

type NodeList

type NodeList struct {
	Items []Node `json:"items"`
}

NodeList holds the data returned when requesting the list of nodes for a cluster.

Jump to

Keyboard shortcuts

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