From f6fd968ed768bd21ce4458ddd1646db5e98d7865 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 14:12:17 +0000 Subject: [PATCH 1/5] build(deps-dev): bump furo from 2023.9.10 to 2024.5.6 in /clients/python (#110) Bumps [furo](https://github.com/pradyunsg/furo) from 2023.9.10 to 2024.5.6. - [Release notes](https://github.com/pradyunsg/furo/releases) - [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md) - [Commits](https://github.com/pradyunsg/furo/compare/2023.09.10...2024.05.06) --- updated-dependencies: - dependency-name: furo dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clients/python/poetry.lock | 10 +++++----- clients/python/pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clients/python/poetry.lock b/clients/python/poetry.lock index 76bda6f5d..c403b6375 100644 --- a/clients/python/poetry.lock +++ b/clients/python/poetry.lock @@ -408,20 +408,20 @@ tqdm = ["tqdm"] [[package]] name = "furo" -version = "2023.9.10" +version = "2024.5.6" description = "A clean customisable Sphinx documentation theme." optional = false python-versions = ">=3.8" files = [ - {file = "furo-2023.9.10-py3-none-any.whl", hash = "sha256:513092538537dc5c596691da06e3c370714ec99bc438680edc1debffb73e5bfc"}, - {file = "furo-2023.9.10.tar.gz", hash = "sha256:5707530a476d2a63b8cad83b4f961f3739a69f4b058bcf38a03a39fa537195b2"}, + {file = "furo-2024.5.6-py3-none-any.whl", hash = "sha256:490a00d08c0a37ecc90de03ae9227e8eb5d6f7f750edf9807f398a2bdf2358de"}, + {file = "furo-2024.5.6.tar.gz", hash = "sha256:81f205a6605ebccbb883350432b4831c0196dd3d1bc92f61e1f459045b3d2b0b"}, ] [package.dependencies] beautifulsoup4 = "*" pygments = ">=2.7" sphinx = ">=6.0,<8.0" -sphinx-basic-ng = "*" +sphinx-basic-ng = ">=1.0.0.beta2" [[package]] name = "grpcio" @@ -1747,4 +1747,4 @@ hf = ["huggingface-hub"] [metadata] lock-version = "2.0" python-versions = ">= 3.9, < 3.11" -content-hash = "a3f54d19085bb81a73078d8f66c86bf82283cef7dfc67cfd05faff3aeb18323c" +content-hash = "c973d75abf0797917559b1fa67e20bec050fad676a6c7ad14c6a0ee73a9ecf9f" diff --git a/clients/python/pyproject.toml b/clients/python/pyproject.toml index 2b7dcd488..02b2a197c 100644 --- a/clients/python/pyproject.toml +++ b/clients/python/pyproject.toml @@ -25,7 +25,7 @@ hf = ["huggingface-hub"] [tool.poetry.group.dev.dependencies] sphinx = "^7.2.6" -furo = "^2023.9.10" +furo = ">=2023.9.10,<2025.0.0" myst-parser = { extras = ["linkify"], version = "^2.0.0" } pytest = ">=7.4.2,<9.0.0" coverage = { extras = ["toml"], version = "^7.3.2" } From a8e0f2cfe5df8ee73477de7cb252cb30d55ba5c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 14:15:17 +0000 Subject: [PATCH 2/5] build(deps-dev): bump ruff from 0.4.4 to 0.4.5 in /clients/python (#111) Bumps [ruff](https://github.com/astral-sh/ruff) from 0.4.4 to 0.4.5. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.4.4...v0.4.5) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clients/python/poetry.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/clients/python/poetry.lock b/clients/python/poetry.lock index c403b6375..f5d416755 100644 --- a/clients/python/poetry.lock +++ b/clients/python/poetry.lock @@ -1074,28 +1074,28 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "ruff" -version = "0.4.4" +version = "0.4.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.4.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:29d44ef5bb6a08e235c8249294fa8d431adc1426bfda99ed493119e6f9ea1bf6"}, - {file = "ruff-0.4.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c4efe62b5bbb24178c950732ddd40712b878a9b96b1d02b0ff0b08a090cbd891"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4c8e2f1e8fc12d07ab521a9005d68a969e167b589cbcaee354cb61e9d9de9c15"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:60ed88b636a463214905c002fa3eaab19795679ed55529f91e488db3fe8976ab"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b90fc5e170fc71c712cc4d9ab0e24ea505c6a9e4ebf346787a67e691dfb72e85"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8e7e6ebc10ef16dcdc77fd5557ee60647512b400e4a60bdc4849468f076f6eef"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9ddb2c494fb79fc208cd15ffe08f32b7682519e067413dbaf5f4b01a6087bcd"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c51c928a14f9f0a871082603e25a1588059b7e08a920f2f9fa7157b5bf08cfe9"}, - {file = "ruff-0.4.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b5eb0a4bfd6400b7d07c09a7725e1a98c3b838be557fee229ac0f84d9aa49c36"}, - {file = "ruff-0.4.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b1867ee9bf3acc21778dcb293db504692eda5f7a11a6e6cc40890182a9f9e595"}, - {file = "ruff-0.4.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1aecced1269481ef2894cc495647392a34b0bf3e28ff53ed95a385b13aa45768"}, - {file = "ruff-0.4.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9da73eb616b3241a307b837f32756dc20a0b07e2bcb694fec73699c93d04a69e"}, - {file = "ruff-0.4.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:958b4ea5589706a81065e2a776237de2ecc3e763342e5cc8e02a4a4d8a5e6f95"}, - {file = "ruff-0.4.4-py3-none-win32.whl", hash = "sha256:cb53473849f011bca6e754f2cdf47cafc9c4f4ff4570003a0dad0b9b6890e876"}, - {file = "ruff-0.4.4-py3-none-win_amd64.whl", hash = "sha256:424e5b72597482543b684c11def82669cc6b395aa8cc69acc1858b5ef3e5daae"}, - {file = "ruff-0.4.4-py3-none-win_arm64.whl", hash = "sha256:39df0537b47d3b597293edbb95baf54ff5b49589eb7ff41926d8243caa995ea6"}, - {file = "ruff-0.4.4.tar.gz", hash = "sha256:f87ea42d5cdebdc6a69761a9d0bc83ae9b3b30d0ad78952005ba6568d6c022af"}, + {file = "ruff-0.4.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8f58e615dec58b1a6b291769b559e12fdffb53cc4187160a2fc83250eaf54e96"}, + {file = "ruff-0.4.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:84dd157474e16e3a82745d2afa1016c17d27cb5d52b12e3d45d418bcc6d49264"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25f483ad9d50b00e7fd577f6d0305aa18494c6af139bce7319c68a17180087f4"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:63fde3bf6f3ad4e990357af1d30e8ba2730860a954ea9282c95fc0846f5f64af"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78e3ba4620dee27f76bbcad97067766026c918ba0f2d035c2fc25cbdd04d9c97"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:441dab55c568e38d02bbda68a926a3d0b54f5510095c9de7f95e47a39e0168aa"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1169e47e9c4136c997f08f9857ae889d614c5035d87d38fda9b44b4338909cdf"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:755ac9ac2598a941512fc36a9070a13c88d72ff874a9781493eb237ab02d75df"}, + {file = "ruff-0.4.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f4b02a65985be2b34b170025a8b92449088ce61e33e69956ce4d316c0fe7cce0"}, + {file = "ruff-0.4.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:75a426506a183d9201e7e5664de3f6b414ad3850d7625764106f7b6d0486f0a1"}, + {file = "ruff-0.4.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:6e1b139b45e2911419044237d90b60e472f57285950e1492c757dfc88259bb06"}, + {file = "ruff-0.4.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a6f29a8221d2e3d85ff0c7b4371c0e37b39c87732c969b4d90f3dad2e721c5b1"}, + {file = "ruff-0.4.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d6ef817124d72b54cc923f3444828ba24fa45c3164bc9e8f1813db2f3d3a8a11"}, + {file = "ruff-0.4.5-py3-none-win32.whl", hash = "sha256:aed8166c18b1a169a5d3ec28a49b43340949e400665555b51ee06f22813ef062"}, + {file = "ruff-0.4.5-py3-none-win_amd64.whl", hash = "sha256:b0b03c619d2b4350b4a27e34fd2ac64d0dabe1afbf43de57d0f9d8a05ecffa45"}, + {file = "ruff-0.4.5-py3-none-win_arm64.whl", hash = "sha256:9d15de3425f53161b3f5a5658d4522e4eee5ea002bf2ac7aa380743dd9ad5fba"}, + {file = "ruff-0.4.5.tar.gz", hash = "sha256:286eabd47e7d4d521d199cab84deca135557e6d1e0f0d01c29e757c3cb151b54"}, ] [[package]] From cbfd6911f009e27ac0e3a28fa59a8a66af2b69e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 14:18:17 +0000 Subject: [PATCH 3/5] build(deps-dev): bump coverage from 7.3.2 to 7.5.2 in /clients/python (#112) Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.3.2 to 7.5.2. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/7.3.2...7.5.2) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clients/python/poetry.lock | 106 ++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/clients/python/poetry.lock b/clients/python/poetry.lock index f5d416755..424969010 100644 --- a/clients/python/poetry.lock +++ b/clients/python/poetry.lock @@ -230,63 +230,63 @@ files = [ [[package]] name = "coverage" -version = "7.3.2" +version = "7.5.2" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.8" files = [ - {file = "coverage-7.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d872145f3a3231a5f20fd48500274d7df222e291d90baa2026cc5152b7ce86bf"}, - {file = "coverage-7.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:310b3bb9c91ea66d59c53fa4989f57d2436e08f18fb2f421a1b0b6b8cc7fffda"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f47d39359e2c3779c5331fc740cf4bce6d9d680a7b4b4ead97056a0ae07cb49a"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aa72dbaf2c2068404b9870d93436e6d23addd8bbe9295f49cbca83f6e278179c"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:beaa5c1b4777f03fc63dfd2a6bd820f73f036bfb10e925fce067b00a340d0f3f"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:dbc1b46b92186cc8074fee9d9fbb97a9dd06c6cbbef391c2f59d80eabdf0faa6"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:315a989e861031334d7bee1f9113c8770472db2ac484e5b8c3173428360a9148"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d1bc430677773397f64a5c88cb522ea43175ff16f8bfcc89d467d974cb2274f9"}, - {file = "coverage-7.3.2-cp310-cp310-win32.whl", hash = "sha256:a889ae02f43aa45032afe364c8ae84ad3c54828c2faa44f3bfcafecb5c96b02f"}, - {file = "coverage-7.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:c0ba320de3fb8c6ec16e0be17ee1d3d69adcda99406c43c0409cb5c41788a611"}, - {file = "coverage-7.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ac8c802fa29843a72d32ec56d0ca792ad15a302b28ca6203389afe21f8fa062c"}, - {file = "coverage-7.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:89a937174104339e3a3ffcf9f446c00e3a806c28b1841c63edb2b369310fd074"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e267e9e2b574a176ddb983399dec325a80dbe161f1a32715c780b5d14b5f583a"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2443cbda35df0d35dcfb9bf8f3c02c57c1d6111169e3c85fc1fcc05e0c9f39a3"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4175e10cc8dda0265653e8714b3174430b07c1dca8957f4966cbd6c2b1b8065a"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:5c913b556a116b8d5f6ef834038ba983834d887d82187c8f73dec21049abd65c"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1981f785239e4e39e6444c63a98da3a1db8e971cb9ceb50a945ba6296b43f312"}, - {file = "coverage-7.3.2-cp311-cp311-win32.whl", hash = "sha256:43668cabd5ca8258f5954f27a3aaf78757e6acf13c17604d89648ecc0cc66640"}, - {file = "coverage-7.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10c39c0452bf6e694511c901426d6b5ac005acc0f78ff265dbe36bf81f808a2"}, - {file = "coverage-7.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4cbae1051ab791debecc4a5dcc4a1ff45fc27b91b9aee165c8a27514dd160836"}, - {file = "coverage-7.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c7bba973ebee5e56fe9251300c00f1579652587a9f4a5ed8404b15a0471f216"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fe494faa90ce6381770746077243231e0b83ff3f17069d748f645617cefe19d4"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6e9589bd04d0461a417562649522575d8752904d35c12907d8c9dfeba588faf"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d51ac2a26f71da1b57f2dc81d0e108b6ab177e7d30e774db90675467c847bbdf"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:99b89d9f76070237975b315b3d5f4d6956ae354a4c92ac2388a5695516e47c84"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fa28e909776dc69efb6ed975a63691bc8172b64ff357e663a1bb06ff3c9b589a"}, - {file = "coverage-7.3.2-cp312-cp312-win32.whl", hash = "sha256:289fe43bf45a575e3ab10b26d7b6f2ddb9ee2dba447499f5401cfb5ecb8196bb"}, - {file = "coverage-7.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:7dbc3ed60e8659bc59b6b304b43ff9c3ed858da2839c78b804973f613d3e92ed"}, - {file = "coverage-7.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f94b734214ea6a36fe16e96a70d941af80ff3bfd716c141300d95ebc85339738"}, - {file = "coverage-7.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:af3d828d2c1cbae52d34bdbb22fcd94d1ce715d95f1a012354a75e5913f1bda2"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:630b13e3036e13c7adc480ca42fa7afc2a5d938081d28e20903cf7fd687872e2"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c9eacf273e885b02a0273bb3a2170f30e2d53a6d53b72dbe02d6701b5296101c"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d8f17966e861ff97305e0801134e69db33b143bbfb36436efb9cfff6ec7b2fd9"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b4275802d16882cf9c8b3d057a0839acb07ee9379fa2749eca54efbce1535b82"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:72c0cfa5250f483181e677ebc97133ea1ab3eb68645e494775deb6a7f6f83901"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:cb536f0dcd14149425996821a168f6e269d7dcd2c273a8bff8201e79f5104e76"}, - {file = "coverage-7.3.2-cp38-cp38-win32.whl", hash = "sha256:307adb8bd3abe389a471e649038a71b4eb13bfd6b7dd9a129fa856f5c695cf92"}, - {file = "coverage-7.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:88ed2c30a49ea81ea3b7f172e0269c182a44c236eb394718f976239892c0a27a"}, - {file = "coverage-7.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b631c92dfe601adf8f5ebc7fc13ced6bb6e9609b19d9a8cd59fa47c4186ad1ce"}, - {file = "coverage-7.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d3d9df4051c4a7d13036524b66ecf7a7537d14c18a384043f30a303b146164e9"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f7363d3b6a1119ef05015959ca24a9afc0ea8a02c687fe7e2d557705375c01f"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2f11cc3c967a09d3695d2a6f03fb3e6236622b93be7a4b5dc09166a861be6d25"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3a4006916aa6fee7cd38db3bfc95aa9c54ebb4ffbfc47c677c8bba949ceba0a6"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9028a3871280110d6e1aa2df1afd5ef003bab5fb1ef421d6dc748ae1c8ef2ebc"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9f805d62aec8eb92bab5b61c0f07329275b6f41c97d80e847b03eb894f38d083"}, - {file = "coverage-7.3.2-cp39-cp39-win32.whl", hash = "sha256:d1c88ec1a7ff4ebca0219f5b1ef863451d828cccf889c173e1253aa84b1e07ce"}, - {file = "coverage-7.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b4767da59464bb593c07afceaddea61b154136300881844768037fd5e859353f"}, - {file = "coverage-7.3.2-pp38.pp39.pp310-none-any.whl", hash = "sha256:ae97af89f0fbf373400970c0a21eef5aa941ffeed90aee43650b81f7d7f47637"}, - {file = "coverage-7.3.2.tar.gz", hash = "sha256:be32ad29341b0170e795ca590e1c07e81fc061cb5b10c74ce7203491484404ef"}, + {file = "coverage-7.5.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:554c7327bf0fd688050348e22db7c8e163fb7219f3ecdd4732d7ed606b417263"}, + {file = "coverage-7.5.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d0305e02e40c7cfea5d08d6368576537a74c0eea62b77633179748d3519d6705"}, + {file = "coverage-7.5.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:829fb55ad437d757c70d5b1c51cfda9377f31506a0a3f3ac282bc6a387d6a5f1"}, + {file = "coverage-7.5.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:894b1acded706f1407a662d08e026bfd0ff1e59e9bd32062fea9d862564cfb65"}, + {file = "coverage-7.5.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe76d6dee5e4febefa83998b17926df3a04e5089e3d2b1688c74a9157798d7a2"}, + {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:c7ebf2a37e4f5fea3c1a11e1f47cea7d75d0f2d8ef69635ddbd5c927083211fc"}, + {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20e611fc36e1a0fc7bbf957ef9c635c8807d71fbe5643e51b2769b3cc0fb0b51"}, + {file = "coverage-7.5.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7c5c5b7ae2763533152880d5b5b451acbc1089ade2336b710a24b2b0f5239d20"}, + {file = "coverage-7.5.2-cp310-cp310-win32.whl", hash = "sha256:1e4225990a87df898e40ca31c9e830c15c2c53b1d33df592bc8ef314d71f0281"}, + {file = "coverage-7.5.2-cp310-cp310-win_amd64.whl", hash = "sha256:976cd92d9420e6e2aa6ce6a9d61f2b490e07cb468968adf371546b33b829284b"}, + {file = "coverage-7.5.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5997d418c219dcd4dcba64e50671cca849aaf0dac3d7a2eeeb7d651a5bd735b8"}, + {file = "coverage-7.5.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ec27e93bbf5976f0465e8936f02eb5add99bbe4e4e7b233607e4d7622912d68d"}, + {file = "coverage-7.5.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f11f98753800eb1ec872562a398081f6695f91cd01ce39819e36621003ec52a"}, + {file = "coverage-7.5.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e34680049eecb30b6498784c9637c1c74277dcb1db75649a152f8004fbd6646"}, + {file = "coverage-7.5.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e12536446ad4527ac8ed91d8a607813085683bcce27af69e3b31cd72b3c5960"}, + {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:3d3f7744b8a8079d69af69d512e5abed4fb473057625588ce126088e50d05493"}, + {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:431a3917e32223fcdb90b79fe60185864a9109631ebc05f6c5aa03781a00b513"}, + {file = "coverage-7.5.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a7c6574225f34ce45466f04751d957b5c5e6b69fca9351db017c9249786172ce"}, + {file = "coverage-7.5.2-cp311-cp311-win32.whl", hash = "sha256:2b144d142ec9987276aeff1326edbc0df8ba4afbd7232f0ca10ad57a115e95b6"}, + {file = "coverage-7.5.2-cp311-cp311-win_amd64.whl", hash = "sha256:900532713115ac58bc3491b9d2b52704a05ed408ba0918d57fd72c94bc47fba1"}, + {file = "coverage-7.5.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9a42970ce74c88bdf144df11c52c5cf4ad610d860de87c0883385a1c9d9fa4ab"}, + {file = "coverage-7.5.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:26716a1118c6ce2188283b4b60a898c3be29b480acbd0a91446ced4fe4e780d8"}, + {file = "coverage-7.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60b66b0363c5a2a79fba3d1cd7430c25bbd92c923d031cae906bdcb6e054d9a2"}, + {file = "coverage-7.5.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5d22eba19273b2069e4efeff88c897a26bdc64633cbe0357a198f92dca94268"}, + {file = "coverage-7.5.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3bb5b92a0ab3d22dfdbfe845e2fef92717b067bdf41a5b68c7e3e857c0cff1a4"}, + {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1aef719b6559b521ae913ddeb38f5048c6d1a3d366865e8b320270b7bc4693c2"}, + {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8809c0ea0e8454f756e3bd5c36d04dddf222989216788a25bfd6724bfcee342c"}, + {file = "coverage-7.5.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1acc2e2ef098a1d4bf535758085f508097316d738101a97c3f996bccba963ea5"}, + {file = "coverage-7.5.2-cp312-cp312-win32.whl", hash = "sha256:97de509043d3f0f2b2cd171bdccf408f175c7f7a99d36d566b1ae4dd84107985"}, + {file = "coverage-7.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:8941e35a0e991a7a20a1fa3e3182f82abe357211f2c335a9e6007067c3392fcf"}, + {file = "coverage-7.5.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5662bf0f6fb6757f5c2d6279c541a5af55a39772c2362ed0920b27e3ce0e21f7"}, + {file = "coverage-7.5.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3d9c62cff2ffb4c2a95328488fd7aa96a7a4b34873150650fe76b19c08c9c792"}, + {file = "coverage-7.5.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74eeaa13e8200ad72fca9c5f37395fb310915cec6f1682b21375e84fd9770e84"}, + {file = "coverage-7.5.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f29bf497d51a5077994b265e976d78b09d9d0dff6ca5763dbb4804534a5d380"}, + {file = "coverage-7.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f96aa94739593ae0707eda9813ce363a0a0374a810ae0eced383340fc4a1f73"}, + {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:51b6cee539168a912b4b3b040e4042b9e2c9a7ad9c8546c09e4eaeff3eacba6b"}, + {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:59a75e6aa5c25b50b5a1499f9718f2edff54257f545718c4fb100f48d570ead4"}, + {file = "coverage-7.5.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:29da75ce20cb0a26d60e22658dd3230713c6c05a3465dd8ad040ffc991aea318"}, + {file = "coverage-7.5.2-cp38-cp38-win32.whl", hash = "sha256:23f2f16958b16152b43a39a5ecf4705757ddd284b3b17a77da3a62aef9c057ef"}, + {file = "coverage-7.5.2-cp38-cp38-win_amd64.whl", hash = "sha256:9e41c94035e5cdb362beed681b58a707e8dc29ea446ea1713d92afeded9d1ddd"}, + {file = "coverage-7.5.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:06d96b9b19bbe7f049c2be3c4f9e06737ec6d8ef8933c7c3a4c557ef07936e46"}, + {file = "coverage-7.5.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:878243e1206828908a6b4a9ca7b1aa8bee9eb129bf7186fc381d2646f4524ce9"}, + {file = "coverage-7.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:482df956b055d3009d10fce81af6ffab28215d7ed6ad4a15e5c8e67cb7c5251c"}, + {file = "coverage-7.5.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a35c97af60a5492e9e89f8b7153fe24eadfd61cb3a2fb600df1a25b5dab34b7e"}, + {file = "coverage-7.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:24bb4c7859a3f757a116521d4d3a8a82befad56ea1bdacd17d6aafd113b0071e"}, + {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e1046aab24c48c694f0793f669ac49ea68acde6a0798ac5388abe0a5615b5ec8"}, + {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:448ec61ea9ea7916d5579939362509145caaecf03161f6f13e366aebb692a631"}, + {file = "coverage-7.5.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4a00bd5ba8f1a4114720bef283cf31583d6cb1c510ce890a6da6c4268f0070b7"}, + {file = "coverage-7.5.2-cp39-cp39-win32.whl", hash = "sha256:9f805481d5eff2a96bac4da1570ef662bf970f9a16580dc2c169c8c3183fa02b"}, + {file = "coverage-7.5.2-cp39-cp39-win_amd64.whl", hash = "sha256:2c79f058e7bec26b5295d53b8c39ecb623448c74ccc8378631f5cb5c16a7e02c"}, + {file = "coverage-7.5.2-pp38.pp39.pp310-none-any.whl", hash = "sha256:40dbb8e7727560fe8ab65efcddfec1ae25f30ef02e2f2e5d78cfb52a66781ec5"}, + {file = "coverage-7.5.2.tar.gz", hash = "sha256:13017a63b0e499c59b5ba94a8542fb62864ba3016127d1e4ef30d354fc2b00e9"}, ] [package.dependencies] From c009d320ccfbed75024940c38df1bcb589f1a5a1 Mon Sep 17 00:00:00 2001 From: Matteo Mortari Date: Tue, 28 May 2024 14:00:41 +0200 Subject: [PATCH 4/5] fix istio VirtualService manifest (#101) fix: refactor istio virtualservice to support routes for REST internal and external routing, and gRPC internal routing (#2) * fix: refactor istio virtualservice to support routes for REST internal and external routing, and gRPC internal routing * fix: simplify istio config by excluding DB port and enabling istio sidecar injection in model registry deployment Co-authored-by: Dhiraj Bokde --- .../base/model-registry-deployment.yaml | 2 ++ .../base/model-registry-service.yaml | 2 ++ .../options/istio/virtual-service.yaml | 19 ++++++++++++------- .../kustomize/overlays/db/kustomization.yaml | 7 +++++++ .../db/patches/model-registry-deployment.yaml | 4 ++++ .../overlays/postgres/kustomization.yaml | 7 +++++++ .../patches/model-registry-deployment.yaml | 4 ++++ 7 files changed, 38 insertions(+), 7 deletions(-) diff --git a/manifests/kustomize/base/model-registry-deployment.yaml b/manifests/kustomize/base/model-registry-deployment.yaml index 206cae4d0..8a5bbfbf2 100644 --- a/manifests/kustomize/base/model-registry-deployment.yaml +++ b/manifests/kustomize/base/model-registry-deployment.yaml @@ -11,6 +11,8 @@ spec: component: model-registry-server template: metadata: + annotations: + sidecar.istio.io/inject: "true" labels: component: model-registry-server spec: diff --git a/manifests/kustomize/base/model-registry-service.yaml b/manifests/kustomize/base/model-registry-service.yaml index d7d362c3f..33a4215d6 100644 --- a/manifests/kustomize/base/model-registry-service.yaml +++ b/manifests/kustomize/base/model-registry-service.yaml @@ -11,7 +11,9 @@ spec: ports: - port: 8080 protocol: TCP + appProtocol: http name: http-api - port: 9090 protocol: TCP + appProtocol: grpc name: grpc-api diff --git a/manifests/kustomize/options/istio/virtual-service.yaml b/manifests/kustomize/options/istio/virtual-service.yaml index e410e6c94..576c02086 100644 --- a/manifests/kustomize/options/istio/virtual-service.yaml +++ b/manifests/kustomize/options/istio/virtual-service.yaml @@ -7,18 +7,23 @@ spec: - kubeflow-gateway hosts: - '*' - tcp: + http: - match: - - port: 8080 + - uri: + prefix: /api/model_registry/ route: - destination: host: model-registry-service.kubeflow.svc.cluster.local port: number: 8080 - match: - - port: 9090 + - port: 9090 + - authority: + regex: model-registry-service(\..+)?(:9090)? + - uri: + prefix: /ml_metadata.MetadataStoreService/ route: - - destination: - host: model-registry-service.kubeflow.svc.cluster.local - port: - number: 9090 + - destination: + host: model-registry-service.kubeflow.svc.cluster.local + port: + number: 9090 diff --git a/manifests/kustomize/overlays/db/kustomization.yaml b/manifests/kustomize/overlays/db/kustomization.yaml index 42fea9f09..947c7a985 100644 --- a/manifests/kustomize/overlays/db/kustomization.yaml +++ b/manifests/kustomize/overlays/db/kustomization.yaml @@ -36,3 +36,10 @@ vars: apiVersion: v1 kind: Service name: model-registry-db +- name: MYSQL_PORT + objref: + kind: ConfigMap + name: model-registry-db-parameters + apiVersion: v1 + fieldref: + fieldpath: data.MYSQL_PORT diff --git a/manifests/kustomize/overlays/db/patches/model-registry-deployment.yaml b/manifests/kustomize/overlays/db/patches/model-registry-deployment.yaml index 5d788ed76..e9a8e0c32 100644 --- a/manifests/kustomize/overlays/db/patches/model-registry-deployment.yaml +++ b/manifests/kustomize/overlays/db/patches/model-registry-deployment.yaml @@ -4,6 +4,10 @@ metadata: name: model-registry-deployment spec: template: + metadata: + annotations: + # db doesn't use istio + traffic.sidecar.istio.io/excludeOutboundPorts: $(MYSQL_PORT) spec: containers: - name: rest-container diff --git a/manifests/kustomize/overlays/postgres/kustomization.yaml b/manifests/kustomize/overlays/postgres/kustomization.yaml index facbb163f..e52acd8e9 100644 --- a/manifests/kustomize/overlays/postgres/kustomization.yaml +++ b/manifests/kustomize/overlays/postgres/kustomization.yaml @@ -36,3 +36,10 @@ vars: apiVersion: v1 fieldref: fieldpath: metadata.name +- name: POSTGRES_PORT + objref: + kind: ConfigMap + name: model-registry-db-parameters + apiVersion: v1 + fieldref: + fieldpath: data.POSTGRES_PORT diff --git a/manifests/kustomize/overlays/postgres/patches/model-registry-deployment.yaml b/manifests/kustomize/overlays/postgres/patches/model-registry-deployment.yaml index a97fc2a99..0f8fdbd09 100644 --- a/manifests/kustomize/overlays/postgres/patches/model-registry-deployment.yaml +++ b/manifests/kustomize/overlays/postgres/patches/model-registry-deployment.yaml @@ -4,6 +4,10 @@ metadata: name: model-registry-deployment spec: template: + metadata: + annotations: + # db doesn't use istio + traffic.sidecar.istio.io/excludeOutboundPorts: $(POSTGRES_PORT) spec: containers: - name: grpc-container From 8d77c13100c6cc5a9465d4293403114a3576fdd7 Mon Sep 17 00:00:00 2001 From: Eder Ignatowicz Date: Thu, 30 May 2024 08:05:33 -0400 Subject: [PATCH 5/5] feat: Initial commit for UI #108 (#114) In this commit: - basic Dockerfile - basic Makefile - Scaffold of App and first sample endpoint (http://localhost:4000/api/v1/healthcheck/) - REST API basic infrastructure and error handling Signed-off-by: Eder Ignatowicz --- clients/ui/bff/.gitignore | 1 + clients/ui/bff/Dockerfile | 36 ++++++ clients/ui/bff/Makefile | 33 ++++++ clients/ui/bff/README.md | 23 ++++ clients/ui/bff/api/app.go | 41 +++++++ clients/ui/bff/api/errors.go | 103 ++++++++++++++++++ .../ui/bff/api/healthcheck__handler_test.go | 50 +++++++++ clients/ui/bff/api/healthcheck_handler.go | 22 ++++ clients/ui/bff/api/helpers.go | 87 +++++++++++++++ clients/ui/bff/api/middleware.go | 29 +++++ clients/ui/bff/cmd/main.go | 47 ++++++++ clients/ui/bff/config/environment.go | 5 + clients/ui/bff/data/health_check_model.go | 22 ++++ clients/ui/bff/data/models.go | 12 ++ clients/ui/bff/go.mod | 14 +++ clients/ui/bff/go.sum | 11 ++ clients/ui/frontend/.gitkeep | 0 17 files changed, 536 insertions(+) create mode 100644 clients/ui/bff/.gitignore create mode 100644 clients/ui/bff/Dockerfile create mode 100644 clients/ui/bff/Makefile create mode 100644 clients/ui/bff/README.md create mode 100644 clients/ui/bff/api/app.go create mode 100644 clients/ui/bff/api/errors.go create mode 100644 clients/ui/bff/api/healthcheck__handler_test.go create mode 100644 clients/ui/bff/api/healthcheck_handler.go create mode 100644 clients/ui/bff/api/helpers.go create mode 100644 clients/ui/bff/api/middleware.go create mode 100644 clients/ui/bff/cmd/main.go create mode 100644 clients/ui/bff/config/environment.go create mode 100644 clients/ui/bff/data/health_check_model.go create mode 100644 clients/ui/bff/data/models.go create mode 100644 clients/ui/bff/go.mod create mode 100644 clients/ui/bff/go.sum create mode 100644 clients/ui/frontend/.gitkeep diff --git a/clients/ui/bff/.gitignore b/clients/ui/bff/.gitignore new file mode 100644 index 000000000..5e56e040e --- /dev/null +++ b/clients/ui/bff/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/clients/ui/bff/Dockerfile b/clients/ui/bff/Dockerfile new file mode 100644 index 000000000..4a8ced09b --- /dev/null +++ b/clients/ui/bff/Dockerfile @@ -0,0 +1,36 @@ +# Use the golang image to build the application +FROM golang:1.22.2 AS builder +ARG TARGETOS +ARG TARGETARCH + +WORKDIR /ui + +# Copy the Go Modules manifests +COPY go.mod go.sum ./ + +# Download dependencies +RUN go mod download + +# Copy the go source files +COPY cmd/ cmd/ +COPY api/ api/ +COPY config/ config/ +COPY data/ data/ + +# Build the Go application +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o bff ./cmd/main.go + +# Use distroless as minimal base image to package the application binary +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=builder ui/bff ./ +USER 65532:65532 + +# Expose port 4000 +EXPOSE 4000 + +# Define environment variables +ENV PORT 4001 +ENV ENV development + +ENTRYPOINT ["/bff"] diff --git a/clients/ui/bff/Makefile b/clients/ui/bff/Makefile new file mode 100644 index 000000000..1f60e8eee --- /dev/null +++ b/clients/ui/bff/Makefile @@ -0,0 +1,33 @@ +CONTAINER_TOOL ?= docker +IMG ?= model-registry-bff:latest + +.PHONY: all +all: build + +.PHONY: help +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: vet +vet: . + go vet ./... + +.PHONY: test +test: + go test ./... + +.PHONY: build +build: fmt vet test + go build -o bin/bff cmd/main.go + +.PHONY: run +run: fmt vet + PORT=4000 go run ./cmd/main.go + +.PHONY: docker-build +docker-build: + $(CONTAINER_TOOL) build -t ${IMG} . \ No newline at end of file diff --git a/clients/ui/bff/README.md b/clients/ui/bff/README.md new file mode 100644 index 000000000..e7f96d8a1 --- /dev/null +++ b/clients/ui/bff/README.md @@ -0,0 +1,23 @@ +# Kubeflow Model Registry UI BFF +The Kubeflow Model Registry UI BFF is the _backend for frontend_ (BFF) used by the Kubeflow Model Registry UI. + +# Building and Deploying +TBD + +# Development +TBD + +## Getting started + +### Endpoints + +| URL Pattern | Handler | Action | +|---------------------|--------------------|-------------------------------| +| GET /v1/healthcheck | HealthcheckHandler | Show application information. | + + +### Sample local calls +``` +# GET /v1/healthcheck +curl -i localhost:4000/api/v1/healthcheck/ +``` \ No newline at end of file diff --git a/clients/ui/bff/api/app.go b/clients/ui/bff/api/app.go new file mode 100644 index 000000000..00fd009aa --- /dev/null +++ b/clients/ui/bff/api/app.go @@ -0,0 +1,41 @@ +package api + +import ( + "github.com/kubeflow/model-registry/ui/bff/config" + "github.com/kubeflow/model-registry/ui/bff/data" + "log/slog" + "net/http" + + "github.com/julienschmidt/httprouter" +) + +const ( + // TODO(ederign) discuss versioning with the team + Version = "1.0.0" + HealthCheckPath = "/api/v1/healthcheck/" +) + +type App struct { + config config.EnvConfig + logger *slog.Logger + models data.Models +} + +func NewApp(cfg config.EnvConfig, logger *slog.Logger) *App { + app := &App{ + config: cfg, + logger: logger, + } + return app +} + +func (app *App) Routes() http.Handler { + router := httprouter.New() + + router.NotFound = http.HandlerFunc(app.notFoundResponse) + router.MethodNotAllowed = http.HandlerFunc(app.methodNotAllowedResponse) + + router.GET(HealthCheckPath, app.HealthcheckHandler) + + return app.RecoverPanic(app.enableCORS(router)) +} diff --git a/clients/ui/bff/api/errors.go b/clients/ui/bff/api/errors.go new file mode 100644 index 000000000..1f002cc8e --- /dev/null +++ b/clients/ui/bff/api/errors.go @@ -0,0 +1,103 @@ +package api + +import ( + "encoding/json" + "fmt" + "net/http" + "strconv" +) + +type HTTPError struct { + StatusCode int `json:"-"` + ErrorResponse +} + +type ErrorResponse struct { + Code string `json:"code"` + Message string `json:"message"` +} + +func (app *App) LogError(r *http.Request, err error) { + var ( + method = r.Method + uri = r.URL.RequestURI() + ) + + app.logger.Error(err.Error(), "method", method, "uri", uri) +} + +func (app *App) badRequestResponse(w http.ResponseWriter, r *http.Request, err error) { + httpError := &HTTPError{ + StatusCode: http.StatusBadRequest, + ErrorResponse: ErrorResponse{ + Code: strconv.Itoa(http.StatusBadRequest), + Message: err.Error(), + }, + } + app.errorResponse(w, r, httpError) +} + +func (app *App) errorResponse(w http.ResponseWriter, r *http.Request, error *HTTPError) { + + env := Envelope{"error": error} + + err := app.WriteJSON(w, error.StatusCode, env, nil) + + if err != nil { + app.LogError(r, err) + w.WriteHeader(error.StatusCode) + } +} + +func (app *App) serverErrorResponse(w http.ResponseWriter, r *http.Request, err error) { + app.LogError(r, err) + + httpError := &HTTPError{ + StatusCode: http.StatusInternalServerError, + ErrorResponse: ErrorResponse{ + Code: strconv.Itoa(http.StatusInternalServerError), + Message: "the server encountered a problem and could not process your request", + }, + } + app.errorResponse(w, r, httpError) +} + +func (app *App) notFoundResponse(w http.ResponseWriter, r *http.Request) { + + httpError := &HTTPError{ + StatusCode: http.StatusNotFound, + ErrorResponse: ErrorResponse{ + Code: strconv.Itoa(http.StatusNotFound), + Message: "the requested resource could not be found", + }, + } + app.errorResponse(w, r, httpError) +} + +func (app *App) methodNotAllowedResponse(w http.ResponseWriter, r *http.Request) { + + httpError := &HTTPError{ + StatusCode: http.StatusMethodNotAllowed, + ErrorResponse: ErrorResponse{ + Code: strconv.Itoa(http.StatusMethodNotAllowed), + Message: fmt.Sprintf("the %s method is not supported for this resource", r.Method), + }, + } + app.errorResponse(w, r, httpError) +} + +func (app *App) failedValidationResponse(w http.ResponseWriter, r *http.Request, errors map[string]string) { + + message, err := json.Marshal(errors) + if err != nil { + message = []byte("{}") + } + httpError := &HTTPError{ + StatusCode: http.StatusUnprocessableEntity, + ErrorResponse: ErrorResponse{ + Code: strconv.Itoa(http.StatusUnprocessableEntity), + Message: string(message), + }, + } + app.errorResponse(w, r, httpError) +} diff --git a/clients/ui/bff/api/healthcheck__handler_test.go b/clients/ui/bff/api/healthcheck__handler_test.go new file mode 100644 index 000000000..87f5432d4 --- /dev/null +++ b/clients/ui/bff/api/healthcheck__handler_test.go @@ -0,0 +1,50 @@ +package api + +import ( + "encoding/json" + "github.com/kubeflow/model-registry/ui/bff/config" + "github.com/kubeflow/model-registry/ui/bff/data" + "github.com/stretchr/testify/assert" + "io" + "net/http" + "net/http/httptest" + "testing" +) + +func TestHealthCheckHandler(t *testing.T) { + + app := App{config: config.EnvConfig{ + Port: 4000, + }} + + rr := httptest.NewRecorder() + req, err := http.NewRequest(http.MethodGet, HealthCheckPath, nil) + if err != nil { + t.Fatal(err) + } + + app.HealthcheckHandler(rr, req, nil) + rs := rr.Result() + + defer rs.Body.Close() + + body, err := io.ReadAll(rs.Body) + if err != nil { + t.Fatal("Failed to read response body") + } + + var healthCheckRes data.HealthCheckModel + err = json.Unmarshal(body, &healthCheckRes) + if err != nil { + t.Fatalf("Error unmarshalling response JSON: %v", err) + } + + expected := data.HealthCheckModel{ + Status: "available", + SystemInfo: data.SystemInfo{ + Version: Version, + }, + } + + assert.Equal(t, expected, healthCheckRes) +} diff --git a/clients/ui/bff/api/healthcheck_handler.go b/clients/ui/bff/api/healthcheck_handler.go new file mode 100644 index 000000000..2f8223a7f --- /dev/null +++ b/clients/ui/bff/api/healthcheck_handler.go @@ -0,0 +1,22 @@ +package api + +import ( + "github.com/julienschmidt/httprouter" + "net/http" +) + +func (app *App) HealthcheckHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + + healthCheck, err := app.models.HealthCheck.HealthCheck(Version) + if err != nil { + app.serverErrorResponse(w, r, err) + return + } + + err = app.WriteJSON(w, http.StatusOK, healthCheck, nil) + + if err != nil { + app.serverErrorResponse(w, r, err) + } + +} diff --git a/clients/ui/bff/api/helpers.go b/clients/ui/bff/api/helpers.go new file mode 100644 index 000000000..c1c0e87bb --- /dev/null +++ b/clients/ui/bff/api/helpers.go @@ -0,0 +1,87 @@ +package api + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "strings" +) + +type Envelope map[string]any + +func (app *App) WriteJSON(w http.ResponseWriter, status int, data any, headers http.Header) error { + + js, err := json.MarshalIndent(data, "", "\t") + + if err != nil { + return err + } + + js = append(js, '\n') + + for key, value := range headers { + w.Header()[key] = value + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(status) + w.Write(js) + + return nil +} + +func (app *App) ReadJSON(w http.ResponseWriter, r *http.Request, dst any) error { + + maxBytes := 1_048_576 + r.Body = http.MaxBytesReader(w, r.Body, int64(maxBytes)) + + dec := json.NewDecoder(r.Body) + dec.DisallowUnknownFields() + + err := dec.Decode(dst) + + if err != nil { + var syntaxError *json.SyntaxError + var unmarshalTypeError *json.UnmarshalTypeError + var invalidUnmarshalError *json.InvalidUnmarshalError + var maxBytesError *http.MaxBytesError + + switch { + case errors.As(err, &syntaxError): + return fmt.Errorf("body contains badly-formed JSON (at character %d)", syntaxError.Offset) + + case errors.Is(err, io.ErrUnexpectedEOF): + return errors.New("body contains badly-formed JSON") + + case errors.As(err, &unmarshalTypeError): + if unmarshalTypeError.Field != "" { + return fmt.Errorf("body contains incorrect JSON type for field %q", unmarshalTypeError.Field) + } + return fmt.Errorf("body contains incorrect JSON type (at character %d)", unmarshalTypeError.Offset) + + case errors.Is(err, io.EOF): + return errors.New("body must not be empty") + + case errors.As(err, &maxBytesError): + return fmt.Errorf("body must not be larger than %d bytes", maxBytesError.Limit) + + case strings.HasPrefix(err.Error(), "json: unknown field "): + fieldName := strings.TrimPrefix(err.Error(), "json: unknown field ") + return fmt.Errorf("body contains unknown key %s", fieldName) + + case errors.As(err, &invalidUnmarshalError): + panic(err) + default: + return err + } + } + + err = dec.Decode(&struct{}{}) + if !errors.Is(err, io.EOF) { + return errors.New("body must only contain a single JSON value") + } + + return nil +} diff --git a/clients/ui/bff/api/middleware.go b/clients/ui/bff/api/middleware.go new file mode 100644 index 000000000..8d9d5d689 --- /dev/null +++ b/clients/ui/bff/api/middleware.go @@ -0,0 +1,29 @@ +package api + +import ( + "fmt" + "net/http" +) + +func (app *App) RecoverPanic(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + if err := recover(); err != nil { + w.Header().Set("Connection", "close") + app.serverErrorResponse(w, r, fmt.Errorf("%s", err)) + } + }() + + next.ServeHTTP(w, r) + }) +} + +func (app *App) enableCORS(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // TODO(ederign) restrict CORS to a much smaller set of trusted origins. + // TODO(ederign) deal with preflight requests + w.Header().Set("Access-Control-Allow-Origin", "*") + + next.ServeHTTP(w, r) + }) +} diff --git a/clients/ui/bff/cmd/main.go b/clients/ui/bff/cmd/main.go new file mode 100644 index 000000000..32b435438 --- /dev/null +++ b/clients/ui/bff/cmd/main.go @@ -0,0 +1,47 @@ +package main + +import ( + "flag" + "fmt" + "github.com/kubeflow/model-registry/ui/bff/api" + "github.com/kubeflow/model-registry/ui/bff/config" + + "log/slog" + "net/http" + "os" + "strconv" + "time" +) + +func main() { + var cfg config.EnvConfig + flag.IntVar(&cfg.Port, "port", getEnvAsInt("PORT", 4000), "API server port") + + logger := slog.New(slog.NewTextHandler(os.Stdout, nil)) + + app := api.NewApp(cfg, logger) + + srv := &http.Server{ + Addr: fmt.Sprintf(":%d", cfg.Port), + Handler: app.Routes(), + IdleTimeout: time.Minute, + ReadTimeout: 30 * time.Second, + WriteTimeout: 30 * time.Second, + ErrorLog: slog.NewLogLogger(logger.Handler(), slog.LevelError), + } + + logger.Info("starting server", "addr", srv.Addr) + + err := srv.ListenAndServe() + logger.Error(err.Error()) + os.Exit(1) +} + +func getEnvAsInt(name string, defaultVal int) int { + if value, exists := os.LookupEnv(name); exists { + if intValue, err := strconv.Atoi(value); err == nil { + return intValue + } + } + return defaultVal +} diff --git a/clients/ui/bff/config/environment.go b/clients/ui/bff/config/environment.go new file mode 100644 index 000000000..5acd1ce63 --- /dev/null +++ b/clients/ui/bff/config/environment.go @@ -0,0 +1,5 @@ +package config + +type EnvConfig struct { + Port int +} diff --git a/clients/ui/bff/data/health_check_model.go b/clients/ui/bff/data/health_check_model.go new file mode 100644 index 000000000..b8b557e61 --- /dev/null +++ b/clients/ui/bff/data/health_check_model.go @@ -0,0 +1,22 @@ +package data + +type SystemInfo struct { + Version string `json:"version"` +} + +type HealthCheckModel struct { + Status string `json:"status"` + SystemInfo SystemInfo `json:"system_info"` +} + +func (m HealthCheckModel) HealthCheck(version string) (HealthCheckModel, error) { + + var res = HealthCheckModel{ + Status: "available", + SystemInfo: SystemInfo{ + Version: version, + }, + } + + return res, nil +} diff --git a/clients/ui/bff/data/models.go b/clients/ui/bff/data/models.go new file mode 100644 index 000000000..963259112 --- /dev/null +++ b/clients/ui/bff/data/models.go @@ -0,0 +1,12 @@ +package data + +// Models struct is a single convenient container to hold and represent all our data. +type Models struct { + HealthCheck HealthCheckModel +} + +func NewModels() Models { + return Models{ + HealthCheck: HealthCheckModel{}, + } +} diff --git a/clients/ui/bff/go.mod b/clients/ui/bff/go.mod new file mode 100644 index 000000000..fdf294932 --- /dev/null +++ b/clients/ui/bff/go.mod @@ -0,0 +1,14 @@ +module github.com/kubeflow/model-registry/ui/bff + +go 1.22.2 + +require ( + github.com/julienschmidt/httprouter v1.3.0 + github.com/stretchr/testify v1.8.4 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/clients/ui/bff/go.sum b/clients/ui/bff/go.sum new file mode 100644 index 000000000..3df8d16e0 --- /dev/null +++ b/clients/ui/bff/go.sum @@ -0,0 +1,11 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/clients/ui/frontend/.gitkeep b/clients/ui/frontend/.gitkeep new file mode 100644 index 000000000..e69de29bb