cluster

package
v0.0.0-...-696366d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePath

func ParsePath(path string) (namespace string, deployment, pod string, container string, err error)

ParsePath parses path into its components. Input must have the form namespace/deployment/pod/container.

func PodKey

func PodKey(namespace, pod string) string

PodKey returns a unique key based on the namespace and pod name.

Types

type Resources

type Resources struct {
	// Root is the first level in the cluster resource hierarchy.
	// Each level in the hierarchy is a map[string]interface{} to the next level.
	// The levels are: namespaces/deployments/pods/containers.
	Root map[string]any
	// Labels maps a pod name to a map of labels key-values.
	Labels map[string]map[string]string
	// Annotations maps a pod name to a map of annotation key-values.
	Annotations map[string]map[string]string
	// Pod maps a pod name to its Pod info. The key is namespace/pod-name.
	Pod map[string]*corev1.Pod
	// CniPod
	CniPod map[string]*corev1.Pod
}

Resources defines a tree of cluster resource names.

func GetClusterResources

func GetClusterResources(ctx context.Context, clientset *kubernetes.Clientset, config *config2.BugReportConfig) (*Resources, error)

GetClusterResources returns cluster resources for the given REST config and k8s Clientset.

func (*Resources) ContainerRestarts

func (r *Resources) ContainerRestarts(namespace, pod, container string, isCniPod bool) int

ContainerRestarts returns the number of container restarts for the given container.

func (*Resources) IsDiscoveryContainer

func (r *Resources) IsDiscoveryContainer(clusterVersion, namespace, pod, container string) bool

IsDiscoveryContainer reports whether the given container is the Istio discovery container.

func (*Resources) PodIstioVersion

func (r *Resources) PodIstioVersion(namespace, pod string) string

PodIstioVersion returns the Istio version for the given pod, if either the proxy or discovery are one of its containers and the tag is in a parseable format.

func (*Resources) String

func (r *Resources) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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