k8s

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamPodLogs

func StreamPodLogs(ctx context.Context, kubeconfig, namespace, podName, container string, tailLines int64, opts ...ClientOption) (io.ReadCloser, error)

Types

type ClientOption

type ClientOption func(*clientOptions)

func WithContext

func WithContext(contextName string) ClientOption

func WithDial

func WithDial(dial func(ctx context.Context, network, address string) (net.Conn, error)) ClientOption

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

type ClusterInfo

type ClusterInfo struct {
	Version    string          `json:"version"`
	Platform   string          `json:"platform"`
	Nodes      []NodeInfo      `json:"nodes"`
	Namespaces []NamespaceInfo `json:"namespaces"`
}

func GetClusterInfo

func GetClusterInfo(ctx context.Context, kubeconfig string, opts ...ClientOption) (*ClusterInfo, error)

type ConditionDetail

type ConditionDetail struct {
	Type    string `json:"type"`
	Status  string `json:"status"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

type ConfigMapListItem

type ConfigMapListItem struct {
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
	Data      map[string]string `json:"data"`
	Age       string            `json:"age"`
}

func GetNamespaceConfigMaps

func GetNamespaceConfigMaps(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) ([]ConfigMapListItem, error)

type ContainerDetail

type ContainerDetail struct {
	Name         string `json:"name"`
	Image        string `json:"image"`
	State        string `json:"state"`
	Ready        bool   `json:"ready"`
	RestartCount int32  `json:"restart_count"`
}

type DeploymentListItem

type DeploymentListItem struct {
	Name      string        `json:"name"`
	Namespace string        `json:"namespace"`
	Ready     string        `json:"ready"`
	UpToDate  int32         `json:"up_to_date"`
	Available int32         `json:"available"`
	Age       string        `json:"age"`
	Pods      []PodListItem `json:"pods"`
}

func GetNamespaceDeployments

func GetNamespaceDeployments(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) ([]DeploymentListItem, error)

type EventDetail

type EventDetail struct {
	Type      string `json:"type"`
	Reason    string `json:"reason"`
	Message   string `json:"message"`
	FirstTime string `json:"first_time"`
	LastTime  string `json:"last_time"`
	Count     int32  `json:"count"`
}

type NamespaceInfo

type NamespaceInfo struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

type NamespaceResources

type NamespaceResources struct {
	Namespace       string `json:"namespace"`
	Pods            int    `json:"pods"`
	Deployments     int    `json:"deployments"`
	Services        int    `json:"services"`
	ConfigMaps      int    `json:"config_maps"`
	Secrets         int    `json:"secrets"`
	PVCs            int    `json:"pvcs"`
	ServiceAccounts int    `json:"service_accounts"`
}

func GetNamespaceResources

func GetNamespaceResources(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) (*NamespaceResources, error)

type NodeInfo

type NodeInfo struct {
	Name    string   `json:"name"`
	Status  string   `json:"status"`
	Roles   []string `json:"roles"`
	Version string   `json:"version"`
	CPU     string   `json:"cpu"`
	Memory  string   `json:"memory"`
	OS      string   `json:"os"`
	Arch    string   `json:"arch"`
}

type PodDetail

type PodDetail struct {
	Name         string            `json:"name"`
	Namespace    string            `json:"namespace"`
	Status       string            `json:"status"`
	NodeName     string            `json:"node_name"`
	PodIP        string            `json:"pod_ip"`
	HostIP       string            `json:"host_ip"`
	CreationTime string            `json:"creation_time"`
	Age          string            `json:"age"`
	Ready        string            `json:"ready"`
	RestartCount int32             `json:"restart_count"`
	QosClass     string            `json:"qos_class"`
	Containers   []ContainerDetail `json:"containers"`
	Conditions   []ConditionDetail `json:"conditions"`
	Events       []EventDetail     `json:"events"`
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	YAML         string            `json:"yaml"`
}

func GetPodDetail

func GetPodDetail(ctx context.Context, kubeconfig, namespace, podName string, opts ...ClientOption) (*PodDetail, error)

type PodListItem

type PodListItem struct {
	Name         string `json:"name"`
	Namespace    string `json:"namespace"`
	Status       string `json:"status"`
	NodeName     string `json:"node_name"`
	PodIP        string `json:"pod_ip"`
	Age          string `json:"age"`
	Ready        string `json:"ready"`
	RestartCount int32  `json:"restart_count"`
}

func GetNamespacePods

func GetNamespacePods(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) ([]PodListItem, error)

type SecretListItem

type SecretListItem struct {
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
	Type      string            `json:"type"`
	Data      map[string]string `json:"data"`
	Age       string            `json:"age"`
}

func GetNamespaceSecrets

func GetNamespaceSecrets(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) ([]SecretListItem, error)

type ServiceListItem

type ServiceListItem struct {
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
	Type      string            `json:"type"`
	ClusterIP string            `json:"cluster_ip"`
	Ports     []ServicePortItem `json:"ports"`
	Age       string            `json:"age"`
}

func GetNamespaceServices

func GetNamespaceServices(ctx context.Context, kubeconfig, namespace string, opts ...ClientOption) ([]ServiceListItem, error)

type ServicePortItem

type ServicePortItem struct {
	Name       string `json:"name"`
	Port       int32  `json:"port"`
	TargetPort string `json:"target_port"`
	NodePort   int32  `json:"node_port"`
	Protocol   string `json:"protocol"`
}

Jump to

Keyboard shortcuts

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