cluster

package
v0.0.0-...-fe2662c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cluster provides access to a Fission installation for benchmarking: typed Kubernetes/Fission clients, router-internal HMAC signing, and Prometheus/pprof capture. Resource setup uses the version-stable typed clientset (not the in-process CLI), so the same binary can drive HEAD or a released control plane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalAuthSecret

func InternalAuthSecret(ctx context.Context, kube kubernetes.Interface, fissionNamespace string) ([]byte, error)

InternalAuthSecret resolves the router-internal HMAC master secret: the FISSION_INTERNAL_AUTH_SECRET env var wins, else the in-cluster fission-internal-auth Secret. Returns nil when neither is present, in which case the router internal listener runs in pass-through mode and requests need no signing.

func SigningTransportWrapper

func SigningTransportWrapper(master []byte) func(http.RoundTripper) http.RoundTripper

SigningTransportWrapper returns a transport wrapper that signs requests to the router internal listener with the ServiceRouterInternal-derived key, via the shared hmac.NewServiceSigningTransport (the same helper the integration framework uses). It returns nil when master is empty so callers can leave the transport unwrapped.

Types

type Capturer

type Capturer struct {
	// PrometheusURL is the base URL of a Prometheus that scrapes the Fission
	// control plane (e.g. http://127.0.0.1:9090). Empty disables PromQL capture.
	PrometheusURL string
	// PprofTargets maps a service label to its pprof base URL
	// (e.g. {"router": "http://127.0.0.1:6060"}). Empty disables pprof capture.
	PprofTargets map[string]string
	// HTTP is the client used for both; defaults to a 30s client when nil.
	HTTP *http.Client
}

Capturer collects server-side signals alongside client-side load: Prometheus queries and pprof snapshots. Both are optional — when a URL is unset the corresponding capture is a no-op so the same scenario code runs against clusters with or without observability wired up.

func (*Capturer) PrometheusEnabled

func (c *Capturer) PrometheusEnabled() bool

PrometheusEnabled reports whether PromQL capture is configured.

func (*Capturer) QueryInstant

func (c *Capturer) QueryInstant(ctx context.Context, promQL string) (value float64, found bool, err error)

QueryInstant runs an instant PromQL query and returns the first sample value. found is false when Prometheus is not configured or the query yields no samples — distinct from a genuine zero value, so callers can tell a real metric of 0 apart from an absent one.

func (*Capturer) QueryRangeRaw

func (c *Capturer) QueryRangeRaw(ctx context.Context, promQL string, start, end time.Time, step time.Duration) ([]byte, error)

QueryRangeRaw runs a range query and returns the raw JSON response so it can be persisted as an artifact for offline analysis.

func (*Capturer) SnapshotPprof

func (c *Capturer) SnapshotPprof(ctx context.Context, label, outDir string) error

SnapshotPprof writes a heap and goroutine profile for every configured pprof target into outDir, prefixing files with label (e.g. "before"/"after"). It best-effort-skips targets that are unreachable, returning the first error only after attempting all of them.

type Clients

type Clients struct {
	RestConfig *rest.Config
	Fission    versioned.Interface
	Kube       kubernetes.Interface
}

Clients bundles the typed clients a benchmark run needs.

func Connect

func Connect(kubeconfigPath string) (*Clients, error)

Connect builds Fission + Kubernetes clients. If kubeconfigPath is non-empty it is used directly; otherwise the standard resolution applies (KUBECONFIG env, then in-cluster config), matching the integration framework.

func (*Clients) ServerVersion

func (c *Clients) ServerVersion() string

ServerVersion returns the cluster's Kubernetes git version (e.g. v1.34.8), or "" if it cannot be determined.

Jump to

Keyboard shortcuts

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