internal

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	// The name of the CNI network attached to.
	Name string `json:"name"`

	// The name of the network interface in the pod.
	Interface string `json:"interface"`

	// IPs and MAC assigned by CNI to the interface.
	IPs []string `json:"ips"`
	MAC string   `json:"mac"`

	Default bool `json:"default"`

	DNS cnitypes.DNS `json:"dns"`
}

func GetAttachments

func GetAttachments() ([]Attachment, error)

Gets the networks this pod is attached to. Expects that the `metadata.annotations['k8s.v1.cni.cncf.io/networks-status']` fieldPath is exposed to this container via the downward API [1] at `/etc/podinfo/attachments`.

[1] https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/

type CNIClient

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

Wrapper around the CNI CRD k8s API.

func NewCNIClient

func NewCNIClient(cfg *rest.Config) (*CNIClient, error)

func (*CNIClient) Get

func (c *CNIClient) Get(ctx context.Context, netName string) (*NetworkDefinition, error)

Gets a NetworkDefinition by its name, where netName is "namespace/net" or just "net" in the current namespace.

type NetworkDefinition

type NetworkDefinition struct {
	Ranges []Range
}

type Range

type Range struct {
	Gateway net.IP
	Subnet  net.IPNet
}

Jump to

Keyboard shortcuts

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