apihelper

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHelpers

type APIHelpers interface {
	// GetClient returns a client
	GetClient() (*k8sclient.Clientset, error)

	// GetNode returns the Kubernetes node on which this container is running.
	GetNode(*k8sclient.Clientset, string) (*api.Node, error)

	// GetNodes returns all the nodes in the cluster
	GetNodes(*k8sclient.Clientset) (*api.NodeList, error)

	// UpdateNode updates the node via the API server using a client.
	UpdateNode(*k8sclient.Clientset, *api.Node) error

	// PatchNode updates the node object via the API server using a client.
	PatchNode(*k8sclient.Clientset, string, []JsonPatch) error

	// PatchNodeStatus updates the node status via the API server using a client.
	PatchNodeStatus(*k8sclient.Clientset, string, []JsonPatch) error
}

APIHelpers represents a set of API helpers for Kubernetes

type JsonPatch added in v0.7.0

type JsonPatch struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value,omitempty"`
}

JsonPatch is a json marshaling helper used for patching API objects

func NewJsonPatch added in v0.7.0

func NewJsonPatch(verb string, path string, key string, value string) JsonPatch

NewJsonPatch returns a new JsonPatch object

type K8sHelpers

type K8sHelpers struct {
	Kubeconfig string
}

Implements APIHelpers

func (K8sHelpers) GetClient

func (h K8sHelpers) GetClient() (*k8sclient.Clientset, error)

func (K8sHelpers) GetNode

func (h K8sHelpers) GetNode(cli *k8sclient.Clientset, nodeName string) (*api.Node, error)

func (K8sHelpers) GetNodes added in v0.7.0

func (h K8sHelpers) GetNodes(cli *k8sclient.Clientset) (*api.NodeList, error)

func (K8sHelpers) PatchNode added in v0.7.0

func (h K8sHelpers) PatchNode(c *k8sclient.Clientset, nodeName string, patches []JsonPatch) error

func (K8sHelpers) PatchNodeStatus added in v0.7.0

func (h K8sHelpers) PatchNodeStatus(c *k8sclient.Clientset, nodeName string, patches []JsonPatch) error

func (K8sHelpers) UpdateNode

func (h K8sHelpers) UpdateNode(c *k8sclient.Clientset, n *api.Node) error

type MockAPIHelpers

type MockAPIHelpers struct {
	mock.Mock
}

MockAPIHelpers is an autogenerated mock type for the APIHelpers type

func (*MockAPIHelpers) GetClient

func (_m *MockAPIHelpers) GetClient() (*kubernetes.Clientset, error)

GetClient provides a mock function with given fields:

func (*MockAPIHelpers) GetNode

func (_m *MockAPIHelpers) GetNode(_a0 *kubernetes.Clientset, _a1 string) (*v1.Node, error)

GetNode provides a mock function with given fields: _a0, _a1

func (*MockAPIHelpers) GetNodes added in v0.7.0

func (_m *MockAPIHelpers) GetNodes(_a0 *kubernetes.Clientset) (*v1.NodeList, error)

GetNodes provides a mock function with given fields: _a0

func (*MockAPIHelpers) PatchNode added in v0.7.0

func (_m *MockAPIHelpers) PatchNode(_a0 *kubernetes.Clientset, _a1 string, _a2 []JsonPatch) error

PatchNode provides a mock function with given fields: _a0, _a1, _a2

func (*MockAPIHelpers) PatchNodeStatus added in v0.7.0

func (_m *MockAPIHelpers) PatchNodeStatus(_a0 *kubernetes.Clientset, _a1 string, _a2 []JsonPatch) error

PatchNodeStatus provides a mock function with given fields: _a0, _a1, _a2

func (*MockAPIHelpers) UpdateNode

func (_m *MockAPIHelpers) UpdateNode(_a0 *kubernetes.Clientset, _a1 *v1.Node) error

UpdateNode provides a mock function with given fields: _a0, _a1

Jump to

Keyboard shortcuts

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