Documentation
¶
Overview ¶
Package attach is the contract between the node plugin of a repos volume and the control plane that decides which repositories a pod may see: the signed attach request, the answer and the check of the attach grant.
Index ¶
Constants ¶
const ( // RequestContext separates the signature of an attach request from every other signature of the node key. RequestContext = "motte-attach-request-v1" // KidHeader and SignatureHeader carry the key id of the node and the signature (base64url, no padding) over the // body of the request. KidHeader = "Motte-Node-Kid" SignatureHeader = "Motte-Node-Signature" // Window is how far the time of a request may lie from the time of the receiver, in both directions. Window = time.Minute // GrantLife is the longest life of an attach grant. GrantLife = 5 * time.Minute // MaxBody is the longest request or answer body. MaxBody = 64 << 10 )
Variables ¶
var ErrRefused = errors.New("attach: not accepted")
ErrRefused is the one error of a request or a grant that is not accepted. It never says why.
Functions ¶
Types ¶
type Binding ¶
type Binding struct {
PodUID, VolumeID, Name string
}
Binding is what an attach grant must name to be used.
type Request ¶
type Request struct {
PodUID string `json:"pod_uid"`
VolumeID string `json:"volume_id"`
Workspace string `json:"workspace"`
Name string `json:"name"`
TS int64 `json:"ts"`
Nonce string `json:"nonce"`
}
Request is what the node asks. PodUID and VolumeID come from the kubelet at publish; the sandbox cannot choose them. TS is Unix seconds. The receiver checks TS against Window and remembers each accepted Nonce until after TS plus Window, or for two Windows from its first acceptance, and checks and records it in one atomic step across its replicas.
type Response ¶
type Response struct {
Status Status `json:"status"`
Grant string `json:"grant,omitempty"`
RetryAfterMS int `json:"retry_after_ms,omitempty"`
}
Response is the body of the answer to a request with the HTTP status 200. Any other HTTP status is a failure of the control plane.
type Status ¶
type Status string
Status is the answer of the control plane.
const ( // Ready carries the attach grant. Ready Status = "ready" // Denied means that the principal of the pod may not see the repository, or that the control plane refuses. Denied Status = "denied" // NotFound means that the repository does not exist. NotFound Status = "not_found" // Pending means that the control plane prepares the repository and the caller asks again after RetryAfterMS. Pending Status = "pending" )