resourcehistory

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package resourcehistory exposes bounded, authenticated infrastructure samples for the platform's admin-only Prometheus sizing reports.

Index

Constants

View Source
const (
	ScrapeAudience  = "mcp-resource-history"
	TokenVolumeName = "resource-history-token"
	TokenMountPath  = "/var/run/secrets/mcp-resource-history" // #nosec G101 -- fixed mount directory; contains no credential value.
)
View Source
const NodeEgressPolicy = "mcp-runtime-api-resource-history-egress"
View Source
const TrustConfigMap = "mcp-kubelet-resource-trust"

Variables

This section is empty.

Functions

func DecodeTargets

func DecodeTargets(data string) (map[string]Target, error)

func EncodeTargets

func EncodeTargets(targets []Target) (string, error)

func NodeEgress

func NodeEgress(ctx context.Context, client kubernetes.Interface, namespace string) ([]networkingv1.NetworkPolicyEgressRule, error)

NodeEgress reads setup's public serving trust and the current node identities. Both setup and update use it; live policy rules never establish trust. Missing trust permits no kubelet destinations, while invalid or unreadable trust stops reconciliation. Discovery is bounded and never writes to the cluster.

func PodRequest

func PodRequest(pod corev1.Pod, resource corev1.ResourceName) float64

PodRequest follows scheduler accounting for restartable init sidecars, ordinary init containers, pod-level resources and pod overhead.

func PrometheusTokenMount

func PrometheusTokenMount() corev1.VolumeMount

func PrometheusTokenVolume

func PrometheusTokenVolume() corev1.Volume

PrometheusTokenVolume and PrometheusTokenMount are the only token mount a resource-history release declaration can request. No caller controls its audience, lifetime, name, path, source, permissions or target container.

func PublicCertificates

func PublicCertificates(data []byte) ([]byte, error)

PublicCertificates rejects mixed PEM bundles so an accidentally supplied private key or kubeconfig can never be copied into a public ConfigMap.

Types

type Handler

type Handler struct {
	Client              kubernetes.Interface
	Config              *rest.Config
	Namespace           string
	PrometheusNamespace string
	// Set only after supported setup verifies enforcing CNI and shared
	// telemetry ingress isolation. Scrape auth alone cannot protect data
	// subsequently stored in shared Prometheus.
	IsolatedTelemetry bool
	// contains filtered or unexported fields
}

Handler authenticates each scrape before doing any collection. It accepts only a bound token for the install's Prometheus identity and dedicated audience. Platform user/admin keys and caller identity headers do not apply.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Target

type Target struct {
	Name           string `json:"name"`
	UID            string `json:"uid"`
	Address        string `json:"address"`
	ServerName     string `json:"server_name"`
	CertificatePEM string `json:"certificate_pem"`
}

Target is provisioned by setup from an administrator-controlled trust source. Node UID and address are rechecked against Kubernetes before any credential is sent. CertificatePEM contains only public trust anchors, never a private key.

Jump to

Keyboard shortcuts

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