Documentation
¶
Overview ¶
Package resourcehistory exposes bounded, authenticated infrastructure samples for the platform's admin-only Prometheus sizing reports.
Index ¶
- Constants
- func DecodeTargets(data string) (map[string]Target, error)
- func EncodeTargets(targets []Target) (string, error)
- func NodeEgress(ctx context.Context, client kubernetes.Interface, namespace string) ([]networkingv1.NetworkPolicyEgressRule, error)
- func PodRequest(pod corev1.Pod, resource corev1.ResourceName) float64
- func PrometheusTokenMount() corev1.VolumeMount
- func PrometheusTokenVolume() corev1.Volume
- func PublicCertificates(data []byte) ([]byte, error)
- type Handler
- type Target
Constants ¶
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. )
const NodeEgressPolicy = "mcp-runtime-api-resource-history-egress"
const TrustConfigMap = "mcp-kubelet-resource-trust"
Variables ¶
This section is empty.
Functions ¶
func EncodeTargets ¶
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 ¶
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 ¶
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.
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.