kubeconfig

package
v0.0.0-...-351f9be Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileFromPod

func CopyFileFromPod(restConfig *restclient.Config, clientConfig clientcmd.ClientConfig, podName, namespace, filename, dest string) error

CopyFileFromPod is function that copies files from a pod. The parameter takes the kubeconfig in form of a restclient.Config object, the pod name, the namespace of the pod, the filename, and then the local destination (dest) where the file will be copied to.

func GetContexts

func GetContexts(clientConfig *clientcmd.ClientConfig) (map[string]*api.Context, error)

GetContexts is a helper function that lists the contexts of a kubeconfig

func GetKubeconfig

func GetKubeconfig(client *rancher.Client, clusterID string) (*clientcmd.ClientConfig, error)

GetKubeconfig generates a kubeconfig froma specific cluster, and returns it in the form of a *clientcmd.ClientConfig

func GetPodLogs

func GetPodLogs(client *rancher.Client, clusterID string, podName string, namespace string, bufferSizeStr string) (string, error)

GetPodLogs fetches logs from a Kubernetes pod. Buffer size (e.g., '64KB', '8MB', '1GB') influences log reading; an empty string causes no buffering.

Types

type LogStreamer

type LogStreamer struct {
	// contains filtered or unexported fields
}

LogStreamer is a struct that acts like io.Writer inorder to retrieve Stdout from a kubectl exec command in pod

func KubectlExec

func KubectlExec(restConfig *restclient.Config, podName, namespace string, command []string) (*LogStreamer, error)

KubectlExec is function that runs `kubectl exec` in a specified pod of a cluster. The function takes the kubeconfig in form of a restclient.Config object, the pod name, the namespace of the pod, and the command a user wants to run.

func (*LogStreamer) String

func (l *LogStreamer) String() string

String stringer for the LogStreamer

func (*LogStreamer) Write

func (l *LogStreamer) Write(p []byte) (n int, err error)

Write is function that writes to the underlying bytes.Buffer

type RestGetter

type RestGetter struct {
	genericclioptions.RESTClientGetter
	// contains filtered or unexported fields
}

func NewRestGetter

func NewRestGetter(restConfig *rest.Config, clientConfig clientcmd.ClientConfig) (*RestGetter, error)

func (*RestGetter) ToDiscoveryClient

func (r *RestGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient returns a cached discovery client.

func (*RestGetter) ToRESTConfig

func (r *RestGetter) ToRESTConfig() (*rest.Config, error)

ToRESTConfig returns restconfig

func (*RestGetter) ToRESTMapper

func (r *RestGetter) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper returns a RESTMapper.

func (*RestGetter) ToRawKubeConfigLoader

func (r *RestGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader return kubeconfig loader as-is

Jump to

Keyboard shortcuts

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