diff --git a/.gitignore b/.gitignore index 56aa2c2..c8ca8ba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ ROADMAP_SECURITY.md STRATEGIC.md TEST_COVERAGE_GAPS.md ARBIT_LESSONS.md +notes/ diff --git a/CHANGELOG.md b/CHANGELOG.md index f0fda00..eb9b8cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [Unreleased] + +### Added +- **Kubernetes ConfigMap watcher** (`src/kubernetes.rs`, `src/reload.rs`, `src/config.rs`): Arbitus can now watch a Kubernetes ConfigMap via the K8s API and hot-reload its configuration on every `Apply` event — no `SIGUSR1` or 30-second polling required. Set `kubernetes.configmap_name` in `gateway.yml` to enable. Namespace defaults to the pod's own namespace (read from the projected service-account token). Built as an optional feature (`kubernetes`, enabled by default in the official image) using `kube 0.98` + `kube-runtime`. The Helm chart gains a `kubernetesWatcher` section that automatically provisions the Role + RoleBinding and injects the `kubernetes:` config block. Closes #132. + +--- + ## [0.19.1] — 2026-04-06 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 52d719c..0d63c0d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,6 +111,8 @@ dependencies = [ "hex", "jsonschema 0.18.3", "jsonwebtoken 10.3.0", + "k8s-openapi", + "kube", "libc", "lru", "opentelemetry", @@ -147,9 +149,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07d1f37ff60921c83bdfc7407723bdefe89b44b98a9b772f225c8f9d67141a6" +checksum = "6a3a1fd6f75306b68087b831f025c712524bcb19aad54e557b1129cfa0a2b207" dependencies = [ "rustversion", ] @@ -193,6 +195,18 @@ dependencies = [ "syn", ] +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-stream" version = "0.3.6" @@ -381,6 +395,17 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "getrandom 0.2.17", + "instant", + "rand 0.8.5", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -470,9 +495,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.58" +version = "1.2.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" +checksum = "b7a4d3ec6524d28a329fc53654bbadc9bdd7b0431f5d65f1a56ffb28a1ee5283" dependencies = [ "find-msvc-tools", "jobserver", @@ -598,6 +623,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -674,6 +708,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -688,9 +728,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.7" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -830,6 +870,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "either" version = "1.15.0" @@ -875,6 +927,26 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_home" version = "0.1.0" @@ -897,6 +969,27 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + [[package]] name = "fallible-iterator" version = "0.3.0" @@ -933,9 +1026,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "a043dc74da1e37d6afe657061213aa6f425f855399a11d3463c6ecccc4dfda1f" [[package]] name = "ff" @@ -1113,9 +1206,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.7" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", @@ -1192,7 +1285,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.13.0", + "indexmap 2.13.1", "slab", "tokio", "tokio-util", @@ -1220,6 +1313,8 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.1.5", ] @@ -1243,6 +1338,30 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "headers" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" +dependencies = [ + "base64", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http", +] + [[package]] name = "heck" version = "0.5.0" @@ -1273,6 +1392,26 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "hostname" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" +dependencies = [ + "cfg-if", + "libc", + "windows-link", +] + [[package]] name = "http" version = "1.4.0" @@ -1320,9 +1459,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" dependencies = [ "atomic-waker", "bytes", @@ -1335,12 +1474,31 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "pin-utils", "smallvec", "tokio", "want", ] +[[package]] +name = "hyper-http-proxy" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ad4b0a1e37510028bc4ba81d0e38d239c39671b0f0ce9e02dfa93a8133f7c08" +dependencies = [ + "bytes", + "futures-util", + "headers", + "http", + "hyper", + "hyper-rustls", + "hyper-util", + "pin-project-lite", + "rustls-native-certs 0.7.3", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-rustls" version = "0.27.7" @@ -1350,7 +1508,9 @@ dependencies = [ "http", "hyper", "hyper-util", + "log", "rustls", + "rustls-native-certs 0.8.3", "rustls-pki-types", "tokio", "tokio-rustls", @@ -1422,12 +1582,13 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" dependencies = [ "displaydoc", "potential_utf", + "utf8_iter", "yoke", "zerofrom", "zerovec", @@ -1435,9 +1596,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" dependencies = [ "displaydoc", "litemap", @@ -1448,9 +1609,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -1462,15 +1623,15 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" [[package]] name = "icu_properties" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" dependencies = [ "icu_collections", "icu_locale_core", @@ -1482,15 +1643,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" [[package]] name = "icu_provider" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" dependencies = [ "displaydoc", "icu_locale_core", @@ -1540,9 +1701,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.13.0" +version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +checksum = "45a8a2b9cb3e0b0c1803dbb0758ffac5de2f425b23c28f518faabd9d805342ff" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -1550,6 +1711,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "ipnet" version = "2.12.0" @@ -1558,9 +1728,9 @@ checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" [[package]] name = "iri-string" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e7418f59cc01c88316161279a7f665217ae316b388e58a0d10e29f54f1e5eb" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" dependencies = [ "memchr", "serde", @@ -1670,9 +1840,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.92" +version = "0.3.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4c90f45aa2e6eacbe8645f77fdea542ac97a494bcd117a67df9ff4d611f995" +checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9" dependencies = [ "cfg-if", "futures-util", @@ -1680,6 +1850,41 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-patch" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "jsonpath-rust" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c00ae348f9f8fd2d09f82a98ca381c60df9e0820d8d79fce43e649b4dc3128b" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "jsonptr" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "jsonschema" version = "0.18.3" @@ -1770,6 +1975,115 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "k8s-openapi" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c75b990324f09bef15e791606b7b7a296d02fc88a344f6eba9390970a870ad5" +dependencies = [ + "base64", + "chrono", + "serde", + "serde-value", + "serde_json", +] + +[[package]] +name = "kube" +version = "0.98.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32053dc495efad4d188c7b33cc7c02ef4a6e43038115348348876efd39a53cba" +dependencies = [ + "k8s-openapi", + "kube-client", + "kube-core", + "kube-runtime", +] + +[[package]] +name = "kube-client" +version = "0.98.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d34ad38cdfbd1fa87195d42569f57bb1dda6ba5f260ee32fef9570b7937a0c9" +dependencies = [ + "base64", + "bytes", + "chrono", + "either", + "futures", + "home", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-http-proxy", + "hyper-rustls", + "hyper-timeout", + "hyper-util", + "jsonpath-rust", + "k8s-openapi", + "kube-core", + "pem", + "rustls", + "rustls-pemfile", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.18", + "tokio", + "tokio-util", + "tower 0.5.3", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-core" +version = "0.98.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97aa830b288a178a90e784d1b0f1539f2d200d2188c7b4a3146d9dc983d596f3" +dependencies = [ + "chrono", + "form_urlencoded", + "http", + "json-patch", + "k8s-openapi", + "serde", + "serde-value", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "kube-runtime" +version = "0.98.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a41af186a0fe80c71a13a13994abdc3ebff80859ca6a4b8a6079948328c135b" +dependencies = [ + "ahash", + "async-broadcast", + "async-stream", + "async-trait", + "backoff", + "educe", + "futures", + "hashbrown 0.15.5", + "hostname", + "json-patch", + "jsonptr", + "k8s-openapi", + "kube-client", + "parking_lot", + "pin-project", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1787,9 +2101,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.183" +version = "0.2.184" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" [[package]] name = "libm" @@ -1816,9 +2130,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" [[package]] name = "lock_api" @@ -2071,6 +2385,12 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + [[package]] name = "openssl-probe" version = "0.2.1" @@ -2154,6 +2474,15 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + [[package]] name = "outref" version = "0.5.2" @@ -2184,6 +2513,12 @@ dependencies = [ "sha2", ] +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.12.5" @@ -2232,6 +2567,49 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" +dependencies = [ + "pest", + "sha2", +] + [[package]] name = "phf" version = "0.12.1" @@ -2276,12 +2654,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkcs1" version = "0.7.5" @@ -2320,9 +2692,9 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" dependencies = [ "zerovec", ] @@ -2481,7 +2853,7 @@ dependencies = [ "once_cell", "socket2 0.6.3", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -2848,9 +3220,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" [[package]] name = "rustc_version" @@ -2899,16 +3271,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe 0.1.6", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework 2.11.1", +] + [[package]] name = "rustls-native-certs" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ - "openssl-probe", + "openssl-probe 0.2.1", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.7.0", ] [[package]] @@ -2942,10 +3327,10 @@ dependencies = [ "log", "once_cell", "rustls", - "rustls-native-certs", + "rustls-native-certs 0.8.3", "rustls-platform-verifier-android", "rustls-webpki", - "security-framework", + "security-framework 3.7.0", "security-framework-sys", "webpki-root-certs", "windows-sys 0.61.2", @@ -3039,6 +3424,28 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secrecy" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + [[package]] name = "security-framework" version = "3.7.0" @@ -3064,9 +3471,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" @@ -3078,6 +3485,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_core" version = "1.0.228" @@ -3140,7 +3557,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.13.0", + "indexmap 2.13.1", "itoa", "ryu", "serde", @@ -3435,9 +3852,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" dependencies = [ "displaydoc", "zerovec", @@ -3460,9 +3877,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.50.0" +version = "1.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd" dependencies = [ "bytes", "libc", @@ -3477,9 +3894,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", @@ -3517,6 +3934,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite", + "slab", "tokio", ] @@ -3581,6 +3999,7 @@ dependencies = [ "pin-project-lite", "sync_wrapper", "tokio", + "tokio-util", "tower-layer", "tower-service", "tracing", @@ -3592,16 +4011,19 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ + "base64", "bitflags", "bytes", "futures-util", "http", "http-body", "iri-string", + "mime", "pin-project-lite", "tower 0.5.3", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -3721,6 +4143,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicase" version = "2.9.0" @@ -3877,9 +4305,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.115" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6523d69017b7633e396a89c5efab138161ed5aafcbc8d3e5c5a42ae38f50495a" +checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" dependencies = [ "cfg-if", "once_cell", @@ -3890,9 +4318,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.65" +version = "0.4.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1faf851e778dfa54db7cd438b70758eba9755cb47403f3496edd7c8fc212f0" +checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e" dependencies = [ "js-sys", "wasm-bindgen", @@ -3900,9 +4328,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.115" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3a6c758eb2f701ed3d052ff5737f5bfe6614326ea7f3bbac7156192dc32e67" +checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3910,9 +4338,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.115" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921de2737904886b52bcbb237301552d05969a6f9c40d261eb0533c8b055fedf" +checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" dependencies = [ "bumpalo", "proc-macro2", @@ -3923,9 +4351,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.115" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a93e946af942b58934c604527337bad9ae33ba1d5c6900bbb41c2c07c2364a93" +checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" dependencies = [ "unicode-ident", ] @@ -3947,7 +4375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", - "indexmap 2.13.0", + "indexmap 2.13.1", "wasm-encoder", "wasmparser", ] @@ -3986,7 +4414,7 @@ checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", "hashbrown 0.15.5", - "indexmap 2.13.0", + "indexmap 2.13.1", "semver", ] @@ -4006,9 +4434,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.92" +version = "0.3.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84cde8507f4d7cfcb1185b8cb5890c494ffea65edbe1ba82cfd63661c805ed94" +checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a" dependencies = [ "js-sys", "wasm-bindgen", @@ -4035,9 +4463,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" dependencies = [ "rustls-pki-types", ] @@ -4151,6 +4579,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -4184,13 +4621,30 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -4203,6 +4657,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -4215,6 +4675,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -4227,12 +4693,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -4245,6 +4723,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -4257,6 +4741,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -4269,6 +4759,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -4281,6 +4777,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winsafe" version = "0.0.19" @@ -4315,7 +4817,7 @@ checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck", - "indexmap 2.13.0", + "indexmap 2.13.1", "prettyplease", "syn", "wasm-metadata", @@ -4346,7 +4848,7 @@ checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", "bitflags", - "indexmap 2.13.0", + "indexmap 2.13.1", "log", "serde", "serde_derive", @@ -4365,7 +4867,7 @@ checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", - "indexmap 2.13.0", + "indexmap 2.13.1", "log", "semver", "serde", @@ -4377,9 +4879,9 @@ dependencies = [ [[package]] name = "writeable" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" [[package]] name = "x509-parser" @@ -4400,9 +4902,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -4411,9 +4913,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", @@ -4423,18 +4925,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.47" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.47" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", @@ -4443,18 +4945,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", @@ -4470,9 +4972,9 @@ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" dependencies = [ "displaydoc", "yoke", @@ -4481,9 +4983,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" dependencies = [ "yoke", "zerofrom", @@ -4492,9 +4994,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 5765d1a..2a08abe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,10 @@ path = "src/bin/dummy_server.rs" name = "arbitus" path = "src/bin/arbitus.rs" +[features] +default = ["kubernetes"] +kubernetes = ["dep:kube", "dep:k8s-openapi"] + [dependencies] clap = { version = "4", features = ["derive"] } axum = "0.8" @@ -56,6 +60,8 @@ sha2 = "0.10" hex = "0.4" which = "7" lru = "0.16.3" +kube = { version = "0.98", features = ["client", "runtime"], optional = true } +k8s-openapi = { version = "0.24", features = ["v1_31"], optional = true } regorus = "0.2" tower = "0.5" tokio-rustls = "0.26" diff --git a/README.md b/README.md index 8b302ce..4740738 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Agent (Cursor, Claude, etc.) - **OpenAI Tools Bridge** — `/openai/v1/tools` and `/openai/v1/execute` for OpenAI function-calling clients - **Multiple upstreams** — route different agents to different MCP servers - **Circuit breaker** — automatic upstream failure isolation with half-open recovery -- **Config hot-reload** — reload on `SIGUSR1` or automatically every 30 seconds +- **Config hot-reload** — reload on `SIGUSR1`, automatically every 30 seconds, or event-driven via Kubernetes ConfigMap watcher - **Metrics** — Prometheus-compatible `/metrics` endpoint with cost/token estimation - **OpenTelemetry** — export traces to any OTLP backend (Jaeger, Tempo, Honeycomb, Datadog) - **Dashboard** — `/dashboard` audit viewer with per-agent filtering diff --git a/charts/arbitus/templates/configmap.yaml b/charts/arbitus/templates/configmap.yaml index 14bc05f..4e5208b 100644 --- a/charts/arbitus/templates/configmap.yaml +++ b/charts/arbitus/templates/configmap.yaml @@ -7,3 +7,11 @@ metadata: data: gateway.yml: | {{- .Values.config.gateway | nindent 4 }} + {{- if .Values.kubernetesWatcher.enabled }} + kubernetes: + configmap_name: {{ .Values.kubernetesWatcher.configMapName | default (include "arbitus.fullname" .) | quote }} + {{- if .Values.kubernetesWatcher.namespace }} + namespace: {{ .Values.kubernetesWatcher.namespace | quote }} + {{- end }} + key: {{ .Values.kubernetesWatcher.key | quote }} + {{- end }} diff --git a/charts/arbitus/templates/rbac.yaml b/charts/arbitus/templates/rbac.yaml new file mode 100644 index 0000000..f1bc3da --- /dev/null +++ b/charts/arbitus/templates/rbac.yaml @@ -0,0 +1,32 @@ +{{- if .Values.kubernetesWatcher.enabled }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "arbitus.fullname" . }}-configmap-watcher + namespace: {{ .Release.Namespace }} + labels: + {{- include "arbitus.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["configmaps"] + resourceNames: + - {{ .Values.kubernetesWatcher.configMapName | default (include "arbitus.fullname" .) | quote }} + verbs: ["get", "list", "watch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "arbitus.fullname" . }}-configmap-watcher + namespace: {{ .Release.Namespace }} + labels: + {{- include "arbitus.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ include "arbitus.fullname" . }}-configmap-watcher +subjects: + - kind: ServiceAccount + name: {{ include "arbitus.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/arbitus/values.yaml b/charts/arbitus/values.yaml index 80bb188..575f34c 100644 --- a/charts/arbitus/values.yaml +++ b/charts/arbitus/values.yaml @@ -163,3 +163,18 @@ affinity: {} # ── Graceful shutdown ───────────────────────────────────────────────────────── # Should match terminationGracePeriodSeconds to allow audit flush before SIGKILL. terminationGracePeriodSeconds: 30 + +# ── Kubernetes ConfigMap watcher ────────────────────────────────────────────── +# When enabled, Arbitus watches the named ConfigMap via the K8s API and +# hot-reloads its config on every Apply event — no SIGUSR1 or 30-second +# polling needed. Requires the `kubernetes` Cargo feature (on by default in +# the official image). Creates a Role + RoleBinding for the ServiceAccount. +kubernetesWatcher: + enabled: false + # Name of the ConfigMap to watch. + # Defaults to the chart's fullname (the same ConfigMap that holds gateway.yml). + configMapName: "" + # Namespace of the ConfigMap. Leave empty to use the pod's own namespace. + namespace: "" + # Key within ConfigMap.data that contains the gateway YAML. + key: "gateway.yml" diff --git a/src/bin/arbitus.rs b/src/bin/arbitus.rs index 089ea38..cbb6f1c 100644 --- a/src/bin/arbitus.rs +++ b/src/bin/arbitus.rs @@ -1,5 +1,4 @@ use arbitus::a2a::{A2aPolicyInterceptor, A2aProxyExecutor}; -use arbitus::live_config::OpaPolicy; use arbitus::{ audit::{ AuditLog, @@ -15,6 +14,7 @@ use arbitus::{ hitl::HitlStore, jwt::MultiJwtValidator, live_config::LiveConfig, + live_config::OpaPolicy, metrics::GatewayMetrics, middleware::{ Pipeline, auth::AuthMiddleware, hitl::HitlMiddleware, opa::OpaMiddleware, @@ -22,7 +22,7 @@ use arbitus::{ schema_validation::SchemaValidationMiddleware, }, oauth::OAuthManager, - prompt_injection, + prompt_injection, reload, schema_cache::SchemaCache, secrets::{self, openbao::OpenBaoProvider}, transport::{ @@ -224,6 +224,8 @@ async fn cmd_start(config_path: String) -> anyhow::Result<()> { }; // ── Live config ─────────────────────────────────────────────────────────── + let kubernetes_cfg = config.kubernetes.clone(); + let block_patterns: Vec = config .rules .block_patterns @@ -261,7 +263,7 @@ async fn cmd_start(config_path: String) -> anyhow::Result<()> { // ── Hot-reload ──────────────────────────────────────────────────────────── { let reload_path = config_path.clone(); - let tx = config_tx; + let tx = config_tx.clone(); let reload_metrics = Arc::clone(&metrics); tokio::spawn(async move { #[cfg(unix)] @@ -314,6 +316,17 @@ async fn cmd_start(config_path: String) -> anyhow::Result<()> { }); } + // ── Kubernetes ConfigMap watcher ────────────────────────────────────────── + #[cfg(feature = "kubernetes")] + if let Some(k8s_cfg) = kubernetes_cfg { + let watcher_metrics = Arc::clone(&metrics); + tokio::spawn(arbitus::kubernetes::watch_configmap( + k8s_cfg, + config_tx, + watcher_metrics, + )); + } + // ── Pipeline ────────────────────────────────────────────────────────────── let schema_cache = SchemaCache::new(); let hitl_store = HitlStore::new(); @@ -1015,44 +1028,9 @@ fn do_reload( metrics: &GatewayMetrics, last_error: &mut Option, ) { - match Config::from_file(reload_path) { - Ok(new_cfg) => { - *last_error = None; - let new_patterns: Vec = new_cfg - .rules - .block_patterns - .iter() - .filter_map(|p| { - Regex::new(p) - .map_err(|e| { - tracing::warn!(pattern = p, error = %e, "invalid regex in reloaded config") - }) - .ok() - }) - .collect(); - let new_injection: Vec = if new_cfg.rules.block_prompt_injection { - prompt_injection::PATTERNS - .iter() - .filter_map(|p| Regex::new(p).ok()) - .collect() - } else { - vec![] - }; - let new_opa = load_opa_policy(new_cfg.rules.opa.as_ref()); - let new_live = Arc::new( - LiveConfig::new( - new_cfg.agents, - new_patterns, - new_injection, - new_cfg.rules.ip_rate_limit, - new_cfg.rules.filter_mode, - new_cfg.default_policy, - ) - .with_opa_policy(new_opa), - ); - if tx.send(new_live).is_ok() { - tracing::info!(path = reload_path, "config reloaded"); - } + match std::fs::read_to_string(reload_path) { + Ok(yaml) => { + reload::reload_from_yaml(&yaml, tx, metrics, last_error, reload_path); } Err(e) => { metrics.record_config_reload_failure(); @@ -1061,7 +1039,7 @@ fn do_reload( .map(|t| now.duration_since(t).as_secs() >= 5) .unwrap_or(true); if should_log { - tracing::error!(error = %e, "config reload failed — keeping previous config"); + tracing::error!(path = reload_path, error = %e, "config reload failed — could not read file"); *last_error = Some(now); } } diff --git a/src/config.rs b/src/config.rs index 184ac65..12d06ef 100644 --- a/src/config.rs +++ b/src/config.rs @@ -38,6 +38,12 @@ pub struct Config { /// JSON-RPC proxy at `a2a.mount` and enforces per-agent policies on incoming requests. #[serde(default)] pub a2a: Option, + /// Kubernetes ConfigMap watcher. When present, Arbitus subscribes to the named + /// ConfigMap via the K8s API and hot-reloads config whenever the data changes. + /// Requires the binary to be built with the `kubernetes` feature and appropriate + /// RBAC (get/list/watch on the ConfigMap). + #[serde(default)] + pub kubernetes: Option, } // ── A2A ────────────────────────────────────────────────────────────────────── @@ -91,6 +97,30 @@ fn default_a2a_version() -> String { "1.0.0".to_string() } +// ── Kubernetes ─────────────────────────────────────────────────────────────── + +/// Configuration for the Kubernetes ConfigMap watcher. +/// When present, Arbitus watches the named ConfigMap via the K8s API and +/// hot-reloads its config on every `Apply` event — no SIGUSR1 or 30-second +/// polling needed. +#[derive(Debug, Deserialize, Clone)] +pub struct KubernetesConfig { + /// Name of the ConfigMap to watch (required). + pub configmap_name: String, + /// Namespace of the ConfigMap. Defaults to the pod's own namespace + /// (read from `/var/run/secrets/kubernetes.io/serviceaccount/namespace`). + #[serde(default)] + pub namespace: Option, + /// Key within `ConfigMap.data` that contains the gateway YAML. + /// Defaults to `"gateway.yml"`. + #[serde(default = "default_configmap_key")] + pub key: String, +} + +fn default_configmap_key() -> String { + "gateway.yml".to_string() +} + // ── Transport ──────────────────────────────────────────────────────────────── #[derive(Debug, Deserialize)] @@ -747,7 +777,15 @@ impl Config { pub fn from_file(path: &str) -> anyhow::Result { let raw = std::fs::read_to_string(path) .map_err(|e| anyhow::anyhow!("could not read '{}': {}", path, e))?; - let interpolated = crate::env_config::interpolate_env_vars(&raw)?; + Self::from_yaml_str(&raw) + } + + /// Parse a `Config` from a YAML string. + /// Performs env-var interpolation, env overrides, and validation — identical + /// to `from_file` but without the filesystem read. Used by the Kubernetes + /// ConfigMap watcher and any caller that already has the YAML in memory. + pub fn from_yaml_str(yaml: &str) -> anyhow::Result { + let interpolated = crate::env_config::interpolate_env_vars(yaml)?; let mut config: Self = serde_yaml::from_str(&interpolated) .map_err(|e| anyhow::anyhow!("invalid config: {}", e))?; crate::env_config::apply_env_overrides(&mut config); @@ -875,6 +913,7 @@ mod tests { telemetry: None, secrets: None, a2a: None, + kubernetes: None, } } diff --git a/src/kubernetes.rs b/src/kubernetes.rs new file mode 100644 index 0000000..b290448 --- /dev/null +++ b/src/kubernetes.rs @@ -0,0 +1,78 @@ +//! Kubernetes ConfigMap watcher. +//! +//! When Arbitus is deployed in-cluster and `kubernetes.configmap_name` is set, +//! this module subscribes to the named ConfigMap via the K8s API and triggers a +//! live config reload on every `Apply` event — replacing the 30-second file +//! polling loop with an event-driven reload. +//! +//! Requires the `kubernetes` Cargo feature and a Kubernetes RBAC Role that +//! grants `get`, `list`, and `watch` on the target ConfigMap. + +use futures_util::StreamExt; +use k8s_openapi::api::core::v1::ConfigMap; +use kube::{Api, Client, runtime::watcher}; +use std::sync::Arc; +use tokio::sync::watch; + +use crate::{config::KubernetesConfig, live_config::LiveConfig, metrics::GatewayMetrics, reload}; + +/// Returns the pod's namespace from the projected service-account token. +/// Falls back to `"default"` when running outside a cluster. +fn pod_namespace() -> String { + std::fs::read_to_string("/var/run/secrets/kubernetes.io/serviceaccount/namespace") + .map(|s| s.trim().to_string()) + .unwrap_or_else(|_| "default".to_string()) +} + +/// Watches a Kubernetes ConfigMap and pushes config reloads through `tx` +/// whenever the ConfigMap data changes. +/// +/// Runs indefinitely; spawn with `tokio::spawn`. +pub async fn watch_configmap( + cfg: KubernetesConfig, + tx: watch::Sender>, + metrics: Arc, +) { + let client = match Client::try_default().await { + Ok(c) => c, + Err(e) => { + tracing::error!( + error = %e, + "kubernetes: failed to build in-cluster client — ConfigMap watcher disabled" + ); + return; + } + }; + + let namespace = cfg.namespace.clone().unwrap_or_else(pod_namespace); + let cms: Api = Api::namespaced(client, &namespace); + let watcher_config = + watcher::Config::default().fields(&format!("metadata.name={}", cfg.configmap_name)); + + let source = format!("ConfigMap {}/{}", namespace, cfg.configmap_name); + let mut stream = watcher(cms, watcher_config).boxed(); + let mut last_error: Option = None; + + tracing::info!( + configmap = %cfg.configmap_name, + namespace = %namespace, + key = %cfg.key, + "kubernetes: ConfigMap watcher started" + ); + + while let Some(event) = stream.next().await { + match event { + Ok(watcher::Event::Apply(cm)) | Ok(watcher::Event::InitApply(cm)) => { + if let Some(data) = cm.data + && let Some(yaml) = data.get(&cfg.key) + { + reload::reload_from_yaml(yaml, &tx, &metrics, &mut last_error, &source); + } + } + Err(e) => { + tracing::warn!(error = %e, "kubernetes: watcher error — will retry"); + } + _ => {} + } + } +} diff --git a/src/lib.rs b/src/lib.rs index 5be26c1..028a56c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,12 +7,15 @@ pub mod env_config; pub mod gateway; pub mod hitl; pub mod jwt; +#[cfg(feature = "kubernetes")] +pub mod kubernetes; pub mod live_config; pub mod metrics; pub mod middleware; pub mod oauth; pub mod openai_bridge; pub mod prompt_injection; +pub mod reload; pub mod schema_cache; pub mod secrets; pub mod transport; diff --git a/src/reload.rs b/src/reload.rs new file mode 100644 index 0000000..c87a3ec --- /dev/null +++ b/src/reload.rs @@ -0,0 +1,111 @@ +//! Config reload helpers shared by the file-based hot-reload loop and the +//! Kubernetes ConfigMap watcher. + +use crate::{ + config::{Config, OpaConfig}, + live_config::{LiveConfig, OpaPolicy}, + metrics::GatewayMetrics, + prompt_injection, +}; +use regex::Regex; +use std::{sync::Arc, time::Instant}; +use tokio::sync::watch; + +fn load_opa_policy(cfg: Option<&OpaConfig>) -> Option> { + let cfg = cfg?; + match std::fs::read_to_string(&cfg.policy_path) { + Ok(content) => { + tracing::info!( + path = %cfg.policy_path, + entrypoint = %cfg.entrypoint, + "OPA policy loaded" + ); + Some(Arc::new(OpaPolicy { + entrypoint: cfg.entrypoint.clone(), + content, + })) + } + Err(e) => { + tracing::warn!( + path = %cfg.policy_path, + error = %e, + "failed to load OPA policy — OPA disabled" + ); + None + } + } +} + +/// Build a `LiveConfig` from a parsed `Config`. Compiles block-patterns and +/// injection-patterns, loads the OPA policy if configured, and wraps everything +/// in an `Arc` ready to broadcast on the watch channel. +pub fn build_live_config(cfg: Config) -> Arc { + let block_patterns: Vec = cfg + .rules + .block_patterns + .iter() + .filter_map(|p| { + Regex::new(p) + .map_err( + |e| tracing::warn!(pattern = p, error = %e, "invalid regex in reloaded config"), + ) + .ok() + }) + .collect(); + + let injection_patterns: Vec = if cfg.rules.block_prompt_injection { + prompt_injection::PATTERNS + .iter() + .filter_map(|p| Regex::new(p).ok()) + .collect() + } else { + vec![] + }; + + let opa = load_opa_policy(cfg.rules.opa.as_ref()); + + Arc::new( + LiveConfig::new( + cfg.agents, + block_patterns, + injection_patterns, + cfg.rules.ip_rate_limit, + cfg.rules.filter_mode, + cfg.default_policy, + ) + .with_opa_policy(opa), + ) +} + +/// Parse `yaml`, build a `LiveConfig`, and broadcast it on `tx`. +/// Records a reload-failure metric and rate-limits error logs on parse errors. +/// `source` is a human-readable label used in log messages (e.g. a file path or +/// `"ConfigMap "`). +pub fn reload_from_yaml( + yaml: &str, + tx: &watch::Sender>, + metrics: &GatewayMetrics, + last_error: &mut Option, + source: &str, +) { + match Config::from_yaml_str(yaml) { + Ok(cfg) => { + *last_error = None; + let new_live = build_live_config(cfg); + if tx.send(new_live).is_ok() { + tracing::info!(source, "config reloaded"); + } + } + Err(e) => { + metrics.record_config_reload_failure(); + let now = Instant::now(); + let should_log = last_error + .map(|t| now.duration_since(t).as_secs() >= 5) + .unwrap_or(true); + if should_log { + tracing::error!(source, error = %e, "config reload failed — keeping previous config"); + *last_error = Some(now); + } + } + } +}