Documentation
¶
Overview ¶
Package notify posts one sweep summary per team to the team's channel, through klaus-gateway's team-notice endpoint (POST /notices). The gateway owns the Slack app and the workspace credential; the sweep holds none.
The caller authenticates as itself: the projected ServiceAccount token the pod already carries, for the audience the gateway reviews. The file is read per call because the kubelet rotates it.
The summary is the run history of the scheduled sweep: no report repository and no database, so a channel that fills with runs that changed nothing stops being read. Silence is therefore part of the contract, and Client.Post refuses an empty message rather than posting a heartbeat.
Index ¶
Constants ¶
const ( URLEnv = "MARGE_NOTICES_URL" TokenFileEnv = "MARGE_NOTICES_TOKEN_FILE" )
URLEnv carries the gateway's in-cluster base URL, TokenFileEnv the path of the projected ServiceAccount token.
const TextMax = 3000
TextMax is the gateway's own bound on a notice: one Slack section block, whose limit is 3000 characters. A longer summary is trimmed to whole lines rather than refused.
Variables ¶
This section is empty.
Functions ¶
func Fit ¶ added in v0.37.0
Fit trims a summary to the gateway's bound on whole lines, and says how many lines it dropped. A summary that silently loses its last section reads as a sweep that did less than it did. It is exported so a caller that renders a summary can hold its own lines to what a notice carries.
Types ¶
type Client ¶
type Client struct {
// BaseURL is the gateway as reached from the pod, without a trailing
// path.
BaseURL string
// TokenFile holds the projected ServiceAccount token, read per post.
TokenFile string
HTTP *http.Client
}
Client posts notices.
func LoadClient ¶
func LoadClient() *Client
LoadClient returns the client the environment configures, or nil when it names no gateway, which is not an error: a sweep run by hand posts nothing. The caller reports the summary on its own output either way.