Documentation
¶
Overview ¶
Package broker serves the read sandbox's only ways to reach data (ADR 0019): Unix sockets bound read-only into the sandbox, each forwarding reads of one source and nothing else.
Index ¶
- Constants
- func CheckCephArgs(table []CephCommand, args []string) error
- func CheckOpenStackPath(service, target string) (string, string, error)
- func LocalCephRun(ctx context.Context, args []string) ([]byte, []byte, error)
- func LocalHostRun(ctx context.Context, name string, args []string) ([]byte, []byte, error)
- type CephCommand
- type OpenStackSource
- type Server
Constants ¶
const ( MaxRequest = 16 << 10 MaxResponse = 16 << 20 CallTimeout = 60 * time.Second )
Limits on one broker call.
const CallHeader = "X-Advisor-Call"
CallHeader carries the sandbox run's id into the audit record.
const DefaultDir = "/run/cube-advisor-agent/broker"
DefaultDir is where the sockets and client commands live on a node.
const DefaultPrometheus = "http://127.0.0.1:9091/prometheus"
DefaultPrometheus is CubeCOS's Prometheus (3.1.10 and 3.2.0).
Variables ¶
This section is empty.
Functions ¶
func CheckCephArgs ¶
func CheckCephArgs(table []CephCommand, args []string) error
CheckCephArgs decides whether args (the words after "ceph") may run. The commands whose literal words fit args best decide: all must be marked exactly "r" in Ceph's table. Only output-format flags are accepted.
func CheckOpenStackPath ¶
CheckOpenStackPath validates one os-ro request and returns its path and re-encoded query.
func LocalCephRun ¶
LocalCephRun runs the ceph CLI without a shell.
Types ¶
type CephCommand ¶
type CephCommand struct {
// Sig holds each position's literal word, or "" for a parameter.
Sig []string
// Rest is true when the last parameter takes any number of words.
Rest bool
Perm string
}
CephCommand is one entry of Ceph's own command table.
func LocalCephTable ¶
func LocalCephTable(ctx context.Context) ([]CephCommand, error)
LocalCephTable reads the node's Ceph command tables with python3-rados.
func ParseCephDescriptions ¶
func ParseCephDescriptions(raw []byte) ([]CephCommand, error)
ParseCephDescriptions reads get_command_descriptions output (the monitor's or manager's) into commands.
type OpenStackSource ¶
type OpenStackSource interface {
Endpoint(ctx context.Context, service string) (endpoint, token string, err error)
Invalidate()
HTTP() *http.Client
}
OpenStackSource resolves a catalogue service to its endpoint and a token. openstack.Admin satisfies it.
type Server ¶
type Server struct {
Dir string
Prometheus string // base URL, no trailing slash
Audit toolplane.Auditor
// CephTable returns Ceph's command table; CephRun runs `ceph args...`.
CephTable func(ctx context.Context) ([]CephCommand, error)
CephRun func(ctx context.Context, args []string) (stdout, stderr []byte, err error)
// HostRun runs the host broker's fixed commands; nil means LocalHostRun.
HostRun func(ctx context.Context, name string, args []string) (stdout, stderr []byte, err error)
// ProcRoot is where /procs reads processes; "" means /proc.
ProcRoot string
// OpenStack backs os-ro; nil refuses its calls.
OpenStack OpenStackSource
Client *http.Client
// contains filtered or unexported fields
}
Server serves the brokers.