~/bend-docscommunity

src/client.bend relies on unsafe/foreign

raw source on the hub · import bend-kube-runtime@0.10.0.0/src/client.bend as Client

12 imports
import Base
import ./json.bend as J
import ./utf8.bend as U
import ./http.bend as H
import ./core.bend as C
import ./config.bend as K
import ./net.bend as N
import ./yaml.bend as Y
import ./queue.bend as Q
import ./lease.bend as E
import ./sys.bend as Sy
import ./time.bend as T

Types

type KErr source · line 33 · raw

Data

KRetry: an API error that names a delay: the Status body's details.retryAfterSeconds, else the Retry-After header (seconds), as the API server sends with 429 and some 5xx answers.

type Reply source · line 39 · raw

Data

type ExecTok source · line 174 · raw

Data

A plugin's token and when it expires (seconds since 1970), if it said.

type Creds source · line 268 · raw

Data

type ReadEv source · line 396 · raw

Type

What the read loop just saw: bytes (or a failure) from a recv, or the decoder's state after feeding them.

type PEv source · line 557 · raw

Type

type REv source · line 831 · raw

Data

A PUT's retry on conflict: put, read the current object after a 409, put again with its version.

Definitions

def Res source · line 27 · raw

@-A:Type -> Type

def KErr.show source · line 42 · raw

@e:KErr -> String

def KErr.retryable source · line 55 · raw

@e:KErr -> Bool

Whether a failed call is worth retrying: the network, 429 (API priority and fairness), and 5xx. 4xx answers are final.

def KErr.code source · line 66 · raw

@e:KErr -> U32

def KErr.reason source · line 75 · raw

@e:KErr -> String

def KErr.retry_after source · line 85 · raw

@e:KErr -> Maybe<&2, U32>

The delay the server asked for, in seconds, if it named one.

def KErr.action.go source · line 92 · raw

@+e:KErr -> @m:Maybe<&2, U32> -> 0xc8d18670ba37041507e7f53cc7972ec6/src/queue.Action

def KErr.action source · line 103 · raw

@+e:KErr -> 0xc8d18670ba37041507e7f53cc7972ec6/src/queue.Action

What a reconcile answers after a failed call: retry after the delay the server named (a 429's Retry-After), from 1s (so a 0 cannot spin) to at most 1000s (the key backoff's own cap, so a bad value cannot park a key for weeks), else retry with the key's backoff.

def KErr.is_conflict source · line 108 · raw

@+e:KErr -> Bool

A write lost to a newer resourceVersion (409 Conflict): read again and retry (client-go's retry.RetryOnConflict case).

def KErr.is_not_found source · line 111 · raw

@+e:KErr -> Bool

def KErr.is_already_exists source · line 114 · raw

@+e:KErr -> Bool

def KErr.is_throttled source · line 118 · raw

@+e:KErr -> Bool

The server is shedding load (429): back off before retrying.

def Fs.close_with source · line 124 · raw

@-A:Type -> @f:File -> @r:Res(A) -> IO(Res(A))

def Fs.read.got source · line 127 · raw

@p:Pair(File, Res(List<&2, U32>)) -> IO(Res(String))

def Fs.read.sized.go source · line 134 · raw

@f:File -> @+n:U32 -> @empty:Bool -> IO(Res(String))

def Fs.read.sized source · line 141 · raw

@p:Pair(File, Res(U32)) -> IO(Res(String))

def Fs.read.opened source · line 148 · raw

@r:Res(File) -> IO(Res(String))

def Fs.read source · line 156 · raw

@path:String -> IO(Res(String))

A whole file as UTF-8 text.

def Src.load.fin source · line 159 · raw

@+path:String -> @r:Res(String) -> IO(Res(String))

def Strs.own source · line 166 · raw

@xs:List<&2, String> -> List<&1, String>

def Exec.token.got source · line 177 · raw

@+cmd:String -> @t:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> @exp:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> Res(ExecTok)

def Exec.token.json source · line 186 · raw

@+cmd:String -> @j:Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> Res(ExecTok)

def Exec.token source · line 195 · raw

@+cmd:String -> @r:Res(Pair(U32, Pair(String, String))) -> Res(ExecTok)

A credential plugin's answer (client-go's exec ExecCredential): its status.token and status.expirationTimestamp.

def Exec.until.go source · line 207 · raw

@+now:U32 -> @+exp:U32 -> @late:Bool -> U32

How long a token is used: until a minute before it expires, or for a minute when the plugin gave no expiry (client-go keeps such a token until a 401; this one asks again each minute instead).

def Exec.until source · line 214 · raw

@+now:U32 -> @exp:Maybe<&2, U32> -> U32

def Exec.kept source · line 221 · raw

@+key:String -> @+now:U32 -> @r:Res(ExecTok) -> IO(Res(String))

