From f105ddb778da469fdf961cc7e7b4e2b13bcfe6fe Mon Sep 17 00:00:00 2001 From: Folke Behrens Date: Fri, 21 Feb 2025 22:57:38 +0100 Subject: [PATCH] aws lambda function for periodic collection of pod infomation --- Cargo.lock | 861 ++++++++++++++++++++++++----- Cargo.toml | 10 + lambda/pod_info_dumper/Cargo.toml | 27 + lambda/pod_info_dumper/README.md | 8 + lambda/pod_info_dumper/src/lib.rs | 419 ++++++++++++++ lambda/pod_info_dumper/src/main.rs | 3 + 6 files changed, 1186 insertions(+), 142 deletions(-) create mode 100644 lambda/pod_info_dumper/Cargo.toml create mode 100644 lambda/pod_info_dumper/README.md create mode 100644 lambda/pod_info_dumper/src/lib.rs create mode 100644 lambda/pod_info_dumper/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 03a376cdae..404b09b91e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -271,14 +271,14 @@ dependencies = [ "aws-sdk-ssooidc", "aws-sdk-sts", "aws-smithy-async", - "aws-smithy-http", + "aws-smithy-http 0.60.12", "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.2.0", + "fastrand 2.3.0", "hex", "http 0.2.9", "ring", @@ -291,9 +291,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60e8f6b615cb5fc60a98132268508ad104310f0cfb25a1c22eee76efdf9154da" +checksum = "4471bef4c22a06d2c7a1b6492493d3fdf24a805323109d6874f9c94d5906ac14" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -302,22 +302,45 @@ dependencies = [ ] [[package]] -name = "aws-runtime" -version = "1.4.4" +name = "aws-lc-rs" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5ac934720fbb46206292d2c75b57e67acfc56fe7dfd34fb9a02334af08409ea" +checksum = "19b756939cb2f8dc900aa6dcd505e6e2428e9cae7ff7b028c49e3946efa70878" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f7720b74ed28ca77f90769a71fd8c637a0137f6fae4ae947e1050229cff57f" +dependencies = [ + "bindgen 0.69.5", + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "aws-runtime" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aff45ffe35196e593ea3b9dd65b320e51e2dda95aff4390bc459e461d09c6ad" dependencies = [ "aws-credential-types", "aws-sigv4", "aws-smithy-async", "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-http 0.62.0", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.2.0", + "fastrand 2.3.0", "http 0.2.9", "http-body 0.4.5", "once_cell", @@ -327,6 +350,29 @@ dependencies = [ "uuid", ] +[[package]] +name = "aws-sdk-eks" +version = "1.75.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd6c39e07cf5e4b56ea4999653cf15b53c8c114bcd455cf8f649daad7d8eedd" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "fastrand 2.3.0", + "http 0.2.9", + "once_cell", + "regex-lite", + "tracing", +] + [[package]] name = "aws-sdk-iam" version = "1.53.0" @@ -336,8 +382,8 @@ dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", "aws-smithy-query", "aws-smithy-runtime", "aws-smithy-runtime-api", @@ -359,8 +405,8 @@ dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -384,15 +430,15 @@ dependencies = [ "aws-smithy-async", "aws-smithy-checksums", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", "aws-smithy-xml", "aws-types", "bytes", - "fastrand 2.2.0", + "fastrand 2.3.0", "hex", "hmac", "http 0.2.9", @@ -415,8 +461,8 @@ dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -437,8 +483,8 @@ dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.60.12", + "aws-smithy-json 0.61.3", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -452,21 +498,22 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.51.0" +version = "1.65.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68fde0d69c8bfdc1060ea7da21df3e39f6014da316783336deff0a9ec28f4bf" +checksum = "96a78a8f50a1630db757b60f679c8226a8a70ee2ab5f5e6e51dc67f6c61c7cfd" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json 0.61.1", + "aws-smithy-http 0.62.0", + "aws-smithy-json 0.61.3", "aws-smithy-query", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", "aws-smithy-xml", "aws-types", + "fastrand 2.3.0", "http 0.2.9", "once_cell", "regex-lite", @@ -475,13 +522,13 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.2.6" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3820e0c08d0737872ff3c7c1f21ebbb6693d832312d6152bf18ef50a5471c2" +checksum = "69d03c3c05ff80d54ff860fe38c726f6f494c639ae975203a101335f223386db" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-http 0.62.0", "aws-smithy-runtime-api", "aws-smithy-types", "bytes", @@ -504,9 +551,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.2.1" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62220bc6e97f946ddd51b5f1361f78996e704677afc518a4ff66b7a72ea1378c" +checksum = "1e190749ea56f8c42bf15dd76c65e14f8f765233e6df9b0506d9d934ebef867c" dependencies = [ "futures-util", "pin-project-lite", @@ -519,7 +566,7 @@ version = "0.60.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba1a71073fca26775c8b5189175ea8863afb1c9ea2cceb02a5de5ad9dfbaa795" dependencies = [ - "aws-smithy-http", + "aws-smithy-http 0.60.12", "aws-smithy-types", "bytes", "crc32c", @@ -536,9 +583,9 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.60.5" +version = "0.60.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef7d0a272725f87e51ba2bf89f8c21e4df61b9e49ae1ac367a6d69916ef7c90" +checksum = "7c45d3dddac16c5c59d553ece225a88870cf81b7b813c9cc17b78cf4685eac7a" dependencies = [ "aws-smithy-types", "bytes", @@ -547,9 +594,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.60.11" +version = "0.60.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8bc3e8fdc6b8d07d976e301c02fe553f72a39b7a9fea820e023268467d7ab6" +checksum = "7809c27ad8da6a6a68c454e651d4962479e81472aa19ae99e59f9aba1f9713cc" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -566,6 +613,55 @@ dependencies = [ "tracing", ] +[[package]] +name = "aws-smithy-http" +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5949124d11e538ca21142d1fba61ab0a2a2c1bc3ed323cdb3e4b878bfb83166" +dependencies = [ + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes", + "bytes-utils", + "futures-core", + "http 0.2.9", + "http 1.1.0", + "http-body 0.4.5", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + +[[package]] +name = "aws-smithy-http-client" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aff1159006441d02e57204bf57a1b890ba68bedb6904ffd2873c1c4c11c546b" +dependencies = [ + "aws-smithy-async", + "aws-smithy-runtime-api", + "aws-smithy-types", + "h2 0.4.4", + "http 0.2.9", + "http 1.1.0", + "http-body 0.4.5", + "hyper 0.14.30", + "hyper 1.6.0", + "hyper-rustls 0.24.0", + "hyper-rustls 0.27.5", + "hyper-util", + "pin-project-lite", + "rustls 0.21.12", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", + "rustls-pki-types", + "tokio", + "tower 0.5.2", + "tracing", +] + [[package]] name = "aws-smithy-json" version = "0.60.7" @@ -577,13 +673,23 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.61.1" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4e69cc50921eb913c6b662f8d909131bb3e6ad6cb6090d3a39b66fc5c52095" +checksum = "92144e45819cae7dc62af23eac5a038a58aa544432d2102609654376a900bd07" dependencies = [ "aws-smithy-types", ] +[[package]] +name = "aws-smithy-observability" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445d065e76bc1ef54963db400319f1dd3ebb3e0a74af20f7f7630625b0cc7cc0" +dependencies = [ + "aws-smithy-runtime-api", + "once_cell", +] + [[package]] name = "aws-smithy-query" version = "0.60.7" @@ -596,36 +702,34 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.7.4" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f20685047ca9d6f17b994a07f629c813f08b5bce65523e47124879e60103d45" +checksum = "0152749e17ce4d1b47c7747bdfec09dac1ccafdcbc741ebf9daa2a373356730f" dependencies = [ "aws-smithy-async", - "aws-smithy-http", + "aws-smithy-http 0.62.0", + "aws-smithy-http-client", + "aws-smithy-observability", "aws-smithy-runtime-api", "aws-smithy-types", "bytes", - "fastrand 2.2.0", - "h2 0.3.26", + "fastrand 2.3.0", "http 0.2.9", + "http 1.1.0", "http-body 0.4.5", - "http-body 1.0.0", - "httparse", - "hyper 0.14.30", - "hyper-rustls 0.24.0", + "http-body 1.0.1", "once_cell", "pin-project-lite", "pin-utils", - "rustls 0.21.12", "tokio", "tracing", ] [[package]] name = "aws-smithy-runtime-api" -version = "1.7.3" +version = "1.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92165296a47a812b267b4f41032ff8069ab7ff783696d217f0994a0d7ab585cd" +checksum = "3da37cf5d57011cb1753456518ec76e31691f1f474b73934a284eb2a1c76510f" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -640,9 +744,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.2.9" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbd94a32b3a7d55d3806fe27d98d3ad393050439dd05eb53ece36ec5e3d3510" +checksum = "836155caafba616c0ff9b07944324785de2ab016141c3550bd1c07882f8cee8f" dependencies = [ "base64-simd", "bytes", @@ -651,7 +755,7 @@ dependencies = [ "http 0.2.9", "http 1.1.0", "http-body 0.4.5", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "itoa", "num-integer", @@ -675,9 +779,9 @@ dependencies = [ [[package]] name = "aws-types" -version = "1.3.3" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5221b91b3e441e6675310829fd8984801b772cb1546ef6c0e54dec9f1ac13fef" +checksum = "3873f8deed8927ce8d04487630dc9ff73193bab64742a61d050e57a68dec4125" dependencies = [ "aws-credential-types", "aws-smithy-async", @@ -687,6 +791,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "aws_lambda_events" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ddb91585253ccc85be3f2e0d5635529efdeadaf8a1da3230b433d3bbe43648" +dependencies = [ + "base64 0.22.1", + "chrono", + "serde", + "serde_json", + "serde_with 3.12.0", +] + [[package]] name = "axum" version = "0.8.1" @@ -699,9 +816,9 @@ dependencies = [ "form_urlencoded", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "itoa", "matchit", @@ -733,7 +850,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", @@ -756,7 +873,7 @@ dependencies = [ "futures-util", "headers", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", @@ -965,6 +1082,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags 2.8.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn 2.0.100", + "which", +] + [[package]] name = "bindgen" version = "0.71.1" @@ -1044,9 +1184,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" dependencies = [ "serde", ] @@ -1232,6 +1372,15 @@ dependencies = [ "replace_with", ] +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -1270,7 +1419,7 @@ version = "0.1.0" dependencies = [ "anyhow", "chrono", - "indexmap 2.0.1", + "indexmap 2.8.0", "jsonwebtoken", "regex", "remote_storage", @@ -1301,7 +1450,7 @@ dependencies = [ "flate2", "futures", "http 1.1.0", - "indexmap 2.0.1", + "indexmap 2.8.0", "jsonwebtoken", "metrics", "nix 0.27.1", @@ -1321,7 +1470,7 @@ dependencies = [ "rust-ini", "serde", "serde_json", - "serde_with", + "serde_with 2.3.3", "signal-hook", "spki 0.7.3", "tar", @@ -1462,10 +1611,20 @@ dependencies = [ ] [[package]] -name = "core-foundation-sys" -version = "0.8.4" +name = "core-foundation" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpp_demangle" @@ -1647,6 +1806,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "csv" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" +dependencies = [ + "memchr", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -1929,6 +2109,12 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.14" @@ -2188,9 +2374,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -2290,7 +2476,7 @@ dependencies = [ "futures-core", "futures-sink", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "pin-project", "rand 0.8.5", @@ -2300,6 +2486,12 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "fsevent-sys" version = "4.1.0" @@ -2557,7 +2749,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.9", - "indexmap 2.0.1", + "indexmap 2.8.0", "slab", "tokio", "tokio-util", @@ -2576,7 +2768,7 @@ dependencies = [ "futures-sink", "futures-util", "http 1.1.0", - "indexmap 2.0.1", + "indexmap 2.8.0", "slab", "tokio", "tokio-util", @@ -2717,6 +2909,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "hostname" version = "0.4.0" @@ -2763,9 +2964,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -2780,10 +2981,20 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] +[[package]] +name = "http-serde" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f056c8559e3757392c8d091e796416e4649d8e49e88b8d76df6c002f05027fd" +dependencies = [ + "http 1.1.0", + "serde", +] + [[package]] name = "http-types" version = "2.12.0" @@ -2822,7 +3033,7 @@ dependencies = [ "pprof", "regex", "routerify", - "rustls 0.23.18", + "rustls 0.23.25", "rustls-pemfile 2.1.1", "serde", "serde_json", @@ -2841,9 +3052,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -2893,16 +3104,16 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", "futures-util", "h2 0.4.4", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -2912,6 +3123,26 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-http-proxy" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d06dbdfbacf34d996c6fb540a71a684a7aae9056c71951163af8a8a4c07b9a4" +dependencies = [ + "bytes", + "futures-util", + "headers", + "http 1.1.0", + "hyper 1.6.0", + "hyper-rustls 0.27.5", + "hyper-util", + "pin-project-lite", + "rustls-native-certs 0.7.0", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-rustls" version = "0.24.0" @@ -2935,7 +3166,7 @@ checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "rustls 0.22.4", "rustls-pki-types", @@ -2944,13 +3175,32 @@ dependencies = [ "tower-service", ] +[[package]] +name = "hyper-rustls" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.6.0", + "hyper-util", + "log", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "pin-project-lite", "tokio", @@ -2959,20 +3209,19 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", - "hyper 1.4.1", + "http-body 1.0.1", + "hyper 1.6.0", "pin-project-lite", "socket2", "tokio", - "tower 0.4.13", "tower-service", "tracing", ] @@ -3158,12 +3407,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -3186,7 +3435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88" dependencies = [ "ahash", - "indexmap 2.0.1", + "indexmap 2.8.0", "is-terminal", "itoa", "log", @@ -3209,7 +3458,7 @@ dependencies = [ "crossbeam-utils", "dashmap 6.1.0", "env_logger", - "indexmap 2.0.1", + "indexmap 2.8.0", "itoa", "log", "num-format", @@ -3420,6 +3669,19 @@ dependencies = [ "serde_json", ] +[[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.11", +] + [[package]] name = "jsonwebtoken" version = "9.2.0" @@ -3435,6 +3697,19 @@ 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 0.22.1", + "chrono", + "serde", + "serde-value", + "serde_json", +] + [[package]] name = "kqueue" version = "1.0.8" @@ -3455,6 +3730,119 @@ dependencies = [ "libc", ] +[[package]] +name = "kube" +version = "0.99.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4eb20010536b48abe97fec37d23d43069bcbe9686adcf9932202327bc5ca6e" +dependencies = [ + "k8s-openapi", + "kube-client", + "kube-core", +] + +[[package]] +name = "kube-client" +version = "0.99.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc2ed952042df20d15ac2fe9614d0ec14b6118eab89633985d4b36e688dccf1" +dependencies = [ + "base64 0.22.1", + "bytes", + "chrono", + "either", + "futures", + "home", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.6.0", + "hyper-http-proxy", + "hyper-rustls 0.27.5", + "hyper-timeout", + "hyper-util", + "jsonpath-rust", + "k8s-openapi", + "kube-core", + "pem", + "rustls 0.23.25", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.11", + "tokio", + "tokio-util", + "tower 0.5.2", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-core" +version = "0.99.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff0d0793db58e70ca6d689489183816cb3aa481673e7433dc618cf7e8007c675" +dependencies = [ + "chrono", + "form_urlencoded", + "http 1.1.0", + "k8s-openapi", + "serde", + "serde-value", + "serde_json", + "thiserror 2.0.11", +] + +[[package]] +name = "lambda_runtime" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed49669d6430292aead991e19bf13153135a884f916e68f32997c951af637ebe" +dependencies = [ + "async-stream", + "base64 0.22.1", + "bytes", + "futures", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "http-serde", + "hyper 1.6.0", + "hyper-util", + "lambda_runtime_api_client", + "pin-project", + "serde", + "serde_json", + "serde_path_to_error", + "tokio", + "tokio-stream", + "tower 0.4.13", + "tower-layer", + "tracing", +] + +[[package]] +name = "lambda_runtime_api_client" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c90a10f094475a34a04da2be11686c4dcfe214d93413162db9ffdff3d3af293a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.6.0", + "hyper-util", + "tokio", + "tower 0.4.13", + "tower-service", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lasso" version = "0.7.2" @@ -3474,6 +3862,12 @@ dependencies = [ "spin", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.169" @@ -4266,13 +4660,13 @@ dependencies = [ "remote_storage", "reqwest", "rpds", - "rustls 0.23.18", + "rustls 0.23.25", "scopeguard", "send-future", "serde", "serde_json", "serde_path_to_error", - "serde_with", + "serde_with 2.3.3", "smallvec", "storage_broker", "strum", @@ -4324,7 +4718,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_with", + "serde_with 2.3.3", "storage_broker", "strum", "strum_macros", @@ -4527,6 +4921,51 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" +dependencies = [ + "memchr", + "thiserror 2.0.11", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.6.3" @@ -4577,9 +5016,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -4652,6 +5091,32 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "pod_info_dumper" +version = "0.0.0" +dependencies = [ + "aws-config", + "aws-sdk-eks", + "aws-sdk-s3", + "aws-sdk-sts", + "aws-sigv4", + "aws_lambda_events", + "base64 0.22.1", + "csv", + "http 1.1.0", + "k8s-openapi", + "kube", + "lambda_runtime", + "rustls 0.23.25", + "rustls-pemfile 2.1.1", + "secrecy", + "serde", + "serde_json", + "sha2", + "tokio", + "tracing", +] + [[package]] name = "polonius-the-crab" version = "0.4.2" @@ -4752,7 +5217,7 @@ dependencies = [ "bytes", "once_cell", "pq_proto", - "rustls 0.23.18", + "rustls 0.23.25", "rustls-pemfile 2.1.1", "serde", "thiserror 1.0.69", @@ -4780,7 +5245,7 @@ name = "postgres_ffi" version = "0.1.0" dependencies = [ "anyhow", - "bindgen", + "bindgen 0.71.1", "bytes", "crc32c", "criterion", @@ -5095,9 +5560,9 @@ dependencies = [ "humantime", "humantime-serde", "hyper 0.14.30", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", - "indexmap 2.0.1", + "indexmap 2.8.0", "ipnet", "itertools 0.10.5", "itoa", @@ -5131,8 +5596,8 @@ dependencies = [ "rsa", "rstest", "rustc-hash 1.1.0", - "rustls 0.23.18", - "rustls-native-certs 0.8.0", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", "rustls-pemfile 2.1.1", "scopeguard", "serde", @@ -5373,8 +5838,8 @@ dependencies = [ "num-bigint", "percent-encoding", "pin-project-lite", - "rustls 0.23.18", - "rustls-native-certs 0.8.0", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", "ryu", "sha1_smol", "socket2", @@ -5490,7 +5955,7 @@ dependencies = [ "http-body-util", "http-types", "humantime-serde", - "hyper 1.4.1", + "hyper 1.6.0", "itertools 0.10.5", "metrics", "once_cell", @@ -5528,9 +5993,9 @@ dependencies = [ "futures-core", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-rustls 0.26.0", "hyper-util", "ipnet", @@ -5587,7 +6052,7 @@ dependencies = [ "futures", "getrandom 0.2.11", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.6.0", "parking_lot 0.11.2", "reqwest", "reqwest-middleware", @@ -5827,15 +6292,16 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.18" +version = "0.23.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ + "aws-lc-rs", "log", "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.8", + "rustls-webpki 0.103.1", "subtle", "zeroize", ] @@ -5849,7 +6315,7 @@ dependencies = [ "openssl-probe", "rustls-pemfile 1.0.2", "schannel", - "security-framework", + "security-framework 2.9.1", ] [[package]] @@ -5862,20 +6328,19 @@ dependencies = [ "rustls-pemfile 2.1.1", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 2.9.1", ] [[package]] name = "rustls-native-certs" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.1", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.2.0", ] [[package]] @@ -5924,6 +6389,18 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -5973,7 +6450,7 @@ dependencies = [ "regex", "remote_storage", "reqwest", - "rustls 0.23.18", + "rustls 0.23.25", "safekeeper_api", "safekeeper_client", "scopeguard", @@ -6109,6 +6586,15 @@ 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.9.1" @@ -6116,7 +6602,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.3", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.8.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -6124,9 +6623,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -6266,6 +6765,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_assert" version = "0.5.0" @@ -6353,7 +6862,25 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "serde_with_macros", + "serde_with_macros 2.3.3", + "time", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.8.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros 3.12.0", "time", ] @@ -6369,6 +6896,31 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "serde_with_macros" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.8.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "serdect" version = "0.2.0" @@ -6584,13 +7136,13 @@ dependencies = [ "futures-util", "http-body-util", "humantime", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "metrics", "once_cell", "parking_lot 0.12.1", "prost 0.13.3", - "rustls 0.23.18", + "rustls 0.23.25", "tokio", "tonic", "tonic-build", @@ -6634,8 +7186,8 @@ dependencies = [ "regex", "reqwest", "routerify", - "rustls 0.23.18", - "rustls-native-certs 0.8.0", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", "safekeeper_api", "safekeeper_client", "scoped-futures", @@ -6689,8 +7241,8 @@ dependencies = [ "postgres_ffi", "remote_storage", "reqwest", - "rustls 0.23.18", - "rustls-native-certs 0.8.0", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", "serde", "serde_json", "storage_controller_client", @@ -6889,7 +7441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.2.0", + "fastrand 2.3.0", "once_cell", "rustix", "windows-sys 0.59.0", @@ -7201,7 +7753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04fb792ccd6bbcd4bba408eb8a292f70fc4a3589e5d793626f45190e6454b6ab" dependencies = [ "ring", - "rustls 0.23.18", + "rustls 0.23.25", "tokio", "tokio-postgres", "tokio-rustls 0.26.0", @@ -7252,7 +7804,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.18", + "rustls 0.23.25", "rustls-pki-types", "tokio", ] @@ -7351,7 +7903,7 @@ version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" dependencies = [ - "indexmap 2.0.1", + "indexmap 2.8.0", "serde", "serde_spanned", "toml_datetime", @@ -7368,15 +7920,15 @@ dependencies = [ "base64 0.22.1", "bytes", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-timeout", "hyper-util", "percent-encoding", "pin-project", "prost 0.13.3", - "rustls-native-certs 0.8.0", + "rustls-native-certs 0.8.1", "rustls-pemfile 2.1.1", "tokio", "tokio-rustls 0.26.0", @@ -7432,6 +7984,7 @@ dependencies = [ "pin-project-lite", "sync_wrapper 1.0.1", "tokio", + "tokio-util", "tower-layer", "tower-service", "tracing", @@ -7447,7 +8000,7 @@ dependencies = [ "bitflags 2.8.0", "bytes", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "mime", "pin-project-lite", "tower-layer", @@ -7680,6 +8233,12 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "uname" version = "0.1.1" @@ -7722,6 +8281,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -7737,7 +8302,7 @@ dependencies = [ "base64 0.22.1", "log", "once_cell", - "rustls 0.23.18", + "rustls 0.23.25", "rustls-pki-types", "url", "webpki-roots 0.26.1", @@ -7833,7 +8398,7 @@ dependencies = [ "serde", "serde_assert", "serde_json", - "serde_with", + "serde_with 2.3.3", "signal-hook", "strum", "strum_macros", @@ -7960,7 +8525,7 @@ name = "walproposer" version = "0.1.0" dependencies = [ "anyhow", - "bindgen", + "bindgen 0.71.1", "postgres_ffi", "utils", ] @@ -8122,6 +8687,18 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "whoami" version = "1.5.1" @@ -8389,10 +8966,10 @@ dependencies = [ "hex", "hmac", "hyper 0.14.30", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "indexmap 1.9.3", - "indexmap 2.0.1", + "indexmap 2.8.0", "itertools 0.12.1", "lazy_static", "libc", @@ -8419,7 +8996,7 @@ dependencies = [ "regex-automata 0.4.3", "regex-syntax 0.8.2", "reqwest", - "rustls 0.23.18", + "rustls 0.23.25", "scopeguard", "sec1 0.7.3", "serde", diff --git a/Cargo.toml b/Cargo.toml index 3fb9229da8..4c28cb3ea4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ members = [ "libs/proxy/postgres-protocol2", "libs/proxy/postgres-types2", "libs/proxy/tokio-postgres2", + "lambda/pod_info_dumper", ] [workspace.package] @@ -342,3 +343,12 @@ inherits = "release" debug = false # true = 2 = all symbols, 1 = line only opt-level = "z" lto = true + +[profile.release-lambda-function] +inherits = "release" +lto = true +opt-level = "z" +codegen-units = 1 +panic = "abort" +debug = false +strip = true diff --git a/lambda/pod_info_dumper/Cargo.toml b/lambda/pod_info_dumper/Cargo.toml new file mode 100644 index 0000000000..9549dcab46 --- /dev/null +++ b/lambda/pod_info_dumper/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "pod_info_dumper" +version = "0.0.0" +edition = "2024" +publish = false + +[dependencies] +aws_lambda_events = { version = "0.16.0", default-features = false, features = ["eventbridge"] } +aws-config = { workspace = true } +aws-sdk-eks = "1.75.0" +aws-sdk-s3 = { workspace = true } +aws-sdk-sts = "1.65.0" +aws-sigv4 = "1.3.0" +base64 = { version = "0.22.1" } +csv = { version = "1.3.1", default-features = false } +http = { workspace = true } +k8s-openapi = { version = "0.24.0", default-features = false, features = ["v1_31"] } +kube = { version = "0.99.0", default-features = false, features = ["client", "rustls-tls"] } +lambda_runtime = { version = "0.13.0", default-features = false, features = ["tracing"] } +rustls = { version = "0.23.25" } +rustls-pemfile = { workspace = true } +secrecy = "0.10.3" +serde = { workspace = true } +serde_json = { workspace = true } +sha2 = { workspace = true, features = ["asm"] } +tokio = { workspace = true, features = ["macros"] } +tracing = { workspace = true, features = ["max_level_debug", "release_max_level_info"] } diff --git a/lambda/pod_info_dumper/README.md b/lambda/pod_info_dumper/README.md new file mode 100644 index 0000000000..9c2a604349 --- /dev/null +++ b/lambda/pod_info_dumper/README.md @@ -0,0 +1,8 @@ +# pod_info_dumper + +An event-triggered AWS lambda function that writes the list of all pods with +node information to a CSV file in S3. + +```shell +cargo lambda build -p pod_info_dumper --output-format Zip --x86-64 --profile release-lambda-function +``` diff --git a/lambda/pod_info_dumper/src/lib.rs b/lambda/pod_info_dumper/src/lib.rs new file mode 100644 index 0000000000..0bbccf6802 --- /dev/null +++ b/lambda/pod_info_dumper/src/lib.rs @@ -0,0 +1,419 @@ +use std::borrow::Cow; +use std::collections::HashMap; +use std::time::{Duration, SystemTime}; +use std::{env, io}; + +use aws_config::default_provider::credentials::DefaultCredentialsChain; +use aws_config::retry::RetryConfig; +use aws_lambda_events::event::eventbridge::EventBridgeEvent; +use aws_sdk_s3::primitives::{ByteStream, SdkBody}; +use aws_sdk_s3::types::ChecksumAlgorithm; +use aws_sdk_sts::config::ProvideCredentials; +use aws_sigv4::http_request::{ + SignableBody, SignableRequest, SignatureLocation, SigningSettings, sign, +}; +use aws_sigv4::sign::v4; +use base64::Engine as _; +use base64::engine::general_purpose::STANDARD; +use base64::prelude::*; +use k8s_openapi::api::core::v1::{Node, Pod}; +use k8s_openapi::chrono::SecondsFormat; +use kube::api::{Api, ListParams, ResourceExt}; +use lambda_runtime::{Error, LambdaEvent, run, service_fn, tracing}; +use secrecy::SecretString; +use serde::ser::SerializeMap; +use sha2::{Digest as _, Sha256}; + +const AZ_LABEL: &str = "topology.kubernetes.io/zone"; +const CSV_FILE_S3_KEY: &str = "lambda/pod_info_dumper/pod_info.csv"; + +#[derive(Debug)] +struct Config { + aws_account_id: String, + s3_bucket: S3BucketConfig, + eks_cluster: EksClusterConfig, +} + +#[derive(Debug)] +struct S3BucketConfig { + region: String, + name: String, +} + +impl S3BucketConfig { + #[tracing::instrument(skip_all, err)] + async fn create_sdk_config(&self) -> Result { + let region = aws_config::Region::new(self.region.clone()); + + let credentials_provider = DefaultCredentialsChain::builder() + .region(region.clone()) + .build() + .await; + + Ok(aws_config::defaults(aws_config::BehaviorVersion::latest()) + .region(region) + .credentials_provider(credentials_provider) + .load() + .await) + } +} + +#[derive(Debug)] +struct EksClusterConfig { + region: String, + name: String, +} + +impl EksClusterConfig { + #[tracing::instrument(skip_all, err)] + async fn create_sdk_config(&self) -> Result { + let region = aws_config::Region::new(self.region.clone()); + + let credentials_provider = DefaultCredentialsChain::builder() + .region(region.clone()) + .build() + .await; + + Ok(aws_config::defaults(aws_config::BehaviorVersion::latest()) + .region(region) + .credentials_provider(credentials_provider) + .load() + .await) + } +} + +#[tokio::main] +pub async fn start() -> Result<(), Error> { + tracing::init_default_subscriber(); + rustls::crypto::aws_lc_rs::default_provider() + .install_default() + .unwrap(); + + tracing::info!("function handler started"); + + let config = Config { + aws_account_id: env::var("NEON_LAMBDA_AWS_ACCOUNT_ID")?, + s3_bucket: S3BucketConfig { + region: env::var("NEON_LAMBDA_TARGET_S3_BUCKET_REGION")?, + name: env::var("NEON_LAMBDA_TARGET_S3_BUCKET_NAME")?, + }, + eks_cluster: EksClusterConfig { + region: env::var("NEON_LAMBDA_TARGET_EKS_CLUSTER_REGION")?, + name: env::var("NEON_LAMBDA_TARGET_EKS_CLUSTER_NAME")?, + }, + }; + + run(service_fn(async |event: LambdaEvent>| -> Result { + function_handler(event, &config).await + })) + .await +} + +#[derive(Debug, PartialEq)] +struct StatusResponse { + status_code: http::StatusCode, + body: Cow<'static, str>, +} + +impl StatusResponse { + fn ok() -> Self { + StatusResponse { + status_code: http::StatusCode::OK, + body: "OK".into(), + } + } +} + +impl serde::Serialize for StatusResponse { + fn serialize(&self, serializer: S) -> Result { + let mut serializer = serializer.serialize_map(None)?; + serializer.serialize_entry("statusCode", &self.status_code.as_u16())?; + serializer.serialize_entry("body", &self.body)?; + serializer.end() + } +} + +#[tracing::instrument(skip_all, fields(?event), err)] +async fn function_handler( + event: LambdaEvent>, + config: &Config, +) -> Result { + tracing::info!("function handler called"); + + let kube_client = connect_to_cluster(config).await?; + let s3_client = connect_to_s3(config).await?; + + let nodes_azs = get_nodes_azs(kube_client.clone()).await?; + + let mut pods_info = get_current_pods(kube_client.clone(), &nodes_azs).await?; + pods_info.sort_unstable(); + + let mut csv = Vec::with_capacity(64 * 1024); + write_csv(&pods_info, &mut csv)?; + + tracing::info!( + "csv is {} bytes, containing {} pods", + csv.len(), + pods_info.len() + ); + + upload_csv(config, &s3_client, &csv).await?; + + tracing::info!("pod info successfully stored"); + Ok(StatusResponse::ok()) +} + +#[derive(Debug, serde::Serialize, PartialEq, Eq, PartialOrd, Ord)] +struct PodInfo<'a> { + namespace: String, + name: String, + ip: String, + creation_time: String, + node: String, + az: Option<&'a str>, +} + +#[tracing::instrument(skip_all, err)] +async fn connect_to_cluster(config: &Config) -> Result { + let sdk_config = config.eks_cluster.create_sdk_config().await?; + let eks_client = aws_sdk_eks::Client::new(&sdk_config); + + let resp = eks_client + .describe_cluster() + .name(&config.eks_cluster.name) + .send() + .await?; + + let cluster = resp + .cluster() + .ok_or_else(|| format!("cluster not found: {}", config.eks_cluster.name))?; + let endpoint = cluster.endpoint().ok_or("cluster endpoint not found")?; + let ca_data = cluster + .certificate_authority() + .and_then(|ca| ca.data()) + .ok_or("cluster certificate data not found")?; + + let mut k8s_config = kube::Config::new(endpoint.parse()?); + let cert_bytes = STANDARD.decode(ca_data)?; + let certs = rustls_pemfile::certs(&mut cert_bytes.as_slice()) + .map(|c| c.map(|c| c.to_vec())) + .collect::>()?; + k8s_config.root_cert = Some(certs); + k8s_config.auth_info.token = Some( + create_kube_auth_token( + &sdk_config, + &config.eks_cluster.name, + Duration::from_secs(10 * 60), + ) + .await?, + ); + + tracing::info!("cluster description completed"); + + Ok(kube::Client::try_from(k8s_config)?) +} + +#[tracing::instrument(skip_all, err)] +async fn create_kube_auth_token( + sdk_config: &aws_config::SdkConfig, + cluster_name: &str, + expires_in: Duration, +) -> Result { + let identity = sdk_config + .credentials_provider() + .unwrap() + .provide_credentials() + .await? + .into(); + + let region = sdk_config.region().expect("region").as_ref(); + let host = format!("sts.{region}.amazonaws.com"); + let get_caller_id_url = format!("https://{host}/?Action=GetCallerIdentity&Version=2011-06-15"); + + let mut signing_settings = SigningSettings::default(); + signing_settings.signature_location = SignatureLocation::QueryParams; + signing_settings.expires_in = Some(expires_in); + let signing_params = v4::SigningParams::builder() + .identity(&identity) + .region(region) + .name("sts") + .time(SystemTime::now()) + .settings(signing_settings) + .build()? + .into(); + let signable_request = SignableRequest::new( + "GET", + &get_caller_id_url, + [("host", host.as_str()), ("x-k8s-aws-id", cluster_name)].into_iter(), + SignableBody::Bytes(&[]), + )?; + let (signing_instructions, _signature) = sign(signable_request, &signing_params)?.into_parts(); + + let mut token_request = http::Request::get(get_caller_id_url).body(()).unwrap(); + signing_instructions.apply_to_request_http1x(&mut token_request); + + let token = format!( + "k8s-aws-v1.{}", + BASE64_STANDARD_NO_PAD.encode(token_request.uri().to_string()) + ) + .into(); + + Ok(token) +} + +#[tracing::instrument(skip_all, err)] +async fn connect_to_s3(config: &Config) -> Result { + let sdk_config = config.s3_bucket.create_sdk_config().await?; + + let s3_client = aws_sdk_s3::Client::from_conf( + aws_sdk_s3::config::Builder::from(&sdk_config) + .retry_config(RetryConfig::standard()) + .build(), + ); + + Ok(s3_client) +} + +#[tracing::instrument(skip_all, err)] +async fn get_nodes_azs(client: kube::Client) -> Result, Error> { + let nodes = Api::::all(client); + + let list_params = ListParams::default().timeout(10); + + let mut nodes_azs = HashMap::default(); + for node in nodes.list(&list_params).await? { + let Some(name) = node.metadata.name else { + tracing::warn!("pod without name"); + continue; + }; + let Some(mut labels) = node.metadata.labels else { + tracing::warn!(name, "pod without labels"); + continue; + }; + let Some(az) = labels.remove(AZ_LABEL) else { + tracing::warn!(name, "pod without AZ label"); + continue; + }; + + tracing::debug!(name, az, "adding node"); + nodes_azs.insert(name, az); + } + + Ok(nodes_azs) +} + +#[tracing::instrument(skip_all, err)] +async fn get_current_pods( + client: kube::Client, + node_az: &HashMap, +) -> Result>, Error> { + let pods = Api::::all(client); + + let mut pods_info = vec![]; + let mut continuation_token = Some(String::new()); + + while let Some(token) = continuation_token { + let list_params = ListParams::default() + .timeout(10) + .limit(500) + .continue_token(&token); + + let list = pods.list(&list_params).await?; + continuation_token = list.metadata.continue_; + + tracing::info!("received list of {} pods", list.items.len()); + + for pod in list.items { + let name = pod.name_any(); + let Some(namespace) = pod.namespace() else { + tracing::warn!(name, "pod without namespace"); + continue; + }; + + let Some(status) = pod.status else { + tracing::warn!(namespace, name, "pod without status"); + continue; + }; + let Some(conditions) = status.conditions else { + tracing::warn!(namespace, name, "pod without conditions"); + continue; + }; + let Some(ready_condition) = conditions.iter().find(|cond| cond.type_ == "Ready") else { + tracing::debug!(namespace, name, "pod not ready"); + continue; + }; + let Some(ref ready_time) = ready_condition.last_transition_time else { + tracing::warn!( + namespace, + name, + "pod ready condition without transition time" + ); + continue; + }; + + let Some(spec) = pod.spec else { + tracing::warn!(namespace, name, "pod without spec"); + continue; + }; + let Some(node) = spec.node_name else { + tracing::warn!(namespace, name, "pod without node"); + continue; + }; + let Some(ip) = status.pod_ip else { + tracing::warn!(namespace, name, "pod without IP"); + continue; + }; + let az = node_az.get(&node).map(String::as_str); + let creation_time = ready_time.0.to_rfc3339_opts(SecondsFormat::Secs, true); + + let pod_info = PodInfo { + namespace, + name, + ip, + creation_time, + node, + az, + }; + tracing::debug!(?pod_info, "adding pod"); + + pods_info.push(pod_info); + } + } + + Ok(pods_info) +} + +#[tracing::instrument(skip_all, err)] +fn write_csv(pods_info: &Vec, writer: W) -> Result<(), Error> { + let mut w = csv::Writer::from_writer(writer); + for pod in pods_info { + w.serialize(pod)?; + } + w.flush()?; + Ok(()) +} + +#[tracing::instrument(skip_all, err)] +async fn upload_csv( + config: &Config, + s3_client: &aws_sdk_s3::Client, + csv: &[u8], +) -> Result { + let mut hasher = Sha256::new(); + hasher.update(csv); + let csum = hasher.finalize(); + + let resp = s3_client + .put_object() + .bucket(&config.s3_bucket.name) + .key(CSV_FILE_S3_KEY) + .content_type("text/csv") + .checksum_algorithm(ChecksumAlgorithm::Sha256) + .checksum_sha256(STANDARD.encode(csum)) + .body(ByteStream::from(SdkBody::from(csv))) + .expected_bucket_owner(&config.aws_account_id) + .send() + .await?; + + Ok(resp) +} diff --git a/lambda/pod_info_dumper/src/main.rs b/lambda/pod_info_dumper/src/main.rs new file mode 100644 index 0000000000..1773cf8b13 --- /dev/null +++ b/lambda/pod_info_dumper/src/main.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), lambda_runtime::Error> { + pod_info_dumper::start() +}