~/bend-docscommunity

src/admission.bend checks

raw source on the hub · import bend-kube-runtime@0.12.0.0/src/admission.bend as Admission

5 imports
import Base
import ./json.bend as J
import ./http.bend as H
import ./utf8.bend as U
import ./base64.bend as B

Types

type Verdict source · line 20 · raw

Data

allowed; code and message when denied (code 0: 403); patch: JSON-patch operations to apply (a mutating webhook; Nil for none); warnings shown to the client (kubectl prints them).

type Rq source · line 58 · raw

Data

A request so far: its first line's bytes (reversed), then the line and the decoder; size counts every byte read.

type Cut source · line 66 · raw

Data

The bytes before the first LF, and those after it.

type Got source · line 172 · raw

Data

A finished request: its method, path and body.

type Review source · line 304 · raw

Data

Definitions

def Verdict.allow source · line 23 · raw

Verdict

def Verdict.deny source · line 27 · raw

@msg:String -> Verdict

Denied with a message (403 Forbidden).

def Verdict.deny_with source · line 31 · raw

@code:U32 -> @msg:String -> Verdict

Denied with an HTTP-style code (400 for a bad request, 422 invalid).

def Verdict.patch source · line 35 · raw

@ops:List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> Verdict

Allowed, applying JSON-patch operations ({"op": "add", "path": .., "value": ..}).

def Verdict.warn source · line 39 · raw

@v:Verdict -> @w:String -> Verdict

The verdict with a warning added.

def Patch.op source · line 45 · raw

@op:String -> @path:String -> @value:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json

A JSON-patch operation: op ("add", "replace", "remove"), path, value.

def Rq.init source · line 62 · raw

Rq

def Cut.put source · line 69 · raw

@+b:U32 -> @c:Cut -> Cut

def Cut.is_lf source · line 74 · raw

@bs:List<&2, U32> -> Bool

def Cut.at source · line 82 · raw

@bs:List<&2, U32> -> @lf:Bool -> Cut

lf: whether bs starts with LF.

def Cut.of source · line 91 · raw

@+bs:List<&2, U32> -> Cut

def Rq.status source · line 94 · raw

List<&2, U32>

def Rq.lined source · line 97 · raw

@acc:List<&2, U32> -> @+n:U32 -> @c:Cut -> Rq

def Rq.feed source · line 106 · raw

@st:Rq -> @+bs:List<&2, U32> -> Rq

Feeds bytes read from the connection.

def Rq.max_bytes source · line 116 · raw

U32

The most a request may carry, 8 MiB: the API server sends at most about 3 MiB of object (twice that with oldObject on an update), and every byte held costs Bend a list cell.

def Rq.too_big source · line 121 · raw

@st:Rq -> @+max:U32 -> Bool

Whether a request is past max bytes: read already, or declared by its Content-Length before the body is read.

def Rq.size source · line 130 · raw

@st:Rq -> U32

def Rq.done source · line 139 · raw

@st:Rq -> Bool

A request without Content-Length or chunked framing has no body (the response decoder would read one to the end of the stream).

def Rq.broken source · line 148 · raw

@st:Rq -> Bool

def Rq.path.go source · line 157 · raw

@ps:List<&2, String> -> String

The path of a request line ("POST /validate?timeout=10s HTTP/1.1"), without its query.

def Rq.method.go source · line 164 · raw

@ps:List<&2, String> -> String

def Rq.got.fin source · line 175 · raw

@+line:String -> @rb:Pair(0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp, List<&2, U32>) -> Got

def Rq.got source · line 180 · raw

@st:Rq -> Got

def Wh.reason.go source · line 190 · raw

@ok:Bool -> @bad:Bool -> @missing:Bool -> @big:Bool -> String

def Wh.reason source · line 203 · raw

@+code:U32 -> String

def Wh.reply source · line 206 · raw

@+code:U32 -> @+body:String -> String

def Wh.error source · line 210 · raw

@+code:U32 -> @+msg:String -> String

def Wh.strs source · line 213 · raw

@ws:List<&2, String> -> List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>

def Wh.code.go source · line 220 · raw

@+c:U32 -> @zero:Bool -> U32

def Wh.code source · line 227 · raw

@+c:U32 -> U32

def Wh.patch_kvs source · line 230 · raw

@ops:List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.KV>

def Wh.status_kvs source · line 238 · raw

@allowed:Bool -> @+code:U32 -> @+msg:String -> List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.KV>

def Wh.warn_kvs source · line 245 · raw

@ws:List<&2, String> -> List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.KV>

def Wh.admission_review source · line 254 · raw

@+av:String -> @+uid:String -> @v:Verdict -> 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json

The AdmissionReview that answers request uid with the verdict, in the review's own apiVersion.

def Wh.conv.put source · line 262 · raw

@r:Result<&2, &2, String, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> @rest:Result<&2, &2, String, List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>> -> Result<&2, &2, String, List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>>

def Wh.conv.result source · line 281 · raw

@+av:String -> @+uid:String -> @r:Result<&2, &2, String, List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>> -> 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json

def Review.of.go source · line 309 · raw

@+j:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> @+kind:String -> @adm:Bool -> @conv:Bool -> Review

def Review.of.json source · line 318 · raw

@+j:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> @+kind:String -> Review

def Review.of.parsed source · line 321 · raw

@r:Result<&2, &2, String, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> Review

def Review.of source · line 329 · raw

@body:String -> Review

The review a request body carries.

Templates

template Wh.converted source · line 273 · raw

@-convert:(@_:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> @_:String -> Result<&2, &2, String, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>) -> @xs:List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> @+to:String -> Result<&2, &2, String, List<&2, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>>

Every object converted, or the first failure.

template Wh.conversion_review source · line 294 · raw

@-convert:(@_:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> @_:String -> Result<&2, &2, String, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json>) -> @+review:0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json -> 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json

The ConversionReview that answers a request: every object in the desired apiVersion, or the first failure.