~/bend-docscommunity

src/config.bend checks

raw source on the hub · import bend-kube-runtime@0.11.0.0/src/config.bend as Config

4 imports
import Base
import ./json.bend as J
import ./utf8.bend as U
import ./base64.bend as B

Types

type Src source · line 20 · raw

Data

A secret's source: inline text, a file to read, a credential plugin to run (client-go's exec ExecCredential: its status.token), nothing, or a field that cannot be read (bad base64), which fails when it is loaded rather than quietly meaning "none" (for a CA, the system's roots).

type Fence source · line 39 · raw

Data

pool: idle keep-alive connections to reuse (client.bend), when the program made one (Config.with_pool); None opens one per request. server_name: the name the server's certificate must carry, and the SNI sent, when it differs from host (kubeconfig's tls-server-name; "" for host). fence: the leadership fence (leader.bend): when the controllers run under leader election, each request first checks that the lease is still within its renew deadline, and the process exits if it is not. limit: the client's rate limit, a bucket of tokens a request takes one of (client.bend's Limit), when the program made one (Config.with_limit). The leadership fence's reading: the monotonic time of the last renewal and the renew deadline (ms); past last + deadline a standby may act.

type FenceMsg source · line 44 · raw

Data

What the fence keeper (client.bend) answers: the current reading (None before the first renewal), or takes: a new reading.

type Config source · line 48 · raw

Data

type Url source · line 66 · raw

Data

Definitions

def Config.host source · line 53 · raw

@c:Config -> String

def Config.namespace source · line 58 · raw

@c:Config -> String

def Url.drop_scheme.go source · line 69 · raw

@s:String -> @tls:Bool -> String

def Url.drop_scheme source · line 76 · raw

@+s:String -> String

def Url.split_path source · line 80 · raw

@s:String -> @acc:String -> Pair(String, String)

Splits "authority/path" at the first '/'.

def Url.port source · line 89 · raw

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

def Url.host_port.v6 source · line 92 · raw

@parts:List<&2, String> -> @+dflt:U32 -> Pair(String, U32)

def Url.host_port.v4 source · line 101 · raw

@parts:List<&2, String> -> @+dflt:U32 -> Pair(String, U32)

def Url.host_port source · line 112 · raw

@a:String -> @+dflt:U32 -> Pair(String, U32)

"[::1]:6443" or "host:6443" or "host": the host and the port (dflt when none is given).

def Url.trim_slash.go source · line 119 · raw

@s:String -> String

def Url.trim_slash source · line 126 · raw

@s:String -> String

def Url.parse.fin source · line 129 · raw

@hp:Pair(String, U32) -> @base:String -> Url

def Url.parse.go source · line 134 · raw

@ap:Pair(String, String) -> Url

def Url.parse source · line 139 · raw

@s:String -> Url

def Kube.named.if source · line 142 · raw

@+x:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+field:String -> @rest:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @hit:Bool -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

def Kube.named source · line 154 · raw

@xs:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> @+name:String -> @+field:String -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

The entry of a named list ("clusters", "users", "contexts") with this name, as its inner object (cluster, user or context).

def Kube.src.b64 source · line 162 · raw

@bs:Maybe<&2, List<&2, U32>> -> @+field:String -> Src

def Kube.src.go source · line 169 · raw

@data:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @path:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+field:String -> Src

def Kube.src source · line 179 · raw

@+o:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+name:String -> Src

A secret from "<name>-data" (base64, inline) or "<name>" (a path).

def Kube.strs source · line 182 · raw

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

def Kube.token.exec source · line 193 · raw

@c:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @env:List<&2, String> -> @args:List<&2, String> -> Src

A plugin runs under env, which sets the plugin's env entries (and KUBERNETES_EXEC_INFO, as client-go does) on top of our environment.

def Kube.envs source · line 203 · raw

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

An exec plugin's env entries ({name, value}) as "name=value".

def Kube.token.go source · line 211 · raw

@t:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @f:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+e:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> Src

def Kube.token source · line 221 · raw

@+u:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> Src

def Kube.config.pick.go source · line 224 · raw

@ctx:String -> @cur:String -> @empty:Bool -> String

def Kube.config.pick source · line 231 · raw

@+ctx:String -> @cur:String -> String

def Kube.config.fin source · line 234 · raw

@u:Url -> @ca:Src -> @cert:Src -> @key:Src -> @tok:Src -> @ns:String -> @sn:String -> Result<&2, &2, String, Config>

def Kube.config.server source · line 240 · raw

@s:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @ca:Src -> @cert:Src -> @key:Src -> @tok:Src -> @ns:String -> @sn:String -> Result<&2, &2, String, Config>

