Documentation
¶
Index ¶
- Variables
- func ApplyPodFilter(pods []corev1.Pod, filters ...PodFilterFn) (result []corev1.Pod)
- func GetNamespaceNames(namespaces []corev1.Namespace) (result []string)
- func GetPod(ctx context.Context, client *kubernetes.Clientset, namespace, name string) (*corev1.Pod, error)
- func GetPodNameFromArgs(args []string) (string, error)
- func ListNamespaces(ctx context.Context, client *kubernetes.Clientset) ([]corev1.Namespace, error)
- func ListPods(ctx context.Context, client *kubernetes.Clientset, namespace string, ...) ([]corev1.Pod, error)
- func MinifyPod(pod *corev1.Pod) *corev1.Pod
- func NewClientset(kubeConfig *KubeConfig) (*kubernetes.Clientset, error)
- func SanitizeEditedPod(original, edited *corev1.Pod) (*corev1.Pod, error)
- func UpdateEphemeralContainersForPod(ctx context.Context, client *kubernetes.Clientset, pod *corev1.Pod) (*corev1.Pod, error)
- type ContextOptions
- type KubeConfig
- type PodFilterFn
Constants ¶
This section is empty.
Variables ¶
var (
NAMESPACE_DEFAULT string = "default"
)
Functions ¶
func ApplyPodFilter ¶
func ApplyPodFilter(pods []corev1.Pod, filters ...PodFilterFn) (result []corev1.Pod)
Apply filters (if any) to a list of pods
func GetNamespaceNames ¶ added in v1.0.0
Get names from a list of namespaces
func GetPod ¶
func GetPod(ctx context.Context, client *kubernetes.Clientset, namespace, name string) (*corev1.Pod, error)
Get pod by name in a specific namespace
func GetPodNameFromArgs ¶
Get pod name from CLI arguments
func ListNamespaces ¶ added in v1.0.0
List available namespaces in the cluster
func ListPods ¶
func ListPods(ctx context.Context, client *kubernetes.Clientset, namespace string, filters ...PodFilterFn) ([]corev1.Pod, error)
List pods by filters in the specified namespace If namespace is empty (i.e. ""), list in all namespaces
func NewClientset ¶
func NewClientset(kubeConfig *KubeConfig) (*kubernetes.Clientset, error)
Get a clientset to interact with Kubernetes API Config precedence: * --kubeconfig flag pointing at a file * KUBECONFIG environment variable pointing at a file * $HOME/.kube/config if exists.
func SanitizeEditedPod ¶
Validate the pod struct from edited manifests
Types ¶
type ContextOptions ¶
Represent context with a cancel func
func (*ContextOptions) Init ¶
func (opts *ContextOptions) Init(timeout *string) error
Set up the options with the following steps: * Create a Context with timeout if any. Otherwise, no timeout is set (i.e. context.Background()) * Create a chan os.Signal to handle SIGTERM, SIGINT (Ctrl + C),SIGHUP (terminal is closed)
type KubeConfig ¶
type KubeConfig struct { *genericclioptions.ConfigFlags ContextOptions *ContextOptions }
Represent kube client configurations
func NewKubeConfig ¶
func NewKubeConfig(configFlags *genericclioptions.ConfigFlags) *KubeConfig
Get a new KubeConfig struct