Documentation
¶
Overview ¶
Package kubernetes provides bounded, read-only access to Kubernetes APIs.
Index ¶
- Constants
- Variables
- func DecodeCAData(value string) ([]byte, error)
- func ParseQuantity(value string) (*big.Rat, error)
- type AuthOptions
- type Change
- type ChangeFieldChange
- type ChangePage
- type ChangeQuery
- type ChangeType
- type Client
- type Condition
- type Config
- type CredentialSource
- type DiagnoseOptions
- type Diagnosis
- type Discovery
- type ErrorDetail
- type EventOptions
- type EventPage
- type GitOpsApp
- type GitOpsAppOptions
- type GitOpsAppPage
- type GraphQuery
- type HelmRelease
- type HelmReleaseOptions
- type HelmReleasePage
- type HelmRevision
- type Issue
- type IssueOptions
- type IssuePage
- type ListOptions
- type MetricsSourceStatus
- type NeighborhoodQuery
- type ObjectRef
- type Overview
- type PartialFailure
- type PodLogStreamEvent
- type PodLogStreamOptions
- type PodLogs
- type ProjectedResource
- type ResourceDefinition
- type ResourceDescription
- type ResourcePage
- type ResourceUsage
- type Rollout
- type RolloutListOptions
- type RolloutPage
- type Scope
- type Scrubber
- type SearchOptions
- type SearchResult
- type Service
- func (service *Service) Changes(ctx context.Context, query ChangeQuery) (ChangePage, error)
- func (service *Service) Describe(ctx context.Context, resourceID, namespace, name string) (ResourceDescription, error)
- func (service *Service) DiagnoseWorkload(ctx context.Context, options DiagnoseOptions) (Diagnosis, error)
- func (service *Service) Discover(ctx context.Context) (Discovery, error)
- func (service *Service) Get(ctx context.Context, resourceID, namespace, name string) (ProjectedResource, error)
- func (service *Service) GetWorkload(ctx context.Context, namespace, kind, name string) (WorkloadDetail, error)
- func (service *Service) GitOpsApps(ctx context.Context, options GitOpsAppOptions) (GitOpsAppPage, error)
- func (service *Service) Graph(ctx context.Context, query GraphQuery) (kubegraph.Graph, error)
- func (service *Service) IndexSnapshot(ctx context.Context, kinds ...string) (kubeindex.Snapshot, kubeindex.Status, error)
- func (service *Service) InvalidateDiscovery()
- func (service *Service) Issues(ctx context.Context, options IssueOptions) (IssuePage, error)
- func (service *Service) List(ctx context.Context, options ListOptions) (ResourcePage, error)
- func (service *Service) ListEvents(ctx context.Context, options EventOptions) (EventPage, error)
- func (service *Service) ListWorkloads(ctx context.Context, namespace, kind string, limit int) (WorkloadPage, error)
- func (service *Service) Neighborhood(ctx context.Context, query NeighborhoodQuery) (kubegraph.Graph, error)
- func (service *Service) Overview(ctx context.Context) (Overview, error)
- func (service *Service) OverviewGraph(ctx context.Context) (kubegraph.Graph, error)
- func (service *Service) PodLogs(ctx context.Context, namespace, pod, container string, previous bool, ...) (PodLogs, error)
- func (service *Service) Release(ctx context.Context, namespace, name string) (HelmRelease, error)
- func (service *Service) Releases(ctx context.Context, options HelmReleaseOptions) (HelmReleasePage, error)
- func (service *Service) Rollout(ctx context.Context, namespace, name string) (Rollout, error)
- func (service *Service) Rollouts(ctx context.Context, options RolloutListOptions) (RolloutPage, error)
- func (service *Service) Scope() Scope
- func (service *Service) Scoped(scope Scope) *Service
- func (service *Service) Search(ctx context.Context, options SearchOptions) (SearchResult, error)
- func (service *Service) SetChangeStorage(provider storage.Provider)
- func (service *Service) SetLogStreamContext(ctx context.Context)
- func (service *Service) SetScrubber(scrubber Scrubber)
- func (service *Service) SetTrafficContributor(provider TrafficContributor)
- func (service *Service) StreamPodLogs(ctx context.Context, options PodLogStreamOptions, ...) error
- func (service *Service) SubscribeIndex(ctx context.Context, buffer int, kinds ...string) (<-chan kubeindex.Delta, func(), kubeindex.Status, error)
- func (service *Service) Top(ctx context.Context, options TopOptions) (TopPage, error)
- func (service *Service) Traffic(ctx context.Context, query TrafficQuery) (Traffic, error)
- func (service *Service) Usage(ctx context.Context, namespace string, limit int) (Usage, error)
- func (service *Service) ValidatePodLogStream(options PodLogStreamOptions) error
- func (service *Service) WorkloadLogs(ctx context.Context, options WorkloadLogOptions) (WorkloadLogs, error)
- func (service *Service) Workloads(ctx context.Context, options WorkloadListOptions) (WorkloadPage, error)
- type ServiceRegistry
- type SyncStatus
- type TopItem
- type TopOptions
- type TopPage
- type Traffic
- type TrafficContributor
- type TrafficEdge
- type TrafficQuery
- type TrafficWorkload
- type Usage
- type WorkloadContainer
- type WorkloadDetail
- type WorkloadListOptions
- type WorkloadLogLine
- type WorkloadLogOptions
- type WorkloadLogs
- type WorkloadPage
- type WorkloadPod
Constants ¶
Variables ¶
var ( ErrInvalidEndpoint = errors.New("kubernetes: invalid endpoint") ErrForbidden = errors.New("kubernetes: forbidden") ErrNotFound = errors.New("kubernetes: not found") ErrResponseTooLarge = errors.New("kubernetes: response too large") ErrRedirect = errors.New("kubernetes: redirect refused") ErrInvalidArguments = errors.New("kubernetes: invalid arguments") ErrOperationBudget = errors.New("kubernetes: operation budget exhausted") ErrGraphIncomplete = errors.New("kubernetes: complete graph could not be verified") ErrCompleteGraphLimit = errors.New("kubernetes: complete graph safety limit exceeded") )
var ErrLogStreamBusy = errors.New("kubernetes: log stream concurrency limit reached")
Functions ¶
func DecodeCAData ¶
DecodeCAData decodes bounded base64 PEM data for direct connector configuration.
Types ¶
type AuthOptions ¶
type AuthOptions struct {
Mode, Endpoint, CAFile, CAData, ServerName, Token, TokenFile string
CertificateFile, KeyFile, CertificateData, KeyData string
KubeconfigPath, KubeconfigContext string
EKSClusterName, EKSRegion, EKSRoleARN, EKSProfile string
AKSCredentialMode, AKSServerID, AKSTenantID, AKSClientID, AKSClientSecret string
AKSFederatedTokenFile, AKSEnvironment, GKECredentialsFile string
}
AuthOptions contains the supported, provider-neutral Kubernetes auth inputs.
type Change ¶ added in v1.4.29
type Change = kubechanges.Change
type ChangeFieldChange ¶ added in v1.4.29
type ChangeFieldChange = kubechanges.FieldChange
type ChangePage ¶ added in v1.4.29
type ChangePage struct {
Items []Change `json:"items"`
Next string `json:"next,omitempty"`
Truncated bool `json:"truncated"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
Gaps []kubechanges.Gap `json:"gaps"`
Sync SyncStatus `json:"sync"`
}
type ChangeQuery ¶ added in v1.4.29
type ChangeQuery = kubechanges.Query
type ChangeType ¶ added in v1.4.29
type ChangeType = kubechanges.Type
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a read-only, bounded Kubernetes API transport.
type Config ¶
type Config struct {
Endpoint string
TokenFile string
CAFile string
CAData []byte
ServerName string
Credentials CredentialSource
Timeout time.Duration
MaxBodyBytes int64
AllowLoopbackHTTP bool
AllowLoopback bool
AllowPrivateNetworks bool
EndpointCIDRs []string
}
Config defines one Kubernetes API connection. Credentials are read from TokenFile for every request so projected service-account rotation is honored.
func ResolveAuthentication ¶
func ResolveAuthentication(options AuthOptions) (Config, error)
ResolveAuthentication resolves one explicit auth mode into the existing stdlib HTTP client configuration.
type CredentialSource ¶
type CredentialSource interface {
Authorization(context.Context) (string, error)
ClientCertificate(*tls.CertificateRequestInfo) (*tls.Certificate, error)
}
CredentialSource supplies request and TLS credentials without exposing them through connector configuration or status DTOs.
type DiagnoseOptions ¶ added in v1.4.29
type Diagnosis ¶ added in v1.4.29
type Diagnosis struct {
Workload WorkloadDetail `json:"workload"`
WarningEvents []ProjectedResource `json:"warning_events,omitempty"`
WorstPodLogs *PodLogs `json:"worst_pod_logs,omitempty"`
Changes []Change `json:"changes"`
Neighborhood kubegraph.Graph `json:"neighborhood"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
Omitted []string `json:"omitted_categories,omitempty"`
Truncated bool `json:"truncated"`
Sync SyncStatus `json:"sync"`
}
type Discovery ¶
type Discovery struct {
ObservedAt time.Time `json:"observed_at"`
Resources []ResourceDefinition `json:"resources"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
Discovery is a bounded cluster-driven API registry.
type ErrorDetail ¶
type ErrorDetail struct {
Code string `json:"code"`
Message string `json:"message"`
Action string `json:"action"`
Retryable bool `json:"retryable"`
}
ErrorDetail is a bounded operator-facing explanation of a Kubernetes error. It never includes provider responses, credentials, endpoints, or raw causes.
func DiagnoseError ¶
func DiagnoseError(err error) ErrorDetail
DiagnoseError classifies connector failures without exposing their raw cause.
type EventOptions ¶
type EventOptions struct {
Namespace string
Type string
Kind string
Name string
UID string
Continue string
Cursor string
Limit int
}
EventOptions is the server-owned object event filter contract.
type EventPage ¶ added in v1.4.29
type EventPage struct {
Items []ProjectedResource `json:"items"`
Next string `json:"next,omitempty"`
Truncated bool `json:"truncated"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
EncodedTruncated bool `json:"-"`
Omitted []string `json:"-"`
}
type GitOpsApp ¶ added in v1.4.29
type GitOpsApp struct {
Tool string `json:"tool"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Sync string `json:"sync"`
Health string `json:"health"`
Revision string `json:"revision,omitempty"`
LastSyncAt time.Time `json:"last_sync_at,omitempty"`
Message string `json:"message,omitempty"`
Source string `json:"source,omitempty"`
Suspended bool `json:"suspended"`
}
type GitOpsAppOptions ¶ added in v1.4.29
type GitOpsAppPage ¶ added in v1.4.29
type GraphQuery ¶ added in v1.4.29
type HelmRelease ¶ added in v1.4.29
type HelmRelease struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Current HelmRevision `json:"current"`
History []HelmRevision `json:"history"`
Health string `json:"health"`
}
type HelmReleaseOptions ¶ added in v1.4.29
type HelmReleasePage ¶ added in v1.4.29
type HelmReleasePage struct {
Items []HelmRelease `json:"items"`
Next string `json:"next,omitempty"`
Truncated bool `json:"truncated"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
type HelmRevision ¶ added in v1.4.29
type IssueOptions ¶ added in v1.4.29
type IssuePage ¶ added in v1.4.29
type IssuePage struct {
Items []Issue `json:"items"`
Totals map[string]int `json:"totals"`
Truncated bool `json:"truncated"`
Next string `json:"next,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
Sync SyncStatus `json:"sync"`
}
type ListOptions ¶
type MetricsSourceStatus ¶
type MetricsSourceStatus struct {
Availability string `json:"availability"`
Fresh bool `json:"fresh"`
Complete bool `json:"complete"`
Total int `json:"total"`
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
ObservedAt *time.Time `json:"observed_at,omitempty"`
}
MetricsSourceStatus summarizes one Metrics API source before display caps.
type NeighborhoodQuery ¶ added in v1.4.29
type Overview ¶
type Overview struct {
Connector string `json:"connector"`
ClusterID string `json:"cluster_id"`
ObservedAt time.Time `json:"observed_at"`
Nodes int `json:"nodes"`
ReadyNodes int `json:"ready_nodes"`
Pods int `json:"pods"`
RunningPods int `json:"running_pods"`
Namespaces int `json:"namespaces"`
ActiveNamespaces int `json:"active_namespaces"`
Workloads int `json:"workloads"`
Warnings int `json:"warnings"`
RequestedCPU string `json:"requested_cpu,omitempty"`
LimitedCPU string `json:"limited_cpu,omitempty"`
AllocatableCPU string `json:"allocatable_cpu,omitempty"`
RequestedMemory string `json:"requested_memory,omitempty"`
LimitedMemory string `json:"limited_memory,omitempty"`
AllocatableMemory string `json:"allocatable_memory,omitempty"`
UsageCPU string `json:"usage_cpu,omitempty"`
UsageMemory string `json:"usage_memory,omitempty"`
UsageSource string `json:"usage_source"`
MetricsStatus string `json:"metrics_status"`
MetricsObservedAt *time.Time `json:"metrics_observed_at,omitempty"`
MetricsFresh bool `json:"metrics_fresh"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
Sync SyncStatus `json:"sync"`
}
type PartialFailure ¶
type PartialFailure struct {
ResourceID string `json:"resource_id,omitempty"`
Scope string `json:"scope,omitempty"`
GroupVersion string `json:"group_version,omitempty"`
Class string `json:"class"`
}
PartialFailure is a bounded failure class with no raw Kubernetes Status text.
type PodLogStreamEvent ¶ added in v1.4.30
type PodLogStreamEvent struct {
Event string `json:"-"`
Text string `json:"text"`
Container string `json:"container"`
Timestamp string `json:"timestamp,omitempty"`
Sequence uint64 `json:"sequence,omitempty"`
Ordinal uint64 `json:"ordinal,omitempty"`
Cursor string `json:"cursor,omitempty"`
Reason string `json:"reason,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Action string `json:"action,omitempty"`
Retryable bool `json:"retryable,omitempty"`
ReplayUncertain bool `json:"replay_uncertain,omitempty"`
}
type PodLogStreamOptions ¶ added in v1.4.30
type PodLogs ¶
type PodLogs struct {
ClusterID string `json:"cluster_id"`
Namespace string `json:"namespace"`
Pod string `json:"pod"`
Container string `json:"container"`
Previous bool `json:"previous"`
SinceSeconds int `json:"since_seconds"`
TailLines int `json:"tail_lines"`
Text string `json:"text"`
Truncated bool `json:"truncated"`
}
type ProjectedResource ¶
type ProjectedResource struct {
ResourceID string `json:"resource_id"`
APIVersion string `json:"api_version"`
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
UID string `json:"uid,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Owners []ObjectRef `json:"owners,omitempty"`
Summary map[string]any `json:"summary,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
ProjectionTruncated []string `json:"projection_truncated,omitempty"`
// contains filtered or unexported fields
}
ProjectedResource is a bounded safe view, never an arbitrary raw object.
type ResourceDefinition ¶
type ResourceDefinition struct {
ID string `json:"resource_id"`
Group string `json:"group,omitempty"`
Version string `json:"version"`
Resource string `json:"resource"`
Kind string `json:"kind"`
Namespaced bool `json:"namespaced"`
Aliases []string `json:"aliases,omitempty"`
Verbs []string `json:"verbs,omitempty"`
Available bool `json:"available"`
Reason string `json:"reason,omitempty"`
}
ResourceDefinition is a server-owned canonical mapping to one API resource.
type ResourceDescription ¶
type ResourceDescription struct {
Resource ProjectedResource `json:"resource"`
Related []ObjectRef `json:"related_resources,omitempty"`
Events []ProjectedResource `json:"events,omitempty"`
Usage *ResourceUsage `json:"usage,omitempty"`
UsageStatus string `json:"usage_status"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
ResourceDescription adds deterministic diagnostic evidence to one resource.
type ResourcePage ¶
type ResourcePage struct {
Items []ProjectedResource `json:"items"`
Continue string `json:"continue,omitempty"`
Truncated bool `json:"truncated"`
EncodedTruncated bool `json:"encoded_truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
type ResourceUsage ¶
type ResourceUsage struct {
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Timestamp time.Time `json:"timestamp,omitempty"`
Window string `json:"window,omitempty"`
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
}
ResourceUsage is one bounded exact pod or node Metrics API sample.
type Rollout ¶ added in v1.4.29
type Rollout struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Phase string `json:"phase"`
Strategy string `json:"strategy,omitempty"`
Step int `json:"step"`
TotalSteps int `json:"total_steps"`
StableRS string `json:"stable_rs,omitempty"`
CanaryRS string `json:"canary_rs,omitempty"`
Weight int `json:"weight,omitempty"`
Message string `json:"message,omitempty"`
}
type RolloutListOptions ¶ added in v1.4.29
type RolloutPage ¶ added in v1.4.29
type Scope ¶
type Scope struct {
OrgID string `json:"org_id,omitempty"`
ClusterID string `json:"cluster_id"`
CredentialID string `json:"-"`
}
Scope isolates cached discovery and reads by organization, cluster, and credential.
type SearchOptions ¶
type SearchOptions struct {
Query string
Namespace string
Category string
Labels string
Fields string
PerKindLimit int
TotalLimit int
}
SearchOptions bounds a true cross-kind name search.
type SearchResult ¶
type SearchResult struct {
Items []ProjectedResource `json:"items"`
Continuations map[string]string `json:"continuations,omitempty"`
Requests int `json:"requests"`
RequestBudget int `json:"request_budget"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
SearchResult contains ranked projected matches and explicit incomplete evidence.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns all Kubernetes path construction, decoding, projection, and relationships.
func NewService ¶
NewService constructs a scoped read-only Kubernetes application service.
func (*Service) Changes ¶ added in v1.4.29
func (service *Service) Changes(ctx context.Context, query ChangeQuery) (ChangePage, error)
Changes returns the bounded timeline for the service's org/cluster scope.
func (*Service) Describe ¶
func (service *Service) Describe(ctx context.Context, resourceID, namespace, name string) (ResourceDescription, error)
Describe returns one resource with deterministic owners and object-scoped events.
func (*Service) DiagnoseWorkload ¶ added in v1.4.29
func (service *Service) DiagnoseWorkload(ctx context.Context, options DiagnoseOptions) (Diagnosis, error)
DiagnoseWorkload combines bounded workload, warning-event and scrubbed log evidence.
func (*Service) Discover ¶
Discover builds a preferred-version resource registry with partial failures.
func (*Service) Get ¶
func (service *Service) Get(ctx context.Context, resourceID, namespace, name string) (ProjectedResource, error)
Get reads and safely projects one discovered Kubernetes resource.
func (*Service) GetWorkload ¶
func (service *Service) GetWorkload(ctx context.Context, namespace, kind, name string) (WorkloadDetail, error)
GetWorkload returns bounded workload state plus deterministic related resources.
func (*Service) GitOpsApps ¶ added in v1.4.29
func (service *Service) GitOpsApps(ctx context.Context, options GitOpsAppOptions) (GitOpsAppPage, error)
GitOpsApps lists only discovered GitOps APIs and safely projected status.
func (*Service) Graph ¶ added in v1.4.29
Graph builds a bounded topology graph from the shared projected index.
func (*Service) IndexSnapshot ¶ added in v1.4.29
func (service *Service) IndexSnapshot(ctx context.Context, kinds ...string) (kubeindex.Snapshot, kubeindex.Status, error)
IndexSnapshot polls requested kinds within the normal operation budget and returns the shared last-good view plus its per-kind freshness state.
func (*Service) InvalidateDiscovery ¶
func (service *Service) InvalidateDiscovery()
InvalidateDiscovery expires only this service's scoped discovery generation.
func (*Service) Issues ¶ added in v1.4.29
Issues returns bounded findings from projected cluster resources.
func (*Service) List ¶
func (service *Service) List(ctx context.Context, options ListOptions) (ResourcePage, error)
List reads one discovered resource page and safely projects every item.
func (*Service) ListEvents ¶
ListEvents lists events using server-authored field selectors only.
func (*Service) ListWorkloads ¶
func (service *Service) ListWorkloads(ctx context.Context, namespace, kind string, limit int) (WorkloadPage, error)
ListWorkloads aggregates every supported workload kind or one validated kind.
func (*Service) Neighborhood ¶ added in v1.4.29
func (service *Service) Neighborhood(ctx context.Context, query NeighborhoodQuery) (kubegraph.Graph, error)
Neighborhood returns a capped BFS slice from the same shared graph view.
func (*Service) OverviewGraph ¶ added in v1.4.29
func (*Service) PodLogs ¶
func (service *Service) PodLogs(ctx context.Context, namespace, pod, container string, previous bool, sinceSeconds, tailLines int) (PodLogs, error)
PodLogs reads one bounded pod log stream, optionally selecting a container.
func (*Service) Release ¶ added in v1.4.29
Release returns one label-only Helm release and its bounded revision history.
func (*Service) Releases ¶ added in v1.4.29
func (service *Service) Releases(ctx context.Context, options HelmReleaseOptions) (HelmReleasePage, error)
Releases reads Helm revision labels from PartialObjectMetadata only.
func (*Service) Rollout ¶ added in v1.4.29
Rollout returns one safely projected Argo Rollouts status record.
func (*Service) Rollouts ¶ added in v1.4.29
func (service *Service) Rollouts(ctx context.Context, options RolloutListOptions) (RolloutPage, error)
Rollouts lists discovered Argo Rollouts using the same projection as Rollout.
func (*Service) Scoped ¶
Scoped returns a service for another org/cluster/credential that shares the transport and keyed discovery cache with the original service.
func (*Service) Search ¶
func (service *Service) Search(ctx context.Context, options SearchOptions) (SearchResult, error)
Search searches names across discovered readable kinds with per-kind and total budgets.
func (*Service) SetChangeStorage ¶ added in v1.4.29
SetChangeStorage installs the shared persistence provider for scoped timelines.
func (*Service) SetLogStreamContext ¶ added in v1.4.30
func (*Service) SetScrubber ¶
SetScrubber installs the shared model/API text redactor.
func (*Service) SetTrafficContributor ¶ added in v1.4.29
func (service *Service) SetTrafficContributor(provider TrafficContributor)
SetTrafficContributor installs an optional traffic reader without coupling the OSS Kubernetes service to any particular telemetry implementation.
func (*Service) StreamPodLogs ¶ added in v1.4.30
func (service *Service) StreamPodLogs(ctx context.Context, options PodLogStreamOptions, emit func(PodLogStreamEvent) error) error
func (*Service) SubscribeIndex ¶ added in v1.4.29
func (service *Service) SubscribeIndex(ctx context.Context, buffer int, kinds ...string) (<-chan kubeindex.Delta, func(), kubeindex.Status, error)
SubscribeIndex primes the shared index, then subscribes to its bounded deltas.
func (*Service) Top ¶ added in v1.4.29
Top returns the highest-usage pods or nodes from the Metrics API.
func (*Service) Usage ¶
Usage returns bounded pod and node Metrics API samples with freshness metadata.
func (*Service) ValidatePodLogStream ¶ added in v1.4.30
func (service *Service) ValidatePodLogStream(options PodLogStreamOptions) error
func (*Service) WorkloadLogs ¶ added in v1.4.29
func (service *Service) WorkloadLogs(ctx context.Context, options WorkloadLogOptions) (WorkloadLogs, error)
func (*Service) Workloads ¶ added in v1.4.29
func (service *Service) Workloads(ctx context.Context, options WorkloadListOptions) (WorkloadPage, error)
Workloads lists one stable page of supported workload projections.
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry resolves one shared service instance per org, cluster, and credential.
func NewServiceRegistry ¶
func NewServiceRegistry(base *Service) *ServiceRegistry
func (*ServiceRegistry) Resolve ¶
func (registry *ServiceRegistry) Resolve(scope Scope) *Service
func (*ServiceRegistry) ResolveOrg ¶
func (registry *ServiceRegistry) ResolveOrg(orgID string) *Service
ResolveOrg inherits the configured cluster and credential while changing org scope.
type SyncStatus ¶ added in v1.4.29
type TopItem ¶ added in v1.4.29
type TopItem struct {
ResourceUsage
RequestCPU string `json:"request_cpu,omitempty"`
RequestMemory string `json:"request_memory,omitempty"`
Owner *ObjectRef `json:"owner,omitempty"`
}
type TopOptions ¶ added in v1.4.29
type TopPage ¶ added in v1.4.29
type TopPage struct {
Items []TopItem `json:"items"`
Total int `json:"total"`
Truncated bool `json:"truncated"`
Availability string `json:"availability"`
Fresh bool `json:"fresh"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
Sync SyncStatus `json:"sync"`
}
type Traffic ¶ added in v1.4.29
type Traffic struct {
Available bool `json:"available"`
Reason string `json:"reason,omitempty"`
Source string `json:"source,omitempty"`
Window string `json:"window"`
ObservedAt time.Time `json:"observed_at,omitempty"`
Edges []TrafficEdge `json:"edges,omitempty"`
Unmapped int `json:"unmapped"`
External []string `json:"external,omitempty"`
Truncated bool `json:"truncated"`
}
type TrafficContributor ¶ added in v1.4.29
type TrafficContributor interface {
ReadTraffic(context.Context, TrafficQuery) (Traffic, error)
}
type TrafficEdge ¶ added in v1.4.29
type TrafficEdge struct {
From TrafficWorkload `json:"from"`
To TrafficWorkload `json:"to"`
RatePerSec *float64 `json:"rate_per_sec"`
ErrorRate *float64 `json:"error_rate"`
P95Ms *float64 `json:"p95_ms"`
BytesPerSec *float64 `json:"bytes_per_sec"`
}
TrafficEdge leaves unavailable measurements nil so they serialize as null.
type TrafficQuery ¶ added in v1.4.29
type TrafficWorkload ¶ added in v1.4.29
type Usage ¶
type Usage struct {
ObservedAt time.Time `json:"observed_at"`
Availability string `json:"availability"`
Fresh bool `json:"fresh"`
PodMetrics MetricsSourceStatus `json:"pod_metrics"`
NodeMetrics MetricsSourceStatus `json:"node_metrics"`
Pods []ResourceUsage `json:"pods,omitempty"`
Nodes []ResourceUsage `json:"nodes,omitempty"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
Usage reports Metrics API availability separately from an empty metric set.
type WorkloadContainer ¶
type WorkloadContainer struct {
Name string `json:"name"`
Image string `json:"image,omitempty"`
Probes []string `json:"probes,omitempty"`
Requests map[string]string `json:"requests,omitempty"`
Limits map[string]string `json:"limits,omitempty"`
}
WorkloadContainer is the bounded operational view of one workload container.
type WorkloadDetail ¶
type WorkloadDetail struct {
ResourceID string `json:"resource_id"`
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Desired *int64 `json:"desired,omitempty"`
Current *int64 `json:"current,omitempty"`
Ready *int64 `json:"ready,omitempty"`
Available *int64 `json:"available,omitempty"`
Succeeded *int64 `json:"succeeded,omitempty"`
Failed *int64 `json:"failed,omitempty"`
Active *int64 `json:"active,omitempty"`
Generation *int64 `json:"generation,omitempty"`
ObservedGeneration *int64 `json:"observed_generation,omitempty"`
UpdateStrategy string `json:"update_strategy,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
Containers []WorkloadContainer `json:"containers,omitempty"`
Pods []WorkloadPod `json:"pods,omitempty"`
Nodes []string `json:"nodes,omitempty"`
NodeSelector map[string]string `json:"node_selector,omitempty"`
Affinity []string `json:"affinity,omitempty"`
TopologySpread []string `json:"topology_spread,omitempty"`
TerminationGrace *int64 `json:"termination_grace_seconds,omitempty"`
HPAs []ObjectRef `json:"hpas,omitempty"`
PDBs []ObjectRef `json:"pdbs,omitempty"`
Usage []ResourceUsage `json:"usage,omitempty"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
WorkloadDetail is a dedicated bounded SRE view, not a generic resource projection.
type WorkloadListOptions ¶ added in v1.4.29
type WorkloadLogLine ¶ added in v1.4.29
type WorkloadLogOptions ¶ added in v1.4.29
type WorkloadLogs ¶ added in v1.4.29
type WorkloadLogs struct {
Pods []string `json:"pods"`
Lines []WorkloadLogLine `json:"lines"`
Truncated bool `json:"truncated"`
OmittedPods []string `json:"omitted_pods"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
type WorkloadPage ¶
type WorkloadPage struct {
Items []ProjectedResource `json:"items"`
Counts map[string]int `json:"counts,omitempty"`
Next string `json:"next,omitempty"`
Truncated bool `json:"truncated"`
Omitted []string `json:"omitted_categories,omitempty"`
Partial []PartialFailure `json:"partial_failures,omitempty"`
}
WorkloadPage aggregates the supported workload kinds.
type WorkloadPod ¶
type WorkloadPod struct {
Name string `json:"name"`
Phase string `json:"phase,omitempty"`
Node string `json:"node,omitempty"`
RestartCount int64 `json:"restart_count"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
WorkloadPod captures status and placement for one related pod.