Documentation ¶
Index ¶
- func GetKubeconfig(path string) (*restclient.Config, error)
- type APIHelpers
- type JsonPatch
- type K8sHelpers
- func (h K8sHelpers) GetClient() (*k8sclient.Clientset, error)
- func (h K8sHelpers) GetNode(cli *k8sclient.Clientset, nodeName string) (*corev1.Node, error)
- func (h K8sHelpers) GetNodes(cli *k8sclient.Clientset) (*corev1.NodeList, error)
- func (h K8sHelpers) GetPod(cli *k8sclient.Clientset, namespace string, podName string) (*corev1.Pod, error)
- func (h K8sHelpers) GetTopologyClient() (*topologyclientset.Clientset, error)
- func (h K8sHelpers) PatchNode(c *k8sclient.Clientset, nodeName string, patches []JsonPatch) error
- func (h K8sHelpers) PatchNodeStatus(c *k8sclient.Clientset, nodeName string, patches []JsonPatch) error
- func (h K8sHelpers) UpdateNode(c *k8sclient.Clientset, n *corev1.Node) error
- type MockAPIHelpers
- func (_m *MockAPIHelpers) GetClient() (*kubernetes.Clientset, error)
- func (_m *MockAPIHelpers) GetNode(_a0 *kubernetes.Clientset, _a1 string) (*v1.Node, error)
- func (_m *MockAPIHelpers) GetNodes(_a0 *kubernetes.Clientset) (*v1.NodeList, error)
- func (_m *MockAPIHelpers) GetPod(_a0 *kubernetes.Clientset, _a1 string, _a2 string) (*v1.Pod, error)
- func (_m *MockAPIHelpers) GetTopologyClient() (*versioned.Clientset, error)
- func (_m *MockAPIHelpers) PatchNode(_a0 *kubernetes.Clientset, _a1 string, _a2 []JsonPatch) error
- func (_m *MockAPIHelpers) PatchNodeStatus(_a0 *kubernetes.Clientset, _a1 string, _a2 []JsonPatch) error
- func (_m *MockAPIHelpers) UpdateNode(_a0 *kubernetes.Clientset, _a1 *v1.Node) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKubeconfig ¶ added in v0.10.0
func GetKubeconfig(path string) (*restclient.Config, error)
GetKubeconfig returns the kubeconfig for the cluster
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) (*corev1.Node, error) // GetNodes returns all the nodes in the cluster GetNodes(*k8sclient.Clientset) (*corev1.NodeList, error) // UpdateNode updates the node via the API server using a client. UpdateNode(*k8sclient.Clientset, *corev1.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 // GetTopologyClient returns a topologyclientset GetTopologyClient() (*topologyclientset.Clientset, error) // GetPod returns the Kubernetes pod in a namepace with a name. GetPod(*k8sclient.Clientset, string, string) (*corev1.Pod, 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
type K8sHelpers ¶
type K8sHelpers struct {
Kubeconfig *restclient.Config
}
K8sHelpers implements APIHelpers
func (K8sHelpers) GetClient ¶
func (h K8sHelpers) GetClient() (*k8sclient.Clientset, error)
GetClient creates and returns a new clientset from given config
func (K8sHelpers) GetTopologyClient ¶ added in v0.10.0
func (h K8sHelpers) GetTopologyClient() (*topologyclientset.Clientset, error)
func (K8sHelpers) PatchNodeStatus ¶ added in v0.7.0
func (K8sHelpers) UpdateNode ¶
UpdateNode sends updated node object to the apiserver
type MockAPIHelpers ¶
MockAPIHelpers is an autogenerated mock type for the APIHelpers type
func NewMockAPIHelpers ¶ added in v0.12.0
func NewMockAPIHelpers(t interface { mock.TestingT Cleanup(func()) }) *MockAPIHelpers
NewMockAPIHelpers creates a new instance of MockAPIHelpers. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
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) GetPod ¶ added in v0.10.0
func (_m *MockAPIHelpers) GetPod(_a0 *kubernetes.Clientset, _a1 string, _a2 string) (*v1.Pod, error)
GetPod provides a mock function with given fields: _a0, _a1, _a2
func (*MockAPIHelpers) GetTopologyClient ¶ added in v0.10.0
func (_m *MockAPIHelpers) GetTopologyClient() (*versioned.Clientset, error)
GetTopologyClient provides a mock function with given fields:
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