def Exec.ran source · line 228 · raw

@+cmd:String -> @+key:String -> @+now:U32 -> @r:Res(Pair(U32, Pair(String, String))) -> IO(Res(String))

def Exec.cached source · line 231 · raw

@+cmd:String -> @args:List<&2, String> -> @+key:String -> @+now:U32 -> @+hit:String -> @miss:Bool -> IO(Res(String))

def Exec.key source · line 240 · raw

@+cmd:String -> @args:List<&2, String> -> String

def Exec.at source · line 243 · raw

@+cmd:String -> @+args:List<&2, String> -> @+now:U32 -> IO(Res(String))

def Exec.load source · line 249 · raw

@+cmd:String -> @+args:List<&2, String> -> IO(Res(String))

A plugin's token, from the process-wide cache while it is good: the plugin runs once per token, not once per request.

def Src.load source · line 252 · raw

@s:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> IO(Res(String))

def Creds.load.k source · line 271 · raw

@ca:String -> @cert:String -> @key:String -> @tok:Res(String) -> IO(Res(Creds))

def Creds.load.c source · line 278 · raw

@ca:String -> @cert:String -> @key:Res(String) -> @tok:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> IO(Res(Creds))

def Creds.load.b source · line 285 · raw

@ca:String -> @cert:Res(String) -> @key:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> @tok:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> IO(Res(Creds))

def Creds.load.a source · line 292 · raw

@ca:Res(String) -> @cert:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> @key:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> @tok:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Src -> IO(Res(Creds))

def Creds.load source · line 300 · raw

@c:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> IO(Res(Creds))

Reads every secret a Config names; token files are read afresh each time.

def Conn.auth.go source · line 305 · raw

@token:String -> @none:Bool -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Conn.auth source · line 315 · raw

@+token:String -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Conn.user_agent source · line 318 · raw

String

def Conn.keep source · line 321 · raw

@keep:Bool -> String

def Conn.connection source · line 328 · raw

@keep:Bool -> @own:Bool -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Conn.render source · line 338 · raw

@req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @+base:String -> @+host:String -> @+token:String -> @keep:Bool -> String

The request's text, with the path under the server's base, our headers, and Connection: keep-alive (pooled) or close, unless the request names its own (an Upgrade).

def Conn.host_header.go source · line 347 · raw

@h:String -> @+p:U32 -> @v6:Bool -> String

def Conn.host_header source · line 354 · raw

@+h:String -> @+p:U32 -> String

def Conn.open.sent source · line 358 · raw

@p:Pair(Socket, Res(Unit)) -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

Opens a connection and sends req: the socket, ready to read the answer.

def Fence.mono source · line 365 · raw

IO(U32)

def Fence.check.late source · line 376 · raw

@late:Bool -> IO(Unit)

The leadership fence: the lease's last renewal, held by a keeper the leader updates (Leader.fence). Under leader election every write of request bytes (a request's first send, a pooled send, a retry, exec's input) asks the keeper first, and a lease past its renew deadline exits the process before the bytes leave: whatever delays the leader loop (a long computation on the shared event loop), nothing is written after a standby may have taken over. The keeper always answers, so a reading is never missing.

def Fence.check.at source · line 383 · raw

@f:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Fence> -> @+now:U32 -> IO(Unit)

def Fence.check.got source · line 400 · raw

@m:Maybe<&1, Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Fence>> -> IO(Unit)

def Fence.check source · line 409 · raw

@m:Maybe<&2, Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg)> -> IO(Unit)

Asks the keeper for the reading and exits if the lease is past its deadline; nothing to check without leader election.

def Conn.open.go source · line 418 · raw

@r:Res(Socket) -> @text:String -> @fc:Maybe<&2, Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg)> -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

def Conn.open.creds source · line 426 · raw

@+h:String -> @+p:U32 -> @+sn:String -> @+base:String -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @keep:Bool -> @fc:Maybe<&2, Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg)> -> @cr:Res(Creds) -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

def Conn.open source · line 435 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @keep:Bool -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

def ReadEv.got source · line 440 · raw

@p:Pair(Socket, Res(List<&2, U32>)) -> ReadEv

def Http.has_err source · line 445 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> Bool

def Http.fail source · line 448 · raw

@msg:String -> 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp

def Http.lost source · line 452 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> @msg:String -> 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp

A failed recv: lost when no byte of a response came, else broken.

def Conn.read source · line 461 · raw

@fuel:Nat -> @ev:ReadEv -> @+resp:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> @+ms:U32 -> IO(Pair(Socket, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp))

Reads until the response is whole, the stream ends, or fuel runs out; ms bounds each recv. Answers the socket and the decoder.

def Reply.retry_after source · line 488 · raw

@m:Maybe<&2, String> -> Maybe<&2, U32>

A Retry-After header in seconds (the form the API server sends); an HTTP-date one is left to the usual backoff.

