kclient

package
v0.0.0-...-8dda575 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeploymentKind       = "Deployment"
	DeploymentAPIVersion = "apps/v1"
)

constants for deployments

Variables

This section is empty.

Functions

func FakeNew

func FakeNew() (*Client, *FakeClientset)

FakeNew creates new fake client for testing returns Client that is filled with fake clients and FakeClientSet that holds fake Clientsets to access Actions, Reactors etc... in fake client

func GenerateContainer

func GenerateContainer(name, image string, isPrivileged bool, command, args []string, envVars []corev1.EnvVar) *corev1.Container

GenerateContainer creates a container spec that can be used when creating a pod

func GenerateDeploymentSpec

func GenerateDeploymentSpec(podTemplateSpec corev1.PodTemplateSpec) *appsv1.DeploymentSpec

GenerateDeploymentSpec creates a deployment spec

func GeneratePodTemplateSpec

func GeneratePodTemplateSpec(podName, namespace, serviceAccountName string, labels map[string]string, containers []corev1.Container) *corev1.PodTemplateSpec

GeneratePodTemplateSpec creates a pod template spec that can be used to create a deployment spec

Types

type Client

type Client struct {
	KubeClient       kubernetes.Interface
	KubeConfig       clientcmd.ClientConfig
	KubeClientConfig *rest.Config
	Namespace        string
}

Client is a collection of fields used for client configuration and interaction

func New

func New() (*Client, error)

New creates a new client

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(name string, deploymentSpec appsv1.DeploymentSpec) (*appsv1.Deployment, error)

CreateDeployment creates a deployment based on the given deployment spec

func (*Client) ExecCMDInContainer

func (c *Client) ExecCMDInContainer(podName, containerName string, cmd []string, stdout io.Writer, stderr io.Writer, stdin io.Reader, tty bool) error

ExecCMDInContainer execute command in the container of a pod, pass an empty string for containerName to execute in the first container of the pod

func (*Client) WaitAndGetPod

func (c *Client) WaitAndGetPod(watchOptions metav1.ListOptions, desiredPhase corev1.PodPhase, waitMessage string) (*corev1.Pod, error)

WaitAndGetPod block and waits until pod matching selector is in the desired phase desiredPhase cannot be PodFailed or PodUnknown

type FakeClientset

type FakeClientset struct {
	Kubernetes *fakeKubeClientset.Clientset
}

FakeClientset holds fake ClientSets this is returned by FakeNew to access methods of fake client sets

Jump to

Keyboard shortcuts

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