diff --git a/Cargo.lock b/Cargo.lock index bcd9d13b8a7..89528a03ca1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -182,7 +182,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -440,7 +440,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "synstructure 0.13.1", ] @@ -463,7 +463,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -508,7 +508,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -540,7 +540,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -551,13 +551,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -583,9 +583,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-config" -version = "1.5.12" +version = "1.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649316840239f4e58df0b7f620c428f5fababbbca2d504488c641534050bd141" +checksum = "c03a50b30228d3af8865ce83376b4e99e1ffa34728220fe2860e4df0bb5278d6" dependencies = [ "aws-credential-types", "aws-runtime", @@ -650,9 +650,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f6f1124d6e19ab6daf7f2e615644305dc6cb2d706892a8a8c0b98db35de020" +checksum = "b16d1aa50accc11a4b4d5c50f7fb81cc0cf60328259c587d0e6b0f11385bde46" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -675,9 +675,9 @@ dependencies = [ [[package]] name = "aws-sdk-sqs" -version = "1.52.0" +version = "1.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9466fd797274f6c55454ea5aac51fc55a9bac6ca2116ed32cfb3134bb3fbcf0" +checksum = "6493ce2b27a2687b0d8a2453bf6ad2499012e9720c3367cb1206496ede475443" dependencies = [ "aws-credential-types", "aws-runtime", @@ -697,9 +697,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.52.0" +version = "1.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb25f7129c74d36afe33405af4517524df8f74b635af8c2c8e91c1552b8397b2" +checksum = "1605dc0bf9f0a4b05b451441a17fcb0bda229db384f23bf5cead3adbab0664ac" dependencies = [ "aws-credential-types", "aws-runtime", @@ -719,9 +719,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.53.0" +version = "1.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03a3d5ef14851625eafd89660a751776f938bf32f309308b20dcca41c44b568" +checksum = "59f3f73466ff24f6ad109095e0f3f2c830bfb4cd6c8b12f744c8e61ebf4d3ba1" dependencies = [ "aws-credential-types", "aws-runtime", @@ -741,9 +741,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.53.0" +version = "1.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3a9f073ae3a53b54421503063dfb87ff1ea83b876f567d92e8b8d9942ba91b" +checksum = "249b2acaa8e02fd4718705a9494e3eb633637139aa4bb09d70965b0448e865db" dependencies = [ "aws-credential-types", "aws-runtime", @@ -1109,7 +1109,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.93", + "syn 2.0.95", "which 4.4.2", ] @@ -1269,9 +1269,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.1" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0" dependencies = [ "memchr", "serde", @@ -1380,9 +1380,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.6" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "jobserver", "libc", @@ -1470,9 +1470,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "9560b07a799281c7e0958b9296854d6fafd4c5f31444a7e5bb1ad6dde5ccf1bd" dependencies = [ "clap_builder", "clap_derive", @@ -1480,9 +1480,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "874e0dd3eb68bf99058751ac9712f622e61e6f393a94f7128fa26e3f02f5c7cd" dependencies = [ "anstream", "anstyle", @@ -1492,23 +1492,23 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2e663e3e3bed2d32d065a8404024dad306e699a04263ec59919529f803aee9" +checksum = "942dc5991a34d8cf58937ec33201856feba9cbceeeab5adf04116ec7c763bff1" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1789,7 +1789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1821,7 +1821,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1845,7 +1845,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1856,7 +1856,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1932,7 +1932,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1942,7 +1942,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -1955,7 +1955,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2054,7 +2054,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2116,7 +2116,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2168,7 +2168,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2188,7 +2188,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2200,7 +2200,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2466,7 +2466,7 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcca6a476beb610ebeab9c0bc60b3535aa103b52a2c265dc9d3d26209bea666c" dependencies = [ - "reqwest 0.12.11", + "reqwest 0.12.12", "tar", "xz", ] @@ -2585,7 +2585,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -2624,6 +2624,19 @@ dependencies = [ "slab", ] +[[package]] +name = "generator" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +dependencies = [ + "cfg-if", + "libc", + "log", + "rustversion", + "windows", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2657,7 +2670,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -3204,7 +3217,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -3331,7 +3344,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -3771,7 +3784,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -3913,6 +3926,19 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lzma-sys" version = "0.1.20" @@ -3962,7 +3988,7 @@ dependencies = [ "clap", "glob", "rand", - "syn 2.0.93", + "syn 2.0.95", "thiserror 2.0.9", "tracing", "tracing-subscriber", @@ -4030,7 +4056,7 @@ checksum = "23c9b935fbe1d6cbd1dac857b54a688145e2d93f48db36010514d0f612d0ad67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -4123,7 +4149,7 @@ dependencies = [ "rand", "rcgen", "regex", - "reqwest 0.12.11", + "reqwest 0.12.12", "rstest", "rustls 0.23.20", "rustls-pemfile 2.2.0", @@ -4204,7 +4230,7 @@ dependencies = [ "assert-json-diff", "base64 0.22.1", "drain", - "reqwest 0.12.11", + "reqwest 0.12.12", "serde", "serde_json", "tokio", @@ -4222,7 +4248,7 @@ dependencies = [ "k8s-openapi", "kube", "pem", - "reqwest 0.12.11", + "reqwest 0.12.12", "serde", "serde_yaml", "thiserror 2.0.9", @@ -4262,7 +4288,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -4299,7 +4325,7 @@ dependencies = [ "mirrord-operator", "mirrord-protocol", "rand", - "reqwest 0.12.11", + "reqwest 0.12.12", "rstest", "rustls 0.23.20", "rustls-pemfile 2.2.0", @@ -4395,7 +4421,7 @@ version = "3.128.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -4405,7 +4431,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "semver 1.0.24", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -4453,7 +4479,7 @@ dependencies = [ [[package]] name = "mirrord-protocol" -version = "1.13.2" +version = "1.13.3" dependencies = [ "actix-codec", "bincode", @@ -4530,26 +4556,25 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] name = "moka" -version = "0.12.8" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" dependencies = [ "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", - "once_cell", + "loom", "parking_lot", - "quanta", + "portable-atomic", "rustc_version", "smallvec", "tagptr", "thiserror 1.0.69", - "triomphe", "uuid", ] @@ -4704,7 +4729,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -4952,7 +4977,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5011,7 +5036,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5037,18 +5062,18 @@ dependencies = [ [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_shared", ] [[package]] name = "phf_codegen" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" dependencies = [ "phf_generator", "phf_shared", @@ -5056,9 +5081,9 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ "phf_shared", "rand", @@ -5066,38 +5091,38 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -5207,7 +5232,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5302,12 +5327,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "483f8c21f64f3ea09fe0f30f5d48c3e8eefe5dac9129f0075f76593b4c1da705" dependencies = [ "proc-macro2", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5361,7 +5386,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5381,7 +5406,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "version_check", "yansi", ] @@ -5437,7 +5462,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.93", + "syn 2.0.95", "tempfile", ] @@ -5451,7 +5476,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -5463,21 +5488,6 @@ dependencies = [ "prost", ] -[[package]] -name = "quanta" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773ce68d0bb9bc7ef20be3536ffe94e223e1f365bd374108b2659fac0c65cfe6" -dependencies = [ - "crossbeam-utils", - "libc", - "once_cell", - "raw-cpuid", - "wasi", - "web-sys", - "winapi", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -5628,15 +5638,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "raw-cpuid" -version = "11.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" -dependencies = [ - "bitflags 2.6.0", -] - [[package]] name = "rawsocket" version = "0.1.0" @@ -5823,9 +5824,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe060fe50f524be480214aba758c71f99f90ee8c83c5a36b5e9e1d568eb4eb3" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -5919,7 +5920,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.93", + "syn 2.0.95", "unicode-ident", ] @@ -6086,7 +6087,7 @@ dependencies = [ "openssl-probe", "rustls-pki-types", "schannel", - "security-framework 3.1.0", + "security-framework 3.2.0", ] [[package]] @@ -6217,9 +6218,15 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.93", + "syn 2.0.95", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -6243,7 +6250,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -6294,9 +6301,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d3f8c9bfcc3cbb6b0179eb57042d75b1582bdc65c3cb95f3fa999509c03cbc" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.6.0", "core-foundation 0.10.0", @@ -6307,9 +6314,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.13.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -6367,7 +6374,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -6378,14 +6385,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -6411,7 +6418,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -6544,9 +6551,9 @@ checksum = "5dd19be0257552dd56d1bb6946f89f193c6e5b9f13cc9327c4bc84a357507c74" [[package]] name = "siphasher" -version = "0.3.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" @@ -6686,7 +6693,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -6729,9 +6736,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.93" +version = "2.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058" +checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" dependencies = [ "proc-macro2", "quote", @@ -6773,7 +6780,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -6832,12 +6839,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -6943,7 +6951,7 @@ dependencies = [ "mirrord-operator", "rand", "regex", - "reqwest 0.12.11", + "reqwest 0.12.12", "rstest", "rustls 0.23.20", "serde", @@ -6990,7 +6998,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -7001,7 +7009,7 @@ checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -7105,7 +7113,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -7273,7 +7281,7 @@ dependencies = [ "prost-build", "prost-types", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -7363,7 +7371,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -7418,12 +7426,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "triomphe" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" - [[package]] name = "try-lock" version = "0.2.5" @@ -7783,7 +7785,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "wasm-bindgen-shared", ] @@ -7818,7 +7820,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7942,6 +7944,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -7951,6 +7963,41 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + [[package]] name = "windows-registry" version = "0.2.0" @@ -8131,9 +8178,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" dependencies = [ "memchr", ] @@ -8263,9 +8310,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909" dependencies = [ "libc", "linux-raw-sys", @@ -8337,7 +8384,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "synstructure 0.13.1", ] @@ -8359,7 +8406,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -8379,7 +8426,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", "synstructure 0.13.1", ] @@ -8400,7 +8447,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] @@ -8422,7 +8469,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.93", + "syn 2.0.95", ] [[package]] diff --git a/changelog.d/+104-policy-fs.added.md b/changelog.d/+104-policy-fs.added.md new file mode 100644 index 00000000000..1ad43a13736 --- /dev/null +++ b/changelog.d/+104-policy-fs.added.md @@ -0,0 +1 @@ +Add policy to control file ops. diff --git a/mirrord/layer/src/detour.rs b/mirrord/layer/src/detour.rs index a89e79ce0f6..92a014d20dd 100644 --- a/mirrord/layer/src/detour.rs +++ b/mirrord/layer/src/detour.rs @@ -215,6 +215,10 @@ pub(crate) enum Bypass { /// Useful for operations that are version gated, and we want to bypass when the protocol /// doesn't support them. NotImplemented, + + /// File `open` (any `open`-ish operation) was forced to be local, instead of remote, most + /// likely due to an operator fs policy. + OpenLocal, } impl Bypass { diff --git a/mirrord/layer/src/error.rs b/mirrord/layer/src/error.rs index ea0cbabe3c8..da4797a1916 100644 --- a/mirrord/layer/src/error.rs +++ b/mirrord/layer/src/error.rs @@ -248,6 +248,7 @@ impl From for i64 { HookError::BincodeEncode(_) => libc::EINVAL, HookError::ResponseError(response_fail) => match response_fail { ResponseError::IdsExhausted(_) => libc::ENOMEM, + ResponseError::OpenLocal => libc::ENOENT, ResponseError::NotFound(_) => libc::ENOENT, ResponseError::NotDirectory(_) => libc::ENOTDIR, ResponseError::NotFile(_) => libc::EISDIR, diff --git a/mirrord/layer/src/file/ops.rs b/mirrord/layer/src/file/ops.rs index 580f8eacc8a..ca9dd10f951 100644 --- a/mirrord/layer/src/file/ops.rs +++ b/mirrord/layer/src/file/ops.rs @@ -206,7 +206,12 @@ pub(crate) fn open(path: Detour, open_options: OpenOptionsInternal) -> ensure_not_ignored!(path, open_options.is_write()); - let OpenFileResponse { fd: remote_fd } = RemoteFile::remote_open(path.clone(), open_options)?; + let OpenFileResponse { fd: remote_fd } = RemoteFile::remote_open(path.clone(), open_options) + .or_else(|fail| match fail { + // The operator has a policy that matches this `path` as local-only. + HookError::ResponseError(ResponseError::OpenLocal) => Detour::Bypass(Bypass::OpenLocal), + other => Detour::Error(other), + })?; // TODO: Need a way to say "open a directory", right now `is_dir` always returns false. // This requires having a fake directory name (`/fake`, for example), instead of just converting diff --git a/mirrord/operator/src/crd/policy.rs b/mirrord/operator/src/crd/policy.rs index 1ad9447d1e8..e236164da98 100644 --- a/mirrord/operator/src/crd/policy.rs +++ b/mirrord/operator/src/crd/policy.rs @@ -58,6 +58,11 @@ pub struct MirrordPolicySpec { /// target. #[serde(default)] pub env: EnvPolicy, + + /// Overrides fs ops behaviour, granting control over them to the operator policy, instead of + /// the user config. + #[serde(default)] + pub fs: FsPolicy, } /// Custom cluster-wide resource for policies that limit what mirrord features users can use. @@ -90,6 +95,11 @@ pub struct MirrordClusterPolicySpec { /// target. #[serde(default)] pub env: EnvPolicy, + + /// Overrides fs ops behaviour, granting control over them to the operator policy, instead of + /// the user config. + #[serde(default)] + pub fs: FsPolicy, } /// Policy for controlling environment variables access from mirrord instances. @@ -104,9 +114,33 @@ pub struct EnvPolicy { /// Variable names can be matched using `*` and `?` where `?` matches exactly one occurrence of /// any character and `*` matches arbitrary many (including zero) occurrences of any character, /// e.g. `DATABASE_*` will match `DATABASE_URL` and `DATABASE_PORT`. + #[serde(default)] pub exclude: HashSet, } +/// File operations policy that mimics the mirrord fs config. +/// +/// Allows the operator control over remote file ops behaviour, overriding what the user has set in +/// their mirrord config file, if it matches something in one of the lists (regex sets) of this +/// struct. +#[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize, JsonSchema)] +#[serde(rename_all = "kebab-case")] +pub struct FsPolicy { + /// The file can only be opened in read-only mode, otherwise the operator returns an IO error. + #[serde(default)] + pub read_only: HashSet, + + /// The file cannot be opened in the remote target. + /// + /// `open` calls that match this are forced to be opened in the local user's machine. + #[serde(default)] + pub local: HashSet, + + /// Any file that matches this returns a file not found error from the operator. + #[serde(default)] + pub not_found: HashSet, +} + #[test] fn check_one_api_group() { use kube::Resource; diff --git a/mirrord/protocol/Cargo.toml b/mirrord/protocol/Cargo.toml index 34832bbe47f..1904cc97f1c 100644 --- a/mirrord/protocol/Cargo.toml +++ b/mirrord/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mirrord-protocol" -version = "1.13.2" +version = "1.13.3" authors.workspace = true description.workspace = true documentation.workspace = true diff --git a/mirrord/protocol/src/error.rs b/mirrord/protocol/src/error.rs index 9a8e451658c..efb7ff08198 100644 --- a/mirrord/protocol/src/error.rs +++ b/mirrord/protocol/src/error.rs @@ -67,6 +67,9 @@ pub enum ResponseError { #[error("Failed stripping path with `{0}`!")] StripPrefix(String), + + #[error("File has to be opened locally!")] + OpenLocal, } impl From for ResponseError { diff --git a/mirrord/protocol/src/file.rs b/mirrord/protocol/src/file.rs index b2e8e3773f8..c0b4cfe2f18 100644 --- a/mirrord/protocol/src/file.rs +++ b/mirrord/protocol/src/file.rs @@ -25,6 +25,9 @@ pub static READDIR_BATCH_VERSION: LazyLock = pub static MKDIR_VERSION: LazyLock = LazyLock::new(|| ">=1.13.0".parse().expect("Bad Identifier")); +pub static OPEN_LOCAL_VERSION: LazyLock = + LazyLock::new(|| ">=1.13.3".parse().expect("Bad Identifier")); + /// Internal version of Metadata across operating system (macOS, Linux) /// Only mutual attributes #[derive(Encode, Decode, Debug, PartialEq, Clone, Copy, Eq, Default)] diff --git a/tests/go-e2e-dir/main.go b/tests/go-e2e-dir/main.go index b608f01b53b..80006ce58c5 100644 --- a/tests/go-e2e-dir/main.go +++ b/tests/go-e2e-dir/main.go @@ -15,13 +15,20 @@ func main() { os.Exit(-1) } fmt.Printf("DirEntries: %s\n", dir) + // `os.ReadDir` does not include `.` and `..`. - if len(dir) != 2 { + if len(dir) < 2 { os.Exit(-1) } - // `os.ReadDir` sorts the result by file name. - if dir[0].Name() != "app.py" || dir[1].Name() != "test.txt" { - os.Exit(-1) + + // Iterate over the files in this dir, exiting if it's not an expected file name. + for i := 0; i < len(dir); i++ { + dirName := dir[i].Name() + + if dirName != "app.py" && dirName != "test.txt" && dirName != "file.local" && dirName != "file.not-found" && dirName != "file.read-only" && dirName != "file.read-write" { + os.Exit(-1) + } + } err = os.Mkdir("/app/test_mkdir", 0755) diff --git a/tests/node-e2e/fspolicy/test_operator_fs_policy.mjs b/tests/node-e2e/fspolicy/test_operator_fs_policy.mjs new file mode 100644 index 00000000000..8e58bf52cec --- /dev/null +++ b/tests/node-e2e/fspolicy/test_operator_fs_policy.mjs @@ -0,0 +1,54 @@ +import fs from 'fs'; + +fs.open("/app/file.local", (fail, fd) => { + console.log(`open file.local ${fd}`); + if (fd) { + console.log(`SUCCESS /app/file.local ${fd}`); + } + + if (fail) { + console.error(`FAIL /app/file.local ${fail}`); + } +}); + +fs.open("/app/file.not-found", (fail, fd) => { + console.log(`open file.not-found ${fd}`); + if (fd) { + console.log(`SUCCESS /app/file.not-found ${fd}`); + } + + if (fail) { + console.error(`FAIL /app/file.not-found ${fail}`); + } +}); + +fs.open("/app/file.read-only", (fail, fd) => { + if (fd) { + console.log(`SUCCESS /app/file.read-only ${fd}`); + } + + if (fail) { + console.error(`FAIL /app/file.read-only ${fail}`); + } +}); + +fs.open("/app/file.read-only", "r+", (fail, fd) => { + if (fd) { + console.log(`SUCCESS r+ /app/file.read-only ${fd}`); + } + + if (fail) { + console.error(`FAIL r+ /app/file.read-only ${fail}`); + } +}); + +fs.open("/app/file.read-write", "r+", (fail, fd) => { + if (fd) { + console.log(`SUCCESS /app/file.read-write ${fd}`); + } + + if (fail) { + console.error(`FAIL /app/file.read-write ${fail}`); + } +}); + diff --git a/tests/python-e2e/files_ro.py b/tests/python-e2e/files_ro.py index ed99eab5d7f..c6e4e8d5631 100644 --- a/tests/python-e2e/files_ro.py +++ b/tests/python-e2e/files_ro.py @@ -3,7 +3,7 @@ import uuid import unittest -TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n" class FileOpsTest(unittest.TestCase): @@ -22,4 +22,4 @@ def test_read_only(self): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/tests/python-e2e/ops.py b/tests/python-e2e/ops.py index 8e83271628f..9f94425921e 100644 --- a/tests/python-e2e/ops.py +++ b/tests/python-e2e/ops.py @@ -2,7 +2,7 @@ import uuid import unittest -TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n" class FileOpsTest(unittest.TestCase): diff --git a/tests/src/operator/policies.rs b/tests/src/operator/policies.rs index 61a17d90af5..114d42968e6 100644 --- a/tests/src/operator/policies.rs +++ b/tests/src/operator/policies.rs @@ -18,6 +18,8 @@ use crate::utils::{ config_dir, kube_client, service, Application, KubeService, ResourceGuard, TestProcess, }; +mod fs; + /// Guard that deletes a mirrord policy when dropped. struct PolicyGuard { _inner: ResourceGuard, @@ -128,6 +130,7 @@ fn block_steal_without_qualifiers() -> PolicyTestCase { selector: None, block: vec![BlockedFeature::Steal], env: Default::default(), + fs: Default::default(), }, ), service_b_can_steal: No, @@ -147,6 +150,7 @@ fn block_steal_with_path_pattern() -> PolicyTestCase { selector: None, block: vec![BlockedFeature::Steal], env: Default::default(), + fs: Default::default(), }, ), service_b_can_steal: EvenWithoutFilter, @@ -166,6 +170,7 @@ fn block_unfiltered_steal_with_path_pattern() -> PolicyTestCase { selector: None, block: vec![BlockedFeature::StealWithoutFilter], env: Default::default(), + fs: Default::default(), }, ), service_b_can_steal: EvenWithoutFilter, @@ -185,6 +190,7 @@ fn block_unfiltered_steal_with_deployment_path_pattern() -> PolicyTestCase { selector: None, block: vec![BlockedFeature::StealWithoutFilter], env: Default::default(), + fs: Default::default(), }, ), service_a_can_steal: OnlyWithFilter, @@ -210,6 +216,7 @@ fn block_steal_with_label_selector() -> PolicyTestCase { }), block: vec![BlockedFeature::Steal], env: Default::default(), + fs: Default::default(), }, ), service_b_can_steal: EvenWithoutFilter, @@ -236,6 +243,7 @@ fn block_steal_with_unmatching_policy() -> PolicyTestCase { }), block: vec![BlockedFeature::Steal], env: Default::default(), + fs: Default::default(), }, ), service_b_can_steal: EvenWithoutFilter, @@ -377,6 +385,7 @@ pub async fn create_cluster_policy_and_try_to_mirror( selector: None, block: vec![BlockedFeature::Mirror], env: Default::default(), + fs: Default::default(), }, ), ) diff --git a/tests/src/operator/policies/fs.rs b/tests/src/operator/policies/fs.rs new file mode 100644 index 00000000000..d54ed7bb98d --- /dev/null +++ b/tests/src/operator/policies/fs.rs @@ -0,0 +1,87 @@ +use std::{collections::HashSet, time::Duration}; + +use mirrord_operator::crd::policy::{FsPolicy, MirrordPolicy, MirrordPolicySpec}; +use rstest::{fixture, rstest}; + +use crate::{ + operator::policies::PolicyGuard, + utils::{kube_client, service, Application, KubeService}, +}; + +#[fixture] +async fn fs_service(#[future] kube_client: kube::Client) -> KubeService { + let namespace = format!("e2e-tests-fs-policies-{}", crate::utils::random_string()); + + service( + &namespace, + "NodePort", + "ghcr.io/metalbear-co/mirrord-pytest:latest", + "fs-policy-e2e-test-service", + false, + kube_client, + ) + .await +} + +#[rstest] +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +#[timeout(Duration::from_secs(60))] +pub async fn create_cluster_fs_policy_and_try_file_operations( + #[future] service: KubeService, + #[future] kube_client: kube::Client, +) { + let kube_client = kube_client.await; + let service = service.await; + + // Create policy, delete it when test exits. + let _policy_guard = PolicyGuard::namespaced( + kube_client, + &MirrordPolicy::new( + "e2e-test-fs-policy-with-path-pattern", + MirrordPolicySpec { + target_path: Some("fs_policy_e2e-test-*".into()), + selector: None, + block: Default::default(), + env: Default::default(), + fs: FsPolicy { + read_only: HashSet::from_iter(vec!["file.read-only".to_string()]), + local: HashSet::from_iter(vec!["file.local".to_string()]), + not_found: HashSet::from_iter(vec!["file.not-found".to_string()]), + }, + }, + ), + &service.namespace, + ) + .await; + + let application = Application::NodeFsPolicy; + println!("Running mirrord {application:?} against {}", &service.name); + + let mut test_process = application + .run( + &service.target, + Some(&service.namespace), + Some(vec!["--fs-mode=write"]), + None, + ) + .await; + + test_process.wait_assert_success().await; + + test_process + .assert_stderr_contains("FAIL /app/file.local") + .await; + test_process + .assert_stderr_contains("FAIL /app/file.not-found") + .await; + test_process + .assert_stderr_contains("FAIL r+ /app/file.read-only") + .await; + + test_process + .assert_stdout_contains("SUCCESS /app/file.read-only") + .await; + test_process + .assert_stdout_contains("SUCCESS /app/file.read-write") + .await; +} diff --git a/tests/src/utils.rs b/tests/src/utils.rs index bf807337a09..538a4d753e6 100644 --- a/tests/src/utils.rs +++ b/tests/src/utils.rs @@ -100,6 +100,11 @@ pub enum Application { PythonCloseSocketKeepConnection, RustWebsockets, RustSqs, + /// Tries to open files in the remote target, but these operations should succeed or fail based + /// on mirrord `FsPolicy`. + /// + /// - `node-e2e/fspolicy/test_operator_fs_policy.mjs` + NodeFsPolicy, } #[derive(Debug)] @@ -408,6 +413,9 @@ impl Application { Application::NodeHTTP2 => { vec!["node", "node-e2e/http2/test_http2_traffic_steal.mjs"] } + Application::NodeFsPolicy => { + vec!["node", "node-e2e/fspolicy/test_operator_fs_policy.mjs"] + } Application::Go21HTTP => vec!["go-e2e/21.go_test_app"], Application::Go22HTTP => vec!["go-e2e/22.go_test_app"], Application::Go23HTTP => vec!["go-e2e/23.go_test_app"],