hostinfo

package
v0.0.0-...-3e0bdff Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package hostinfo provides functions to get annotations, labels, etc. from Kubernetes nodes.

Index

Constants

View Source
const (
	// NormalizedRoleLabel is original Kubernetes label for role, we normalize the new one to this one
	NormalizedRoleLabel string = "kubernetes.io/role"
)

Variables

This section is empty.

Functions

func LabelPreprocessor

func LabelPreprocessor(labelName string, labelValue string) (string, string)

LabelPreprocessor ensure different role labels are parsed correctly

Types

type KubeNodeTagsProvider

type KubeNodeTagsProvider struct{}

KubeNodeTagsProvider allows computing node tags based on the user configurations for node labels and annotations as tags

func NewKubeNodeTagsProvider

func NewKubeNodeTagsProvider(_ model.Reader) KubeNodeTagsProvider

NewKubeNodeTagsProvider creates and returns a new kube node tags provider object

func (KubeNodeTagsProvider) GetTags

func (k KubeNodeTagsProvider) GetTags(_ context.Context) ([]string, error)

GetTags gets the tags from the kubernetes apiserver

type NodeInfo

type NodeInfo struct {
}

NodeInfo is use to get Kubernetes Node metadata information

func NewNodeInfo

func NewNodeInfo() (*NodeInfo, error)

NewNodeInfo return a new NodeInfo instance return an error if it fails to access the kubelet client.

func (*NodeInfo) GetNodeClusterNameLabel

func (n *NodeInfo) GetNodeClusterNameLabel(ctx context.Context, clusterName string) (string, error)

GetNodeClusterNameLabel returns clustername by fetching a node label

func (*NodeInfo) GetNodeLabels

func (n *NodeInfo) GetNodeLabels(_ context.Context) (map[string]string, error)

GetNodeLabels returns node labels for this host

Jump to

Keyboard shortcuts

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