def Reply.of source · line 495 · raw

@r:Pair(0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp, List<&2, U32>) -> Result<&2, &2, KErr, Reply>

def Call.read.fin source · line 506 · raw

@p:Pair(Socket, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp) -> IO(Result<&2, &2, KErr, Reply>)

def Call.read source · line 512 · raw

@t:Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls) -> IO(Result<&2, &2, KErr, Reply>)

def Conn.send_on.creds source · line 532 · raw

@s:Socket -> @+h:String -> @+p:U32 -> @+base:String -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @fc:Maybe<&2, Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg)> -> @cr:Res(Creds) -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

Sends req on an open (pooled) connection.

def Conn.send_on source · line 543 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @s:Socket -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> IO(Res(0xc8d18670ba37041507e7f53cc7972ec6/src/net.Tls))

def Http.got_any source · line 548 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> Bool

def Http.closes source · line 563 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> Bool

def Req.idempotent.go source · line 571 · raw

@m:String -> Bool

def Req.idempotent source · line 584 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> Bool

def Pool.put.done source · line 589 · raw

@p:Poll<&1, &1, Result<&1, &1, Socket, Unit>, Socket> -> IO(Unit)

def Pool.put source · line 599 · raw

@+pool:Chan(Socket) -> @s:Socket -> IO(Unit)

Returns a connection to the pool; a full pool closes it instead.

def PEv.read source · line 603 · raw

@+reused:Bool -> @p:Pair(Socket, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp) -> PEv

def PEv.fin source · line 606 · raw

@+reused:Bool -> @idem:Bool -> @p:Pair(Socket, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp) -> PEv

def Pool.reply source · line 612 · raw

@r:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Resp -> Result<&2, &2, KErr, Reply>

def Pool.fail source · line 615 · raw

@msg:String -> IO(Result<&2, &2, KErr, Reply>)

def Pool.run source · line 619 · raw

@fuel:Nat -> @ev:PEv -> @+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @+pool:Chan(Socket) -> @+req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> IO(Result<&2, &2, KErr, Reply>)

One request through the pool (fuel bounds the retry).

def Client.send.with source · line 659 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @pool:Maybe<&2, Chan(Socket)> -> IO(Result<&2, &2, KErr, Reply>)

def Limit.fill source · line 676 · raw

@n:Nat -> @+ch:Chan(Unit) -> IO(Unit)

def Limit.tick source · line 687 · raw

@+qps:U32 -> @+every:U32 -> @+burst:U32 -> @+carry:U32 -> Nat

A tick of every ms earns qps * every / 1000 tokens; the remainder (in thousandths of a token) carries to the next tick, so the rate is exact. A tick adds at most burst tokens: the rest would find the bucket full.

def Limit.carry source · line 690 · raw

@+qps:U32 -> @+every:U32 -> @+carry:U32 -> U32

def Limit.refill source · line 693 · raw

@outer:Nat -> @fuel:Nat -> @+ch:Chan(Unit) -> @+qps:U32 -> @+every:U32 -> @+burst:U32 -> @+carry:U32 -> IO(Unit)

def Limit.every source · line 706 · raw

@+qps:U32 -> U32

Ticks of 10ms, or longer for slow rates (one token a tick), at most 1s.

def Limit.start source · line 710 · raw

@+qps:U32 -> @+burst:U32 -> IO(Chan(Unit))

A full bucket of burst tokens, refilled at qps a second (qps above 0).

def Fence.serve source · line 718 · raw

@outer:Nat -> @fuel:Nat -> @m:Maybe<&1, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg> -> @+cur:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Fence> -> @+inbox:Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg) -> IO(Unit)

def Fence.start source · line 736 · raw

IO(Chan(0xc8d18670ba37041507e7f53cc7972ec6/src/config.FenceMsg))

Starts a fence keeper with no reading yet.

def Client.send.go source · line 742 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> IO(Result<&2, &2, KErr, Reply>)

def Client.send.gate source · line 745 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> @m:Maybe<&2, Chan(Unit)> -> IO(Result<&2, &2, KErr, Reply>)

def Client.send source · line 756 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> IO(Result<&2, &2, KErr, Reply>)

Sends a request and reads the whole reply, whatever its status, after taking a token when the config has a rate limit.

def Client.json.status.fix.go source · line 759 · raw

@+c:U32 -> @+k:U32 -> @r:String -> @m:String -> @zero:Bool -> 0xc8d18670ba37041507e7f53cc7972ec6/src/core.Status

def Client.json.status.fix source · line 767 · raw

@+c:U32 -> @s:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Status -> 0xc8d18670ba37041507e7f53cc7972ec6/src/core.Status

A Status without a code (some proxies) takes the HTTP status.

def Client.json.err source · line 772 · raw

