Documentation ¶
Index ¶
- func DeletePod(podName, podNamespace, kubeconfigPath string, opts *metav1.DeleteOptions) error
- func DeletePodWithCheck(podName, podNamespace, kubeconfigPath string, opts *metav1.DeleteOptions) error
- func GetLog(podName, podNamespace, kubeconfigPath string) (string, error)
- func GetPodCommands(pod *corev1.Pod) []string
- func GetPodImages(pod *corev1.Pod) []string
- func GetPods(podNamespace, kubeconfigPath string, opts *metav1.ListOptions) (*corev1.PodList, error)
- func IsCompleted(pod *corev1.Pod) bool
- type Client
- func (c *Client) AddAnnotation(pod *corev1.Pod, key, value string) (*corev1.Pod, error)
- func (c *Client) AddPodLabel(pod *corev1.Pod, key string, value string) (*corev1.Pod, error)
- func (c *Client) DeletePod(namespace, podName string, opts *metav1.DeleteOptions) error
- func (c *Client) DeletePodWithCheck(namespace, podName string, opts *metav1.DeleteOptions) error
- func (c *Client) GetEvents(namespace, podName string, opts *metav1.ListOptions) (*corev1.EventList, error)
- func (c *Client) GetLogString(namespace, podName string, opts *corev1.PodLogOptions) (string, error)
- func (c *Client) GetPod(namespace, podName string, opts *metav1.GetOptions) (*corev1.Pod, error)
- func (c *Client) GetPods(namespace string, opts *metav1.ListOptions) (*corev1.PodList, error)
- func (c *Client) GetVersion() schema.GroupVersion
- func (c *Client) IsExist(namespace, podName string) (bool, error)
- func (c *Client) UpdatePod(pod *corev1.Pod, namespace string) (*corev1.Pod, error)
- func (c *Client) WaitForDeletion(namespace, podName string, period *int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletePod ¶
func DeletePod(podName, podNamespace, kubeconfigPath string, opts *metav1.DeleteOptions) error
DeletePod deletes Pod. It accepts Pod name, namespace and delete options.
func DeletePodWithCheck ¶
func DeletePodWithCheck(podName, podNamespace, kubeconfigPath string, opts *metav1.DeleteOptions) error
DeletePodWithCheck delets Pod and starts a goroutine in background to check the delete operation.
func GetLog ¶
GetLog returns Pod's log in string. This method is the wrapper of kube client creation and GetLogString.
func GetPodCommands ¶
GetPodCommands returns all container commands for the given Pod in a string array.
func GetPodImages ¶
GetPodImages returns all contariner images for the given Pod in a string array.
func IsCompleted ¶
IsCompleted retruns true if for each contaniner of the pod, its State is Terminated and Reason is Completed. Although Pod is in Succeeded status, it sometimes doesn't mean all containers were run as expected. For example, container may be end by OOMKilled but its Status is Succeeded and the container's State is Terminated.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client helps talk to Kubernetes objects.
func New ¶
New returns a pointer to Client object. If neither masterUrl or kubeconfigPath are passed in we fallback to inClusterConfig. If inClusterConfig fails, we fallback to the default config.
func (*Client) AddAnnotation ¶
AddAnnotation adds a new key-value pair into Pod annotation field.
func (*Client) AddPodLabel ¶
AddPodLabel adds a label field into Pod. If the key already exists, it'll overwrite it.
func (*Client) DeletePod ¶
func (c *Client) DeletePod(namespace, podName string, opts *metav1.DeleteOptions) error
DeletePod talks to Kubernetes to delete a Pod by given delete options.
func (*Client) DeletePodWithCheck ¶
func (c *Client) DeletePodWithCheck(namespace, podName string, opts *metav1.DeleteOptions) error
DeletePodWithCheck deletes the Pod and will start a goroutine in background to confirm whether the Pod is successfully deleted.
func (*Client) GetEvents ¶
func (c *Client) GetEvents(namespace, podName string, opts *metav1.ListOptions) (*corev1.EventList, error)
GetEvents returns a EventList object for the given Pod name and list options.
func (*Client) GetLogString ¶
func (c *Client) GetLogString(namespace, podName string, opts *corev1.PodLogOptions) (string, error)
GetLogString returns the log of Pod in string.
func (*Client) GetVersion ¶
func (c *Client) GetVersion() schema.GroupVersion
GetVersion returns the version of the the current REST client