kube

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package kube is a backend implementation that uses the Tinkerbell CRDs to get DHCP data.

Index

Constants

View Source
const IPAddrIndex = ".Spec.Interfaces.DHCP.IP"

IPAddrIndex is an index used with a controller-runtime client to lookup hardware by IP.

View Source
const MACAddrIndex = ".Spec.Interfaces.MAC"

MACAddrIndex is an index used with a controller-runtime client to lookup hardware by MAC.

Variables

This section is empty.

Functions

func GetIPs

func GetIPs(h *v1alpha1.Hardware) []string

GetIPs retrieves all IP addresses.

func GetMACs

func GetMACs(h *v1alpha1.Hardware) []string

GetMACs retrieves all MACs associated with h.

func IPAddrs

func IPAddrs(obj client.Object) []string

IPAddrs returns a list of IP addresses for a Hardware object.

func MACAddrs

func MACAddrs(obj client.Object) []string

MACAddrs returns a list of MAC addresses for a Hardware object.

Types

type Backend

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

Backend is a backend implementation that uses the Tinkerbell CRDs to get DHCP data.

func NewBackend

func NewBackend(conf *rest.Config, opts ...cluster.Option) (*Backend, error)

NewBackend returns a controller-runtime cluster.Cluster with the Tinkerbell runtime scheme registered, and indexers for: * Hardware by MAC address * Hardware by IP address

Callers must instantiate the client-side cache by calling Start() before use.

func (*Backend) GetByIP

func (b *Backend) GetByIP(ctx context.Context, ip net.IP) (*data.DHCP, *data.Netboot, error)

GetByIP implements the handler.BackendReader interface and returns DHCP and netboot data based on an IP address.

func (*Backend) GetByMac

func (b *Backend) GetByMac(ctx context.Context, mac net.HardwareAddr) (*data.DHCP, *data.Netboot, error)

GetByMac implements the handler.BackendReader interface and returns DHCP and netboot data based on a mac address.

func (*Backend) RegisterHw

func (b *Backend) RegisterHw(ctx context.Context, hwObject v1alpha1.Hardware) error

RegisterHw implements the handler.BackendReader interface and returns DHCP and netboot data based on an IP address.

func (*Backend) Start

func (b *Backend) Start(ctx context.Context) error

Start starts the client-side cache.

Jump to

Keyboard shortcuts

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