input

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object map[string]interface{}

Object is the JSON compatible map[string]interface{} mostly used through unstructured.Unstructured.

func (Object) Unstructured

func (u Object) Unstructured() *unstructured.Unstructured

type Objects

type Objects []Object

func (Objects) Len

func (u Objects) Len() int

func (Objects) Less

func (u Objects) Less(i, j int) bool

func (Objects) Swap

func (u Objects) Swap(i, j int)

type ResourceRepo

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

func NewResourceRepo

func NewResourceRepo(factory util.Factory) (*ResourceRepo, error)

func (*ResourceRepo) AllNamespacesPodMetrics added in v0.7.19

func (r *ResourceRepo) AllNamespacesPodMetrics() (Objects, error)

AllNamespacesPodMetrics attempts a single cluster-wide list of PodMetrics (across every namespace), so that a render touching many namespaces/nodes only needs one metrics.k8s.io request instead of one per namespace. The attempt, and its outcome, is cached for the whole render (including across multiple nodes in the same query) so callers never retry it. If the cluster-wide list is denied (e.g. RBAC only grants namespace-scoped access), a warning is printed once and callers should fall back to per-namespace fetches, which may in turn be incomplete for namespaces the user also can't access.

func (*ResourceRepo) CLIQueryResults

func (r *ResourceRepo) CLIQueryResults(args []string) *resource.Result

func (*ResourceRepo) DynamicObject

func (r *ResourceRepo) DynamicObject(gvr schema.GroupVersionResource, namespace string, name string) (Object, error)

func (*ResourceRepo) EndpointSlices added in v0.7.15

func (r *ResourceRepo) EndpointSlices(namespace string) (*discoveryv1.EndpointSliceList, error)

func (*ResourceRepo) FirstObject

func (r *ResourceRepo) FirstObject(namespace string, args []string, labelSelector string) (Object, error)

func (*ResourceRepo) GVRFor

func (r *ResourceRepo) GVRFor(resourceOrKindArg string) (schema.GroupVersionResource, error)

func (*ResourceRepo) Ingresses

func (r *ResourceRepo) Ingresses(namespace string) (*netv1.IngressList, error)

func (*ResourceRepo) KubeGetNodeStatsSummary

func (r *ResourceRepo) KubeGetNodeStatsSummary(nodeName string) (Object, error)

KubeGetNodeStatsSummary returns this structure > kubectl get --raw /api/v1/nodes/{nodeName}/proxy/stats/summary The endpoint that this function uses will be disabled soon: https://github.com/kubernetes/kubernetes/issues/68522

func (*ResourceRepo) MetricsUnavailableReason added in v0.7.19

func (r *ResourceRepo) MetricsUnavailableReason() string

MetricsUnavailableReason reports why the metrics.k8s.io API (served by metrics-server) can't be used, or "" if it's healthy. It checks the APIService's Available condition directly -- the same signal `kubectl top` relies on to report "Metrics API not available" -- rather than a RESTMapper/discovery-based check, since discovery listings may still show a stale/cached group version while the backing service is down. This distinguishes two different problems a caller should word differently:

  • the APIService object doesn't exist at all: metrics-server was never installed.
  • the APIService exists but its Available condition is False: metrics-server is installed but currently unhealthy (e.g. crashed, unreachable); the condition's own message/reason is surfaced since it usually names the concrete problem (e.g. "no endpoints available").

The result is cached since Pod/Node rendering checks this repeatedly.

func (*ResourceRepo) NonTerminatedPodsOnTheNode

func (r *ResourceRepo) NonTerminatedPodsOnTheNode(nodeName string) (Objects, error)

func (*ResourceRepo) ObjectEvents

func (r *ResourceRepo) ObjectEvents(u *unstructured.Unstructured) (*corev1.EventList, error)

func (*ResourceRepo) Objects

func (r *ResourceRepo) Objects(namespace string, args []string, labelSelector string) (Objects, error)

func (*ResourceRepo) Owners

func (r *ResourceRepo) Owners(obj Object) (owners Objects, orphans []metav1.OwnerReference, err error)

Owners resolves the ownerReferences of obj to the objects they point at. References whose owner no longer exists are reported back as orphans, so callers can warn about them, rather than being silently dropped. Owners that can't be resolved for other reasons (e.g. missing permissions, unknown kind) are silently skipped, since that's not evidence the owner is gone.

func (*ResourceRepo) PodContainerLogs added in v0.7.19

func (r *ResourceRepo) PodContainerLogs(namespace, podName, containerName string, previous bool, tailLines int64) (string, error)

PodContainerLogs returns up to tailLines lines of log output for the named container in the named pod. When previous is true it fetches logs from the container's previous (terminated) instance, equivalent to `kubectl logs --previous`.

func (*ResourceRepo) Service

func (r *ResourceRepo) Service(namespace, name string) (*corev1.Service, error)

func (*ResourceRepo) Services

func (r *ResourceRepo) Services(namespace string) (*corev1.ServiceList, error)

Jump to

Keyboard shortcuts

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