@s:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Status -> @m:Maybe<&2, U32> -> KErr

def Client.json.or source · line 779 · raw

@m:Maybe<&2, U32> -> @h:Maybe<&2, U32> -> Maybe<&2, U32>

def Client.json.status source · line 788 · raw

@+c:U32 -> @j:Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> @ok:Bool -> @h:Maybe<&2, U32> -> Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

h: the Retry-After header; the Status body's details.retryAfterSeconds wins when both name a delay.

def Client.json.of source · line 802 · raw

@r:Result<&2, &2, KErr, Reply> -> Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

A 2xx reply's body as JSON; any other status as the Status it carries.

def Client.json source · line 809 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @req:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Req -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.get source · line 816 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.list source · line 819 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @lp:0xc8d18670ba37041507e7f53cc7972ec6/src/core.ListParams -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.create source · line 822 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.replace source · line 825 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Retry.rv source · line 838 · raw

@+obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> @+rv:String -> 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json

obj with the current object's resourceVersion.

def Retry.go source · line 842 · raw

@steps:Nat -> @tries:Nat -> @ev:REv -> @+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @+a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @+name:String -> @+obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

steps: fuel, at most four events per try.

def Client.replace_retry source · line 872 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @+a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @+name:String -> @+obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> @+tries:U32 -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

A PUT that rides out write conflicts (client-go's retry.RetryOnConflict with a fresh read): after a 409 it reads the object, takes its resourceVersion and puts obj again, up to tries more times. A failed read (the object deleted meanwhile: 404) ends it with that error. obj then overwrites whatever another writer changed in between, so use it for objects this writer owns whole. Client.apply (server-side apply) and Client.patch never conflict on a version and keep other writers' fields; prefer them on busy objects such as pods.

def Client.delete source · line 876 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.delete_with source · line 880 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @o:0xc8d18670ba37041507e7f53cc7972ec6/src/core.DeleteOpts -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

A delete with options: propagation, grace period, preconditions.

def Client.replace_status source · line 886 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @obj:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

Replaces the status subresource (a PUT carrying the object's resourceVersion, so a stale write fails with 409).

def Client.patch source · line 890 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @p:0xc8d18670ba37041507e7f53cc7972ec6/src/core.PatchKind -> @body:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.patch_status source · line 894 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @p:0xc8d18670ba37041507e7f53cc7972ec6/src/core.PatchKind -> @body:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Client.apply source · line 900 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @manager:String -> @body:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

Server-side apply, kube's recommended write: the server merges our fields under our manager name and tracks ownership.

def Client.apply_with source · line 907 · raw

@+cfg:0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config -> @a:0xc8d18670ba37041507e7f53cc7972ec6/src/core.Api -> @name:String -> @manager:String -> @force:Bool -> @body:0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json -> IO(Result<&2, &2, KErr, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

Server-side apply that only forces when asked: without force, a field another manager owns (an HPA's spec.replicas) fails with 409 Conflict rather than being taken over.

def Kc.rebased source · line 911 · raw

@r:Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> @+path:String -> Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

def Kc.parse source · line 923 · raw

@+t:String -> @+path:String -> @json:Bool -> Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

Reads one kubeconfig, JSON or YAML (yaml.bend), with its relative paths made absolute against its own directory, as client-go does.

def Kc.read.got source · line 930 · raw

@r:Res(String) -> @+path:String -> Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

def Kc.read source · line 937 · raw

@+path:String -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Kc.merge.got source · line 943 · raw

@acc:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> @r:Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>

Merges the files of a KUBECONFIG list in order; a file that does not exist is skipped, as client-go skips it.

def Kc.merge source · line 952 · raw

@ps:List<&2, String> -> @acc:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> IO(Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json>)

def Config.from_kubeconfig.got source · line 960 · raw

@r:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/json.Json> -> @ctx:String -> Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>

def Config.from_kubeconfig source · line 969 · raw

@+path:String -> @ctx:String -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

A kubeconfig (one path, or a KUBECONFIG list "a:b") at a context ("" for its current one). JSON and YAML are both read natively.

def Config.in_cluster.ns source · line 974 · raw

@host:String -> @port:String -> @ns:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.in_cluster.port source · line 982 · raw

@host:String -> @port:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.in_cluster.host source · line 990 · raw

@host:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.in_cluster source · line 999 · raw

IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

The pod's own service account (client-go's InClusterConfig).

def Config.infer.home source · line 1003 · raw

@r:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.infer.pod source · line 1010 · raw

@r:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.infer.kc source · line 1017 · raw

@r:Res(String) -> IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

def Config.infer source · line 1027 · raw

IO(Result<&2, &2, String, 0xc8d18670ba37041507e7f53cc7972ec6/src/config.Config>)

As kube-rs's Config::infer: $KUBECONFIG when set, else the pod's service account when in a cluster, else ~/.kube/config.