Documentation
¶
Overview ¶
Package opstatus is the status the meles operator serves at /status: its scan queue, running and recent scans and the pods its scan gate holds. The server fetches it to show what the operator is doing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoLeader = errors.New("no operator replica is the leader")
ErrNoLeader means no replica reported to be the leader.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
URL string
HTTP *http.Client
Timeout time.Duration
// LookupHost resolves the service name; net.DefaultResolver if nil.
LookupHost func(ctx context.Context, host string) ([]string, error)
}
Client fetches the status of the operator. URL names a headless service of the operator replicas (e.g. http://meles-operator-metrics.meles:8080): its name resolves to every replica, and the leader's status is returned.
type Gate ¶
type Gate struct {
Enabled bool `json:"enabled"`
FailOpen bool `json:"failOpen,omitempty"`
Held []Held `json:"held"`
Released Counter `json:"released"`
}
Gate is the state of the scan gate.
type Held ¶
type Held struct {
Namespace string `json:"namespace"`
Pod string `json:"pod"`
Mode string `json:"mode"`
Since time.Time `json:"since"`
Reasons []string `json:"reasons"`
}
Held is a pod the scan gate holds.
type Scan ¶
type Scan struct {
Image string `json:"image"`
Priority string `json:"priority,omitempty"`
// Pods waiting for a running scan.
Pods int `json:"pods,omitempty"`
Started time.Time `json:"started"`
Finished *time.Time `json:"finished,omitempty"`
Duration time.Duration `json:"duration,omitempty"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
Findings int `json:"findings,omitempty"`
Skipped int `json:"skipped,omitempty"`
ErrorSource string `json:"errorSource,omitempty"`
}
Scan is a queued, running or finished image scan.
type Status ¶
type Status struct {
Pod string `json:"pod"`
Version string `json:"version"`
Leader bool `json:"leader"`
StartedAt time.Time `json:"startedAt"`
Workers int `json:"workers"`
Engine string `json:"engine,omitempty"`
// Queued scans by priority: gated, new, rescan.
Queued map[string]int `json:"queued"`
OldestQueued *time.Time `json:"oldestQueued,omitempty"`
Running []Scan `json:"running"`
// Recent finished scans, newest first.
Recent []Scan `json:"recent"`
// Totals of finished scans by status since the start.
Totals map[string]int `json:"totals"`
Gate Gate `json:"gate"`
}
Status of one operator replica. Only the leader scans; the others report Leader false and no queue.
func (*Status) QueuedTotal ¶
QueuedTotal is the number of queued scans.