def Kube.config.build source · line 248 · raw

@+cl:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+u:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @ns:String -> @name:String -> @missing:Bool -> Result<&2, &2, String, Config>

def Kube.config.with source · line 258 · raw

@+kc:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @name:String -> @+c:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> Result<&2, &2, String, Config>

def Kube.config.ctx source · line 266 · raw

@+kc:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+name:String -> Result<&2, &2, String, Config>

def Kube.config source · line 271 · raw

@+kc:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @ctx:String -> Result<&2, &2, String, Config>

The Config a kubeconfig (as JSON) names for a context ("" for its current-context), or why it cannot.

def InCluster.dir source · line 277 · raw

String

def InCluster.config source · line 282 · raw

@host:String -> @port:String -> @ns:String -> Config

The pod's service account, from KUBERNETES_SERVICE_HOST and _PORT (client-go's InClusterConfig). An IPv6 host needs no brackets here.

def Kube.names source · line 289 · raw

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

def Kube.merge.new.put source · line 296 · raw

@x:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @rest:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> @dup:Bool -> List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json>

def Kube.merge.new source · line 303 · raw

@b:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> @+seen:List<&2, String> -> List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json>

def Kube.merge.list source · line 311 · raw

@+a:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> @b:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json>

def Kube.merge.field source · line 314 · raw

@+a:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+b:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+f:String -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

def Kube.merge.cur source · line 317 · raw

@a:String -> @b:String -> String

def Kube.merge source · line 323 · raw

@+a:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+b:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

Two kubeconfigs as client-go merges a KUBECONFIG list: an entry named in the first wins over the same name in the second, and current-context is the first one set.

def Kube.rebase.str source · line 330 · raw

@dir:String -> @s:String -> @abs:Bool -> String

def Kube.rebase.path source · line 338 · raw

@+dir:String -> @p:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

A relative path in a kubeconfig is relative to the kubeconfig's directory.

def Kube.rebase.key source · line 345 · raw

@+o:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+dir:String -> @+k:String -> @missing:Bool -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

def Kube.rebase.keys source · line 352 · raw

@ks:List<&2, String> -> @+o:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+dir:String -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

def Kube.rebase.items source · line 359 · raw

@xs:List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json> -> @+dir:String -> @+inner:String -> @+ks:List<&2, String> -> List<&2, 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json>

def Kube.rebase source · line 369 · raw

@+kc:0x3b6cf044a15b0f294883035a8a89b794/src/json.Json -> @+dir:String -> 0x3b6cf044a15b0f294883035a8a89b794/src/json.Json

The kubeconfig with every file path made absolute against dir.

def Kube.dir.fin source · line 376 · raw

@d:String -> @bare:Bool -> String

def Kube.dir.go source · line 383 · raw

@+parts:List<&2, String> -> String

def Kube.dir source · line 388 · raw

@+p:String -> String

The directory of a path ("." when it has none).

def Config.with_pool source · line 391 · raw

@c:Config -> @pool:Chan(Socket) -> Config

def Config.pool source · line 396 · raw

@c:Config -> Maybe<&2, Chan(Socket)>

def Config.with_limit source · line 401 · raw

@c:Config -> @limit:Chan(Unit) -> Config

def Config.limit source · line 406 · raw

@c:Config -> Maybe<&2, Chan(Unit)>

def Config.server_name source · line 411 · raw

@c:Config -> String

def Config.with_server_name source · line 417 · raw

@c:Config -> @name:String -> Config

The config with the name the server's certificate must carry.

def Config.fence source · line 422 · raw

@c:Config -> Maybe<&2, Chan(FenceMsg)>

def Config.with_fence source · line 429 · raw

@c:Config -> @f:Chan(FenceMsg) -> Config

The config with a leadership fence (Kube.start sets it for the controllers when they run under leader election).

def Config.fence_as source · line 436 · raw

@c:Config -> @m:Maybe<&2, Chan(FenceMsg)> -> Config

The config with another config's leadership fence (or none): a watch on another cluster stays fenced by the controllers' lease.

def Src.ident source · line 441 · raw

@s:Src -> String

def Config.ident source · line 457 · raw

@c:Config -> String

Which cluster, as whom: the server and the credentials, so two configs share a watch only when they would see the same objects. Never logged (it can hold an inline token).

def Config.without_pool source · line 464 · raw

@c:Config -> Config

The config with no connection pool: one connection per request, until a pool of its own is set (Config.with_pool).

def Config.server.name source · line 469 · raw

@+sn:String -> @none:Bool -> String

def Config.server source · line 478 · raw

@c:Config -> String

The API server, for logs: its URL, and the certificate name when one is set (tls-server-name). No credentials.